diff options
| author | Simon Dardis <simon.dardis@imgtec.com> | 2016-11-16 11:29:07 +0000 |
|---|---|---|
| committer | Simon Dardis <simon.dardis@imgtec.com> | 2016-11-16 11:29:07 +0000 |
| commit | 8ca1cbccc67ff348085c70a3d213c0da2428c8d1 (patch) | |
| tree | 583ab7df93f96531ba82616ec9eb41d918f492d8 /llvm/lib/Target | |
| parent | 06e1592663fe9dc9da5e754b54bd74d1823f766c (diff) | |
| download | bcm5719-llvm-8ca1cbccc67ff348085c70a3d213c0da2428c8d1.tar.gz bcm5719-llvm-8ca1cbccc67ff348085c70a3d213c0da2428c8d1.zip | |
[mips] Fix unsigned/signed type error
MipsFastISel uses a a class to represent addresses with a signed member
to represent the offset. MipsFastISel::emitStore, emitLoad and computeAddress
all treated the offset as being positive. In cases where the offset was
actually negative and a frame pointer was used, this would cause the constant
synthesis routine to crash as it would generate an unexpected instruction
sequence when frame indexes are replaced.
Reviewers: vkalintiris
Differential Revision: https://reviews.llvm.org/D26192
llvm-svn: 287099
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/Mips/MipsFastISel.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Target/Mips/MipsFastISel.cpp b/llvm/lib/Target/Mips/MipsFastISel.cpp index 895d0f7a607..cfce60cad51 100644 --- a/llvm/lib/Target/Mips/MipsFastISel.cpp +++ b/llvm/lib/Target/Mips/MipsFastISel.cpp @@ -438,7 +438,7 @@ bool MipsFastISel::computeAddress(const Value *Obj, Address &Addr) { } case Instruction::GetElementPtr: { Address SavedAddr = Addr; - uint64_t TmpOffset = Addr.getOffset(); + int64_t TmpOffset = Addr.getOffset(); // Iterate through the GEP folding the constants into offsets where // we can. gep_type_iterator GTI = gep_type_begin(U); @@ -756,7 +756,7 @@ bool MipsFastISel::emitLoad(MVT VT, unsigned &ResultReg, Address &Addr, if (Addr.isFIBase()) { unsigned FI = Addr.getFI(); unsigned Align = 4; - unsigned Offset = Addr.getOffset(); + int64_t Offset = Addr.getOffset(); MachineFrameInfo &MFI = MF->getFrameInfo(); MachineMemOperand *MMO = MF->getMachineMemOperand( MachinePointerInfo::getFixedStack(*MF, FI), MachineMemOperand::MOLoad, @@ -807,7 +807,7 @@ bool MipsFastISel::emitStore(MVT VT, unsigned SrcReg, Address &Addr, if (Addr.isFIBase()) { unsigned FI = Addr.getFI(); unsigned Align = 4; - unsigned Offset = Addr.getOffset(); + int64_t Offset = Addr.getOffset(); MachineFrameInfo &MFI = MF->getFrameInfo(); MachineMemOperand *MMO = MF->getMachineMemOperand( MachinePointerInfo::getFixedStack(*MF, FI), MachineMemOperand::MOStore, |

