[llvm] [CodeGen] Avoid sinking vector comparisons during CodeGenPrepare (PR #113158)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 08:21:55 PDT 2024


================
@@ -1779,29 +1779,35 @@ static bool sinkCmpExpression(CmpInst *Cmp, const TargetLowering &TLI) {
   if (TLI.useSoftFloat() && isa<FCmpInst>(Cmp))
     return false;
 
-  // Only insert a cmp in each block once.
-  DenseMap<BasicBlock *, CmpInst *> InsertedCmps;
+  // Collect a list of non-phis users that are in blocks that are different to
+  // the definition block.
+  BasicBlock *DefBB = Cmp->getParent();
+  SmallSet<User *, 4> Users;
+  for (auto *U : Cmp->users()) {
+    Instruction *User = cast<Instruction>(U);
+    if (isa<PHINode>(User))
----------------
david-arm wrote:

Hi, I've reverted these changes and gone with a TLI hook instead.

https://github.com/llvm/llvm-project/pull/113158


More information about the llvm-commits mailing list