[PATCH] D136656: [IR Verifier] didn't check if switch case is constant, align IR Verifier's check with LLParser.
Peter Rong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 24 20:52:36 PDT 2022
Peter added inline comments.
================
Comment at: llvm/lib/IR/Verifier.cpp:2882
for (auto &Case : SI.cases()) {
+ Check(isa<ConstantInt>(SI.getOperand(Case.getCaseIndex() * 2 + 2)),
+ "Case value is not a constant integer.", &SI);
----------------
arsenm wrote:
> Is this missing a check for a consistent number of operands, or is that hidden somewhere else?
I don't think there is a check for operand number consistency.
The `Index * 2 + 2` is `getCaseValue()`'s default behavior. I believe `SwitchInst` manages operand number consistency when you `addCase()`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136656/new/
https://reviews.llvm.org/D136656
More information about the llvm-commits
mailing list