[PATCH] D20289: [InstCombine] check vector elements before trying to transform LE/GE vector icmp (PR27756)
    Chandler Carruth via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon May 16 11:04:40 PDT 2016
    
    
  
chandlerc added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:3138-3140
@@ +3137,5 @@
+
+  // Check if all elements of the constant can be safely incremented/decremented
+  // without overflowing/underflowing.
+  auto allElementsValid = [](Constant *VecConst, bool IsLT, bool IsSigned) {
+    unsigned NumElts = VecConst->getType()->getVectorNumElements();
----------------
Instead of the bool flags here, I would pass in the predicate value and handle that internally.
With that, I tihnk you can completely eliminate the switch in the calling code as the only other difference is 1 vs. -1.
http://reviews.llvm.org/D20289
    
    
More information about the llvm-commits
mailing list