[PATCH] D21190: [InstCombine] allow more than one use for vector cast folding with selects

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 11:52:34 PDT 2016


eli.friedman added a comment.

Is it possible that this could cause an infinite loop in instcombine?  Previously, this transform always reduced the total number of bitcasts in the function, but this doesn't.  (Consider the case where the select uses its own result.)


================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:151
@@ -144,3 +150,3 @@
   // Only handle binary operators here.
-  if (!isa<BinaryOperator>(TI))
+  if (!isa<BinaryOperator>(TI) || !TI->hasOneUse() || !FI->hasOneUse())
     return nullptr;
----------------
Need to fix comment here?


http://reviews.llvm.org/D21190





More information about the llvm-commits mailing list