[llvm] cdcd653 - [X86] combineBitcast - merge isa<>/cast<> into single dyn_cast<> call. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed May 22 05:44:39 PDT 2024


Author: Simon Pilgrim
Date: 2024-05-22T13:44:23+01:00
New Revision: cdcd65350bdeafccda33a5d4185c04f4bbe59495

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

LOG: [X86] combineBitcast - merge isa<>/cast<> into single dyn_cast<> call. NFC.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 24ee0c45b6672..37c591f90f0a3 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -43694,14 +43694,14 @@ static SDValue combineBitcast(SDNode *N, SelectionDAG &DAG,
     return combinevXi1ConstantToInteger(N0, DAG);
   }
 
-  if (Subtarget.hasAVX512() && SrcVT.isScalarInteger() &&
-      VT.isVector() && VT.getVectorElementType() == MVT::i1 &&
-      isa<ConstantSDNode>(N0)) {
-    auto *C = cast<ConstantSDNode>(N0);
-    if (C->isAllOnes())
-      return DAG.getConstant(1, SDLoc(N0), VT);
-    if (C->isZero())
-      return DAG.getConstant(0, SDLoc(N0), VT);
+  if (Subtarget.hasAVX512() && SrcVT.isScalarInteger() && VT.isVector() &&
+      VT.getVectorElementType() == MVT::i1) {
+    if (auto *C = dyn_cast<ConstantSDNode>(N0)) {
+      if (C->isAllOnes())
+        return DAG.getConstant(1, SDLoc(N0), VT);
+      if (C->isZero())
+        return DAG.getConstant(0, SDLoc(N0), VT);
+    }
   }
 
   // Look for MOVMSK that is maybe truncated and then bitcasted to vXi1.


        


More information about the llvm-commits mailing list