[llvm] r194940 - Use right address space pointer size
Matt Arsenault
Matthew.Arsenault at amd.com
Sat Nov 16 16:06:40 PST 2013
Author: arsenm
Date: Sat Nov 16 18:06:39 2013
New Revision: 194940
URL: http://llvm.org/viewvc/llvm-project?rev=194940&view=rev
Log:
Use right address space pointer size
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/trunk/test/CodeGen/R600/32-bit-local-address-space.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=194940&r1=194939&r2=194940&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Nov 16 18:06:39 2013
@@ -1126,9 +1126,10 @@ SDValue SelectionDAG::getGlobalAddress(c
unsigned char TargetFlags) {
assert((TargetFlags == 0 || isTargetGA) &&
"Cannot set target flags on target-independent globals");
+ const TargetLowering *TLI = TM.getTargetLowering();
// Truncate (with sign-extension) the offset value to the pointer size.
- unsigned BitWidth = TM.getTargetLowering()->getPointerTy().getSizeInBits();
+ unsigned BitWidth = TLI->getPointerTypeSizeInBits(GV->getType());
if (BitWidth < 64)
Offset = SignExtend64(Offset, BitWidth);
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=194940&r1=194939&r2=194940&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 18:06:39 2013
@@ -73,3 +73,14 @@ define void @infer_ptr_alignment_global_
store float %val, float addrspace(1)* %out
ret void
}
+
+
+ at ptr = addrspace(3) global i32 addrspace(3)* null
+ at dst = addrspace(3) global [16384 x i32] zeroinitializer
+
+; SI-LABEL: @global_ptr:
+; SI-CHECK: DS_WRITE_B32
+define void @global_ptr() nounwind {
+ store i32 addrspace(3)* getelementptr ([16384 x i32] addrspace(3)* @dst, i32 0, i32 16), i32 addrspace(3)* addrspace(3)* @ptr
+ ret void
+}
More information about the llvm-commits
mailing list