[Mlir-commits] [mlir] [MLIR] Testing arith-to-emitc conversions using opaque types (PR #137936)
Simon Camphausen
llvmlistbot at llvm.org
Fri May 2 06:46:32 PDT 2025
================
@@ -572,21 +588,33 @@ class ShiftOpConversion : public OpConversionPattern<ArithOp> {
op.getLoc(), rhsType, "sizeof", ArrayRef<Value>{eight});
width = rewriter.create<emitc::MulOp>(op.getLoc(), rhsType, eight,
sizeOfCall.getResult(0));
- } else {
+ } else if (!retIsOpaque) {
width = rewriter.create<emitc::ConstantOp>(
op.getLoc(), rhsType,
rewriter.getIntegerAttr(rhsType, type.getIntOrFloatBitWidth()));
+ } else {
+ width = rewriter.create<emitc::ConstantOp>(
+ op.getLoc(), rhsType,
+ emitc::OpaqueAttr::get(rhsType.getContext(),
+ "opaque_shift_bitwidth"));
}
Value excessCheck = rewriter.create<emitc::CmpOp>(
op.getLoc(), rewriter.getI1Type(), emitc::CmpPredicate::lt, rhs, width);
// Any concrete value is a valid refinement of poison.
- Value poison = rewriter.create<emitc::ConstantOp>(
- op.getLoc(), arithmeticType,
- (isa<IntegerType>(arithmeticType)
- ? rewriter.getIntegerAttr(arithmeticType, 0)
- : rewriter.getIndexAttr(0)));
+ Value poison;
+ if (retIsOpaque) {
+ poison = rewriter.create<emitc::ConstantOp>(
+ op.getLoc(), arithmeticType,
+ emitc::OpaqueAttr::get(rhsType.getContext(), "opaque_shift_poison"));
----------------
simon-camp wrote:
Same as above, where is this defined and why is it needed?
https://github.com/llvm/llvm-project/pull/137936
More information about the Mlir-commits
mailing list