From: Chris Lattner Date: Wed, 12 Jan 2005 05:17:28 +0000 (+0000) Subject: Do not lose the offset from teh global when peephole optimizing instructions. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a23ccfb124196cd13232ba7015192598ad894645;p=oota-llvm.git Do not lose the offset from teh global when peephole optimizing instructions. This fixes FreeBench/pcompress git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19507 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86PeepholeOpt.cpp b/lib/Target/X86/X86PeepholeOpt.cpp index 9d02cbd69a9..8baf5d214c4 100644 --- a/lib/Target/X86/X86PeepholeOpt.cpp +++ b/lib/Target/X86/X86PeepholeOpt.cpp @@ -198,9 +198,11 @@ bool PH::PeepholeOptimize(MachineBasicBlock &MBB, addReg(R1).addSImm(Offset).addZImm((char)Val)); } else if (MI->getOperand(3).isGlobalAddress()) { GlobalValue *GA = MI->getOperand(3).getGlobal(); + int Offset = MI->getOperand(3).getOffset(); I = MBB.insert(MBB.erase(I), BuildMI(Opcode, 5).addReg(R0).addZImm(Scale). - addReg(R1).addGlobalAddress(GA).addZImm((char)Val)); + addReg(R1).addGlobalAddress(GA, false, Offset). + addZImm((char)Val)); } return true; }