[llvm] 6da8f3b - [X86] combinei64TruncSrlConstant - sink EVT::getIntegerVT to ISD::ADD case only. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue May 27 02:35:00 PDT 2025


Author: Simon Pilgrim
Date: 2025-05-27T10:34:47+01:00
New Revision: 6da8f3bd5df2bb860f8cc32e9cfc739baf102295

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

LOG: [X86] combinei64TruncSrlConstant - sink EVT::getIntegerVT to ISD::ADD case only. NFC.

Don't bother creating the CleanUpVT variable unless its being used by the getZeroExtendInReg call in the ISD::ADD case

Noticed while triaging #141496

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 92e980574a187..9c340c605c110 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -54232,10 +54232,11 @@ static SDValue combinei64TruncSrlConstant(SDValue N, EVT VT, SelectionDAG &DAG,
   APInt NewOpConstVal = OpConst.lshr(SrlConst).trunc(VT.getSizeInBits());
   SDValue NewOpConst = DAG.getConstant(NewOpConstVal, DL, VT);
   SDValue NewOpNode = DAG.getNode(Opcode, DL, VT, Trunc, NewOpConst);
-  EVT CleanUpVT = EVT::getIntegerVT(*DAG.getContext(), 64 - SrlConstVal);
 
-  if (Opcode == ISD::ADD)
+  if (Opcode == ISD::ADD) {
+    EVT CleanUpVT = EVT::getIntegerVT(*DAG.getContext(), 64 - SrlConstVal);
     return DAG.getZeroExtendInReg(NewOpNode, DL, CleanUpVT);
+  }
   return NewOpNode;
 }
 


        


More information about the llvm-commits mailing list