If a programmer incorrectly Switch->setOperand() and Verifier will pass, causing problems when dumping this Module
This patch aligns SwitchInst's check with LLParser. It also includes a test to justify the patch.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
| llvm/lib/IR/Verifier.cpp | ||
|---|---|---|
| 2882 | Is this missing a check for a consistent number of operands, or is that hidden somewhere else? | |
| llvm/lib/IR/Verifier.cpp | ||
|---|---|---|
| 2882 | 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(). | |
| llvm/lib/IR/Verifier.cpp | ||
|---|---|---|
| 2882 | But the verifier's job is to ensure like that is followed. Not sure there's another way to bypass that | |
| llvm/lib/IR/Verifier.cpp | ||
|---|---|---|
| 2882 | I reviewed the SwitchInst definition again and couldn't find a bypass. Will merge tomorrow. | |
Is this missing a check for a consistent number of operands, or is that hidden somewhere else?