aboutsummaryrefslogtreecommitdiff
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
commit65b52dffe02d6ffce8d63b4fe2d7714d69968476 (patch)
treee130b0d98428e1f5d55e76f5fb7c2be397a77f43
parentb1032a8a2f322e031f7c0947c3fb60fe9e8a10e6 (diff)
Simplify code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64164 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
index 7b613d7f24..47335d3f9a 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
+++ b/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);