[Mlir-commits] [mlir] [mlir][scf]: Expose emitNormalizedLoopBounds/denormalizeInductionVariable util functions (NFC) (PR #94429)

Jakub Kuderski llvmlistbot at llvm.org
Wed Jun 12 21:45:25 PDT 2024


================
@@ -294,6 +302,13 @@ Value mlir::createScalarOrSplatConstant(OpBuilder &builder, Location loc,
   return builder.createOrFold<arith::ConstantOp>(loc, type, splat);
 }
 
+Type mlir::getIntType(OpFoldResult ofr) {
+  if (auto value = llvm::dyn_cast_if_present<Value>(ofr))
+    return value.getType();
+  auto attr = cast<IntegerAttr>(llvm::dyn_cast_if_present<Attribute>(ofr));
----------------
kuhar wrote:

```suggestion
  if (auto value = dyn_cast_if_present<Value>(ofr))
    return value.getType();
  auto attr = cast<IntegerAttr>(dyn_cast_if_present<Attribute>(ofr));
```

https://github.com/llvm/llvm-project/pull/94429


More information about the Mlir-commits mailing list