[InstCombine] Fix use after free when removing unreachable code (PR64235)
In degenerate cases, it is possible for unreachable code removal to remove the current instruction. However, we still return the instruction to report a change, resulting in a use after free. Instead, perform the change reporting in the same way as eraseInstFromFunction() does, by directly setting MadeIRChange and returning nullptr. Fixes https://github.com/llvm/llvm-project/issues/64235.
Loading
Please sign in to comment