[llvm-commits] [llvm] r167830 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp test/CodeGen/Generic/vector.ll
Duncan Sands
baldrick at free.fr
Tue Nov 13 05:01:58 PST 2012
Author: baldrick
Date: Tue Nov 13 07:01:58 2012
New Revision: 167830
URL: http://llvm.org/viewvc/llvm-project?rev=167830&view=rev
Log:
Codegen support for arbitrary vector getelementptrs.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/trunk/test/CodeGen/Generic/vector.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=167830&r1=167829&r2=167830&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Nov 13 07:01:58 2012
@@ -3137,12 +3137,12 @@
OI != E; ++OI) {
const Value *Idx = *OI;
if (StructType *StTy = dyn_cast<StructType>(Ty)) {
- unsigned Field = cast<ConstantInt>(Idx)->getZExtValue();
+ unsigned Field = cast<Constant>(Idx)->getUniqueInteger().getZExtValue();
if (Field) {
// N = N + Offset
uint64_t Offset = TD->getStructLayout(StTy)->getElementOffset(Field);
N = DAG.getNode(ISD::ADD, getCurDebugLoc(), N.getValueType(), N,
- DAG.getIntPtrConstant(Offset));
+ DAG.getConstant(Offset, N.getValueType()));
}
Ty = StTy->getElementType(Field);
@@ -3187,7 +3187,7 @@
N.getValueType(), IdxN,
DAG.getConstant(Amt, IdxN.getValueType()));
} else {
- SDValue Scale = DAG.getConstant(ElementSize, TLI.getPointerTy());
+ SDValue Scale = DAG.getConstant(ElementSize, IdxN.getValueType());
IdxN = DAG.getNode(ISD::MUL, getCurDebugLoc(),
N.getValueType(), IdxN, Scale);
}
Modified: llvm/trunk/test/CodeGen/Generic/vector.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/vector.ll?rev=167830&r1=167829&r2=167830&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/vector.ll (original)
+++ llvm/trunk/test/CodeGen/Generic/vector.ll Tue Nov 13 07:01:58 2012
@@ -152,3 +152,8 @@
store %i4 %R, %i4* %P
ret void
}
+
+define <2 x i32*> @vector_gep(<2 x [3 x {i32, i32}]*> %a) {
+ %w = getelementptr <2 x [3 x {i32, i32}]*> %a, <2 x i32> <i32 1, i32 2>, <2 x i32> <i32 2, i32 3>, <2 x i32> <i32 1, i32 1>
+ ret <2 x i32*> %w
+}
More information about the llvm-commits
mailing list