This patch fixes a problem that occurs in LowerSwitch when a switch statement has a PHI node as its condition, and the PHI node only has two incoming blocks, and one of those incoming blocks is through an unreachable default in the switch statement. When this condition occurs, LowerSwitch holds a pointer to the condition value, but removes the switch block as a predecessor of the PHI block, causing the PHI node to be replaced. LowerSwitch then tries to use its stale pointer to the original condition value, causing a crash.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
The fix LGTM (with the minor comment about the testcase).
test/Transforms/LowerSwitch/condition-phi-unreachable-default.ll | ||
---|---|---|
1 ↗ | (On Diff #201792) | I think that it make sense to always check that the output is sane with FileCheck even if the testcase only should demonstrate that the code don't crash. Do you mind adding "-S | FileCheck %s" (instead of -disable-output) to the command line and add a few checks? |
Comment Actions
LGTM. I set this "ready to land", but maybe you should wait a bit before landing this to see if anyone else have comments.