================
@@ -425,6 +425,32 @@ def CIR_ConstantOp : CIR_Op<"const", [
return boolAttr.getValue();
llvm_unreachable("Expected a BoolAttr in ConstantOp");
}
+ static bool isAllOnesValue(mlir::Value value) {
+ auto constOp =
mlir::dyn_cast_or_null<cir::ConstantOp>(value.getDefiningOp());
+ if (!constOp)
+ return false;
+
+ // Check for -1 integers
+ if (auto intAttr = constOp.getValueAttr<cir::IntAttr>())
+ return intAttr.getValue().isAllOnes();
+
+ // Check for FP which are bitcasted from -1 integers
+ if (auto fpAttr = constOp.getValueAttr<cir::FPAttr>())
+ return fpAttr.getValue().bitcastToAPInt().isAllOnes();
+
----------------
andykaylor wrote:
Can you remove the extra blank line here?
https://github.com/llvm/llvm-project/pull/170427
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits