mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Pointer arithmetic should be done with the index the same size as the pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43120 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -4134,6 +4134,13 @@ SDOperand SelectionDAGLegalize::ExpandEXTRACT_VECTOR_ELT(SDOperand Op) {
|
||||
unsigned EltSize = MVT::getSizeInBits(Op.getValueType())/8;
|
||||
Idx = DAG.getNode(ISD::MUL, Idx.getValueType(), Idx,
|
||||
DAG.getConstant(EltSize, Idx.getValueType()));
|
||||
|
||||
if (MVT::getSizeInBits(Idx.getValueType()) >
|
||||
MVT::getSizeInBits(TLI.getPointerTy()))
|
||||
Idx = DAG.getNode(ISD::TRUNCATE, TLI.getPointerTy(), StackPtr);
|
||||
else
|
||||
Idx = DAG.getNode(ISD::SIGN_EXTEND, TLI.getPointerTy(), StackPtr);
|
||||
|
||||
StackPtr = DAG.getNode(ISD::ADD, Idx.getValueType(), Idx, StackPtr);
|
||||
|
||||
Op = DAG.getLoad(Op.getValueType(), Ch, StackPtr, NULL, 0);
|
||||
|
Reference in New Issue
Block a user