forked from OSchip/llvm-project
parent
020588cee3
commit
fe174df170
|
@ -2699,12 +2699,13 @@ void SelectionDAGLowering::visitGetElementPtr(User &I) {
|
||||||
if (CI->getZExtValue() == 0) continue;
|
if (CI->getZExtValue() == 0) continue;
|
||||||
uint64_t Offs =
|
uint64_t Offs =
|
||||||
TD->getTypePaddedSize(Ty)*cast<ConstantInt>(CI)->getSExtValue();
|
TD->getTypePaddedSize(Ty)*cast<ConstantInt>(CI)->getSExtValue();
|
||||||
SDValue OffsVal = DAG.getConstant(Offs, MVT::i64);
|
SDValue OffsVal;
|
||||||
unsigned PtrBits = TLI.getPointerTy().getSizeInBits();
|
unsigned PtrBits = TLI.getPointerTy().getSizeInBits();
|
||||||
if (PtrBits < 64)
|
if (PtrBits < 64) {
|
||||||
OffsVal = DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(),
|
OffsVal = DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(),
|
||||||
TLI.getPointerTy(), OffsVal);
|
TLI.getPointerTy(),
|
||||||
else
|
DAG.getConstant(Offs, MVT::i64));
|
||||||
|
} else
|
||||||
OffsVal = DAG.getIntPtrConstant(Offs);
|
OffsVal = DAG.getIntPtrConstant(Offs);
|
||||||
N = DAG.getNode(ISD::ADD, getCurDebugLoc(), N.getValueType(), N,
|
N = DAG.getNode(ISD::ADD, getCurDebugLoc(), N.getValueType(), N,
|
||||||
OffsVal);
|
OffsVal);
|
||||||
|
|
Loading…
Reference in New Issue