llvm-project
ffc31bbc - [InstCombine] Do not constant fold musttail calls unless trivially dead (#242905) (#245573)

Commit
12 days ago
[InstCombine] Do not constant fold musttail calls unless trivially dead (#242905) (#245573) When preparing the worklist in `InstCombinerImpl::prepareWorklist`, constant propagation replaces all uses of instructions with their constant-folded value before checking whether the instruction can actually be deleted via `isInstructionTriviallyDead`. For `musttail` calls with side effects (such as libcalls like `sin` or `cos`, which may write to `errno`), the call cannot be removed (`wouldInstructionBeTriviallyDead` returns `false`). Replacing the returned value with a constant in the immediately following `ret` instruction left behind an unreturned `musttail` call, violating the LLVM IR verification requirement that the result of a `musttail` call must be returned. Fixes #242905.
Author
Parents
Loading