summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-02-09 21:01:06 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-02-09 21:01:06 +0000
commitfe174df170d0eadcbe5887d0ca2e89db687265e0 (patch)
treef16c9d34390329dc2e91572f9e6bcbb0be704427 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
parent020588cee38380c9c4797244b1ce88c4409ee223 (diff)
downloadbcm5719-llvm-fe174df170d0eadcbe5887d0ca2e89db687265e0.tar.gz
bcm5719-llvm-fe174df170d0eadcbe5887d0ca2e89db687265e0.zip
Simplify code.
llvm-svn: 64164
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
index 7b613d7f242..47335d3f9a2 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
@@ -2699,12 +2699,13 @@ void SelectionDAGLowering::visitGetElementPtr(User &I) {
if (CI->getZExtValue() == 0) continue;
uint64_t Offs =
TD->getTypePaddedSize(Ty)*cast<ConstantInt>(CI)->getSExtValue();
- SDValue OffsVal = DAG.getConstant(Offs, MVT::i64);
+ SDValue OffsVal;
unsigned PtrBits = TLI.getPointerTy().getSizeInBits();
- if (PtrBits < 64)
- OffsVal = DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(),
- TLI.getPointerTy(), OffsVal);
- else
+ if (PtrBits < 64) {
+ OffsVal = DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(),
+ TLI.getPointerTy(),
+ DAG.getConstant(Offs, MVT::i64));
+ } else
OffsVal = DAG.getIntPtrConstant(Offs);
N = DAG.getNode(ISD::ADD, getCurDebugLoc(), N.getValueType(), N,
OffsVal);
OpenPOWER on IntegriCloud