[Mlir-commits] [mlir] [mlir][affine] Fix crash in lir::affine::getForInductionVarOwner() (PR #102625)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Aug 9 07:38:09 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-affine
Author: None (DarshanRamakant)
<details>
<summary>Changes</summary>
This change fixes a crash when getOwner()->getParent() is a nullptr
---
Full diff: https://github.com/llvm/llvm-project/pull/102625.diff
1 Files Affected:
- (modified) mlir/lib/Dialect/Affine/IR/AffineOps.cpp (+1-1)
``````````diff
diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index 35d5f53aad241f..2d4d23ba712bca 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -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))
``````````
</details>
https://github.com/llvm/llvm-project/pull/102625
More information about the Mlir-commits
mailing list