llvm.org GIT mirror llvm / 427f4c1
It's not safe to fold a load from GV stub or constantpool into a two-address use. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49002 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 12 years ago
3 changed file(s) with 51 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
756756 if (FilterFoldedOps(MI, Ops, MRInfo, FoldOps))
757757 return false;
758758
759 // Can't fold a load from fixed stack slot into a two address instruction.
760 if (isSS && DefMI && (MRInfo & VirtRegMap::isMod))
759 // The only time it's safe to fold into a two address instruction is when
760 // it's folding reload and spill from / into a spill stack slot.
761 if (DefMI && (MRInfo & VirtRegMap::isMod))
761762 return false;
762763
763764 MachineInstr *fmi = isSS ? tii_->foldMemoryOperand(*mf_, MI, FoldOps, Slot)
18241824 MI->getOperand(0).getReg() == MI->getOperand(1).getReg()) {
18251825 OpcodeTablePtr = &RegOp2MemOpTable2Addr;
18261826 isTwoAddrFold = true;
1827 // Can't write back to CPI or a GV stub.
1828 if (MOs[3].isCPI() ||
1829 (MOs[3].isGlobal() && isGVStub(MOs[3].getGlobal(), TM)))
1830 return NULL;
18271831 } else if (i == 0) { // If operand 0
1832 // Can't write back to CPI or a GV stub.
1833 if (MOs[3].isCPI() ||
1834 (MOs[3].isGlobal() && isGVStub(MOs[3].getGlobal(), TM)))
1835 return NULL;
18281836 if (MI->getOpcode() == X86::MOV16r0)
18291837 NewMI = MakeM0Inst(*this, X86::MOV16mi, MOs, MI);
18301838 else if (MI->getOpcode() == X86::MOV32r0)
0 ; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -relocation-model=pic -disable-fp-elim | grep add | grep 12 | not grep non_lazy_ptr
1 ; Don't fold re-materialized load into a two address instruction
2
3 %"struct.Smarts::Runnable" = type { i32 (...)**, i32 }
4 %struct.__sbuf = type { i8*, i32 }
5 %"struct.std::ios_base" = type { i32 (...)**, i32, i32, i32, i32, i32, %"struct.std::ios_base::_Callback_list"*, %struct.__sbuf, [8 x %struct.__sbuf], i32, %struct.__sbuf*, %"struct.std::locale" }
6 %"struct.std::ios_base::_Callback_list" = type { %"struct.std::ios_base::_Callback_list"*, void (i32, %"struct.std::ios_base"*, i32)*, i32, i32 }
7 %"struct.std::locale" = type { %"struct.std::locale::_Impl"* }
8 %"struct.std::locale::_Impl" = type { i32, %"struct.Smarts::Runnable"**, i32, %"struct.Smarts::Runnable"**, i8** }
9 @_ZTVSt9basic_iosIcSt11char_traitsIcEE = external constant [4 x i32 (...)*] ; <[4 x i32 (...)*]*> [#uses=1]
10 @_ZTTSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE = external constant [4 x i8*] ; <[4 x i8*]*> [#uses=1]
11 @_ZTVSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE = external constant [10 x i32 (...)*] ; <[10 x i32 (...)*]*> [#uses=2]
12 @_ZTVSt15basic_streambufIcSt11char_traitsIcEE = external constant [16 x i32 (...)*] ; <[16 x i32 (...)*]*> [#uses=1]
13 @_ZTVSt15basic_stringbufIcSt11char_traitsIcESaIcEE = external constant [16 x i32 (...)*] ; <[16 x i32 (...)*]*> [#uses=1]
14
15 define void @_GLOBAL__I__ZN5Pooma5pinfoE() nounwind {
16 entry:
17 store i32 (...)** getelementptr ([10 x i32 (...)*]* @_ZTVSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE, i32 0, i32 8), i32 (...)*** null, align 4
18 %tmp96.i.i142.i = call i8* @_Znwm( i32 180 ) nounwind ; [#uses=2]
19 call void @_ZNSt8ios_baseC2Ev( %"struct.std::ios_base"* null ) nounwind
20 store i32 (...)** getelementptr ([4 x i32 (...)*]* @_ZTVSt9basic_iosIcSt11char_traitsIcEE, i32 0, i32 2), i32 (...)*** null, align 4
21 store i32 (...)** null, i32 (...)*** null, align 4
22 %ctg2242.i.i163.i = getelementptr i8* %tmp96.i.i142.i, i32 0 ; [#uses=1]
23 %tmp150.i.i164.i = load i8** getelementptr ([4 x i8*]* @_ZTTSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE, i32 0, i64 2), align 4 ; [#uses=1]
24 %tmp150151.i.i165.i = bitcast i8* %tmp150.i.i164.i to i32 (...)** ; [#uses=1]
25 %tmp153.i.i166.i = bitcast i8* %ctg2242.i.i163.i to i32 (...)*** ; [#uses=1]
26 store i32 (...)** %tmp150151.i.i165.i, i32 (...)*** %tmp153.i.i166.i, align 4
27 %tmp159.i.i167.i = bitcast i8* %tmp96.i.i142.i to i32 (...)*** ; [#uses=1]
28 store i32 (...)** getelementptr ([10 x i32 (...)*]* @_ZTVSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE, i32 0, i32 3), i32 (...)*** %tmp159.i.i167.i, align 4
29 store i32 (...)** getelementptr ([16 x i32 (...)*]* @_ZTVSt15basic_streambufIcSt11char_traitsIcEE, i32 0, i32 2), i32 (...)*** null, align 4
30 call void @_ZNSt6localeC1Ev( %"struct.std::locale"* null ) nounwind
31 store i32 (...)** getelementptr ([16 x i32 (...)*]* @_ZTVSt15basic_stringbufIcSt11char_traitsIcESaIcEE, i32 0, i32 2), i32 (...)*** null, align 4
32 unreachable
33 }
34
35 declare i8* @_Znwm(i32)
36
37 declare void @_ZNSt8ios_baseC2Ev(%"struct.std::ios_base"*)
38
39 declare void @_ZNSt6localeC1Ev(%"struct.std::locale"*) nounwind