[Mlir-commits] [mlir] [mlir][affine] Fix crash in mlir::affine::getForInductionVarOwner() (PR #102625)

Mehdi Amini llvmlistbot at llvm.org
Sun Aug 11 11:20:12 PDT 2024


================
@@ -2562,7 +2562,7 @@ bool mlir::affine::isAffineInductionVar(Value val) {
 
 AffineForOp mlir::affine::getForInductionVarOwner(Value val) {
   auto ivArg = llvm::dyn_cast<BlockArgument>(val);
-  if (!ivArg || !ivArg.getOwner())
+  if (!ivArg || !ivArg.getOwner() || !ivArg.getOwner()->getParent())
     return AffineForOp();
   auto *containingInst = ivArg.getOwner()->getParent()->getParentOp();
   if (auto forOp = dyn_cast<AffineForOp>(containingInst))
----------------
joker-eph wrote:

> But "ivArg.getOwner()" will be a "Block*"

Oh OK, reading the code here I thought it would be an `Operation *`.

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


More information about the Mlir-commits mailing list