[PATCH] D118392: [SCCP][FuncSpec] Switch away from Instruction::isSafeToRemove()

Alexandros Lamprineas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 23 11:19:27 PDT 2022


labrinea added a comment.

We did the same in IPSCCP a while ago D118387 <https://reviews.llvm.org/D118387> and the verdict was to use the following:

  static bool canRemoveInstruction(Instruction *I) {
    if (wouldInstructionBeTriviallyDead(I))
      return true;
  
    // Some instructions can be handled but are rejected above. Catch
    // those cases by falling through to here.
    // TODO: Mark globals as being constant earlier, so
    // TODO: wouldInstructionBeTriviallyDead() knows that atomic loads
    // TODO: are safe to remove.
    return isa<LoadInst>(I);
  }


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

https://reviews.llvm.org/D118392



More information about the llvm-commits mailing list