[PATCH] D121585: [InstCombine] Sink instructions with multiple users in a successor block.

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 14 12:11:52 PDT 2022


reames added a comment.

Generally, I'm fine with the direction here.  My sole concern is potential compile time of scanning the entire user list.  (i.e. say we have 100 thousand uses in one block, and the very last one is in another block)   I could see us capping the number of scanned users (we do that a bunch of places) or would want to see some time time numbers showing we don't need to.



================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:4028
         return None;
-      auto *UserInst = cast_or_null<Instruction>(I->getUniqueUndroppableUser());
-      if (!UserInst)
+      if (!I->hasNUndroppableUsesOrMore(1))
         return None;
----------------
I don't think you need this check at all.  You can simple check that UniqueParent is non-null after the loop as that implies there must be at least one use.  


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121585



More information about the llvm-commits mailing list