summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 244d245)
raw | patch | inline | side by side (parent: 244d245)
author | Matt Arsenault <Matthew.Arsenault@amd.com> | |
Mon, 21 Oct 2013 20:03:54 +0000 (20:03 +0000) | ||
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | |
Mon, 21 Oct 2013 20:03:54 +0000 (20:03 +0000) |
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193111 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/AsmPrinter/AsmPrinter.cpp | patch | blob | history | |
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | patch | blob | history | |
test/CodeGen/R600/gep-address-space.ll | [new file with mode: 0644] | patch | blob |
index 969a8dfeaea372d4a296e742556d585f9795858e..20d179fe7c9b8fc4d9bcda7e067225b2692ce414 100644 (file)
case Instruction::GetElementPtr: {
const DataLayout &DL = *AP.TM.getDataLayout();
// Generate a symbolic expression for the byte address
- APInt OffsetAI(DL.getPointerSizeInBits(), 0);
+ APInt OffsetAI(DL.getPointerTypeSizeInBits(CE->getType()), 0);
cast<GEPOperator>(CE)->accumulateConstantOffset(DL, OffsetAI);
const MCExpr *Base = lowerConstant(CE->getOperand(0), AP);
// Handle casts to pointers by changing them into casts to the appropriate
// integer type. This promotes constant folding and simplifies this code.
Constant *Op = CE->getOperand(0);
- Op = ConstantExpr::getIntegerCast(Op, DL.getIntPtrType(CV->getContext()),
+ Op = ConstantExpr::getIntegerCast(Op, DL.getIntPtrType(CV->getType()),
false/*ZExt*/);
return lowerConstant(Op, AP);
}
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 2dee37705344a356cec39fb01a81e65bff09fe48..625bc162fbb7cc3ab4e38f2c32b1ad98d7d1638f 100644 (file)
}
void SelectionDAGBuilder::visitGetElementPtr(const User &I) {
- SDValue N = getValue(I.getOperand(0));
+ Value *Op0 = I.getOperand(0);
// Note that the pointer operand may be a vector of pointers. Take the scalar
// element which holds a pointer.
- Type *Ty = I.getOperand(0)->getType()->getScalarType();
+ Type *Ty = Op0->getType()->getScalarType();
+ unsigned AS = Ty->getPointerAddressSpace();
+ SDValue N = getValue(Op0);
for (GetElementPtrInst::const_op_iterator OI = I.op_begin()+1, E = I.op_end();
OI != E; ++OI) {
Ty = StTy->getElementType(Field);
} else {
- uint32_t AS = 0;
- if (PointerType *PtrType = dyn_cast<PointerType>(Ty)) {
- AS = PtrType->getAddressSpace();
- }
Ty = cast<SequentialType>(Ty)->getElementType();
// If this is a constant subscript, handle it quickly.
diff --git a/test/CodeGen/R600/gep-address-space.ll b/test/CodeGen/R600/gep-address-space.ll
--- /dev/null
@@ -0,0 +1,10 @@
+; RUN: llc -march=r600 -mcpu=SI < %s | FileCheck %s
+
+define void @use_gep_address_space([1024 x i32] addrspace(3)* %array) nounwind {
+; CHECK-LABEL @use_gep_address_space:
+; CHECK: ADD_I32
+ %p = getelementptr [1024 x i32] addrspace(3)* %array, i16 0, i16 16
+ store i32 99, i32 addrspace(3)* %p
+ ret void
+}
+