[PATCH] D147041: [CodeGen] Remove redundent instructions generated by combineAddrModes.

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 23:08:15 PDT 2023


skatkov added a comment.

Please consider re-phrase the description to something like:

  CodeGenPare may optimize memory access modes.
  During such optimization, it might create 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 https://github.com/llvm/llvm-project/issues/58538, a test is also included.

lgtm.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147041/new/

https://reviews.llvm.org/D147041



More information about the llvm-commits mailing list