-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[MLIR] Fix SCF verifier crash #153974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MLIR] Fix SCF verifier crash #153974
Conversation
|
@llvm/pr-subscribers-mlir-scf Author: Mehdi Amini (joker-eph) ChangesAn operand of the nested yield op can be null and hasn't been verified yet when processing the enclosing operation. Using Full diff: https://github.com/llvm/llvm-project/pull/153974.diff 1 Files Affected:
diff --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp
index 89731de1df053..fd5b2a8e852da 100644
--- a/mlir/lib/Dialect/SCF/IR/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp
@@ -4237,13 +4237,15 @@ LogicalResult scf::IndexSwitchOp::verify() {
}
for (auto [idx, result, operand] :
llvm::zip(llvm::seq<unsigned>(0, getNumResults()), getResultTypes(),
- yield.getOperandTypes())) {
- if (result == operand)
+ yield.getOperands())) {
+ if (!operand)
+ return yield.emitOpError() << "operand " << idx << " is null\n";
+ if (result == operand.getType())
continue;
return (emitOpError("expected result #")
<< idx << " of each region to be " << result)
.attachNote(yield.getLoc())
- << name << " returns " << operand << " here";
+ << name << " returns " << operand.getType() << " here";
}
return success();
};
|
|
@llvm/pr-subscribers-mlir Author: Mehdi Amini (joker-eph) ChangesAn operand of the nested yield op can be null and hasn't been verified yet when processing the enclosing operation. Using Full diff: https://github.com/llvm/llvm-project/pull/153974.diff 1 Files Affected:
diff --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp
index 89731de1df053..fd5b2a8e852da 100644
--- a/mlir/lib/Dialect/SCF/IR/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp
@@ -4237,13 +4237,15 @@ LogicalResult scf::IndexSwitchOp::verify() {
}
for (auto [idx, result, operand] :
llvm::zip(llvm::seq<unsigned>(0, getNumResults()), getResultTypes(),
- yield.getOperandTypes())) {
- if (result == operand)
+ yield.getOperands())) {
+ if (!operand)
+ return yield.emitOpError() << "operand " << idx << " is null\n";
+ if (result == operand.getType())
continue;
return (emitOpError("expected result #")
<< idx << " of each region to be " << result)
.attachNote(yield.getLoc())
- << name << " returns " << operand << " here";
+ << name << " returns " << operand.getType() << " here";
}
return success();
};
|
dc46b77 to
30770fa
Compare
An operand of the nested yield op can be null and hasn't been verified yet when processing the enclosing operation. Using `getResultTypes()` will dereference this null Value and crash in the verifier.
30770fa to
8b0909a
Compare
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/94/builds/9959 Here is the relevant piece of the build log for the reference |
An operand of the nested yield op can be null and hasn't been verified yet when processing the enclosing operation. Using `getResultTypes()` will dereference this null Value and crash in the verifier.
An operand of the nested yield op can be null and hasn't been verified yet when processing the enclosing operation. Using `getResultTypes()` will dereference this null Value and crash in the verifier.
An operand of the nested yield op can be null and hasn't been verified yet when processing the enclosing operation. Using
getResultTypes()will dereference this null Value and crash in the verifier.