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.
The fix LGTM (with the minor comment about the testcase).
|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?