[llvm] r194932 - Fix codegen for null different sized pointer.
Matt Arsenault
Matthew.Arsenault at amd.com
Sat Nov 16 12:24:42 PST 2013
Author: arsenm
Date: Sat Nov 16 14:24:41 2013
New Revision: 194932
URL: http://llvm.org/viewvc/llvm-project?rev=194932&view=rev
Log:
Fix codegen for null different sized pointer.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/trunk/test/CodeGen/R600/32-bit-local-address-space.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=194932&r1=194931&r2=194932&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Sat Nov 16 14:24:41 2013
@@ -1064,8 +1064,10 @@ SDValue SelectionDAGBuilder::getValueImp
if (const GlobalValue *GV = dyn_cast<GlobalValue>(C))
return DAG.getGlobalAddress(GV, getCurSDLoc(), VT);
- if (isa<ConstantPointerNull>(C))
- return DAG.getConstant(0, TLI->getPointerTy());
+ if (isa<ConstantPointerNull>(C)) {
+ unsigned AS = V->getType()->getPointerAddressSpace();
+ return DAG.getConstant(0, TLI->getPointerTy(AS));
+ }
if (const ConstantFP *CFP = dyn_cast<ConstantFP>(C))
return DAG.getConstantFP(*CFP, VT);
Modified: llvm/trunk/test/CodeGen/R600/32-bit-local-address-space.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/R600/32-bit-local-address-space.ll?rev=194932&r1=194931&r2=194932&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/R600/32-bit-local-address-space.ll (original)
+++ llvm/trunk/test/CodeGen/R600/32-bit-local-address-space.ll Sat Nov 16 14:24:41 2013
@@ -40,3 +40,14 @@ entry:
store i32 %1, i32 addrspace(1)* %out
ret void
}
+
+; CHECK-LABEL: @null_32bit_lds_ptr:
+; CHECK: V_CMP_NE_I32
+; CHECK-NOT: V_CMP_NE_I32
+; CHECK: V_CNDMASK_B32
+define void @null_32bit_lds_ptr(i32 addrspace(1)* %out, i32 addrspace(3)* %lds) nounwind {
+ %cmp = icmp ne i32 addrspace(3)* %lds, null
+ %x = select i1 %cmp, i32 123, i32 456
+ store i32 %x, i32 addrspace(1)* %out
+ ret void
+}
\ No newline at end of file
More information about the llvm-commits
mailing list