[llvm] 68b56e3 - [InstCombine] NFC: Add implied condition to block in foldSelectInstWithICmp

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 08:11:31 PST 2023


Author: Sander de Smalen
Date: 2023-02-23T16:11:00Z
New Revision: 68b56e3a74706b1a63a38b8f45c50b10c82ba640

URL: https://github.com/llvm/llvm-project/commit/68b56e3a74706b1a63a38b8f45c50b10c82ba640
DIFF: https://github.com/llvm/llvm-project/commit/68b56e3a74706b1a63a38b8f45c50b10c82ba640.diff

LOG: [InstCombine] NFC: Add implied condition to block in foldSelectInstWithICmp

Added the condition 'TrueVal->getType()->isIntOrIntVectorTy' to a block of code
in foldSelectInstWithICmp which is only valid if the TrueVal is integer type.

This change was split off from D136861.

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index cefd0acbc9bf..54f064ebd335 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -1702,7 +1702,7 @@ Instruction *InstCombinerImpl::foldSelectInstWithICmp(SelectInst &SI,
 
   // FIXME: This code is nearly duplicated in InstSimplify. Using/refactoring
   // decomposeBitTestICmp() might help.
-  {
+  if (TrueVal->getType()->isIntOrIntVectorTy()) {
     unsigned BitWidth =
         DL.getTypeSizeInBits(TrueVal->getType()->getScalarType());
     APInt MinSignedValue = APInt::getSignedMinValue(BitWidth);


        


More information about the llvm-commits mailing list