[llvm] 53e9d32 - DAG: Remove unnecessary getPointerTy call (#154055)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 18 01:12:19 PDT 2025


Author: Matt Arsenault
Date: 2025-08-18T17:12:16+09:00
New Revision: 53e9d3247ef228b62331daa7ac7688d00e200050

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

LOG: DAG: Remove unnecessary getPointerTy call (#154055)

getValueType already did this

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index d2538e9832be2..2d2b37925d8fd 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1837,11 +1837,8 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value *V) {
                          getValue(CPA->getDiscriminator()));
     }
 
-    if (isa<ConstantPointerNull>(C)) {
-      unsigned AS = V->getType()->getPointerAddressSpace();
-      return DAG.getConstant(0, getCurSDLoc(),
-                             TLI.getPointerTy(DAG.getDataLayout(), AS));
-    }
+    if (isa<ConstantPointerNull>(C))
+      return DAG.getConstant(0, getCurSDLoc(), VT);
 
     if (match(C, m_VScale()))
       return DAG.getVScale(getCurSDLoc(), VT, APInt(VT.getSizeInBits(), 1));


        


More information about the llvm-commits mailing list