[Mlir-commits] [mlir] [mlir][emitc] Lower arith.index_cast, arith.index_castui, arith.shli, arith.shrui, arith.shrsi (PR #95795)
Simon Camphausen
llvmlistbot at llvm.org
Wed Jul 3 02:58:53 PDT 2024
================
@@ -339,8 +355,11 @@ class CastConversion : public OpConversionPattern<ArithOp> {
// equivalent to (v != 0). Implementing as (bool)(v & 0x01) gives
// truncation.
if (opReturnType.isInteger(1)) {
+ Type attrType = (emitc::isPointerWideType(operandType))
+ ? rewriter.getIndexType()
+ : operandType;
auto constOne = rewriter.create<emitc::ConstantOp>(
- op.getLoc(), operandType, rewriter.getIntegerAttr(operandType, 1));
+ op.getLoc(), operandType, rewriter.getIntegerAttr(attrType, 1));
----------------
simon-camp wrote:
```suggestion
op.getLoc(), operandType, rewriter.getOneAttr(attrType));
```
https://github.com/llvm/llvm-project/pull/95795
More information about the Mlir-commits
mailing list