Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CodeGen] Remove redundent instructions generated by combineAddrModes.
CodeGenPare may optimize memory access modes. During such optimization, it might create a new instruction representing combined value. Later, If the optimization failed, the generated value is not removed and remains a dead instruction. Normally this won't be a problem as dead code will be eliminated later. However, in this case (Issue 58538), the generated instruction may trigger an infinite loop. The infinite loop involves `sinkCmpExpression`, where it tries to optimize the placeholder generated by us. (See the test case detailed in the issue) To fix this, we remove the unnecessary placeholder immediately when we abort the optimization. `AddressingModeCombiner` will keep track of the placeholder, and remove it if it is an inserted placeholder and has no uses. This patch fixes #58538, a test is also included. Reviewed By: skatkov Differential Revision: https://reviews.llvm.org/D147041
- Loading branch information