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

Peter Rong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 19:36:59 PDT 2023


Peter added a comment.

>> why we continue sinking icmp while we have already have on in that BB from the bug?
>
> Because `AddressingModeCombiner::InsertPlaceholders` keeps inserting placeholders (A select instruction) that happens to satisfy `sinkCmpExpression`'s conditions

Another fix that may work is to ask this pass to not optimize dead instructions. For example, add the following:

  bool CodeGenPrepare::optimizeInst(Instruction *I, ModifyDT &ModifiedDT) {
    // Bail out if we inserted the instruction to prevent optimizations from
    // stepping on each other's toes.
    if (InsertedInsts.count(I))
      return false;
  + if (I->getNumUses() == 0) 
  +  return false;


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