mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-04 01:43:06 +00:00
Revert 165051-165049 while looking into the foreach.m failure in
more detail. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165099 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8e8f8724e1
commit
76ad43c6e1
@ -131,12 +131,17 @@ public:
|
||||
/// into the current block.
|
||||
void recomputeInsertPt();
|
||||
|
||||
struct SavePoint {
|
||||
MachineBasicBlock::iterator InsertPt;
|
||||
DebugLoc DL;
|
||||
};
|
||||
|
||||
/// enterLocalValueArea - Prepare InsertPt to begin inserting instructions
|
||||
/// into the local value area and return the old insert position.
|
||||
MachineBasicBlock::iterator enterLocalValueArea();
|
||||
SavePoint enterLocalValueArea();
|
||||
|
||||
/// leaveLocalValueArea - Reset InsertPt to the given old insert position.
|
||||
void leaveLocalValueArea(MachineBasicBlock::iterator Old);
|
||||
void leaveLocalValueArea(SavePoint Old);
|
||||
|
||||
virtual ~FastISel();
|
||||
|
||||
|
@ -149,13 +149,13 @@ unsigned FastISel::getRegForValue(const Value *V) {
|
||||
!FuncInfo.StaticAllocaMap.count(cast<AllocaInst>(V))))
|
||||
return FuncInfo.InitializeRegForValue(V);
|
||||
|
||||
MachineBasicBlock::iterator SaveIter = enterLocalValueArea();
|
||||
SavePoint SaveInsertPt = enterLocalValueArea();
|
||||
|
||||
// Materialize the value in a register. Emit any instructions in the
|
||||
// local value area.
|
||||
Reg = materializeRegForValue(V, VT);
|
||||
|
||||
leaveLocalValueArea(SaveIter);
|
||||
leaveLocalValueArea(SaveInsertPt);
|
||||
|
||||
return Reg;
|
||||
}
|
||||
@ -238,16 +238,7 @@ unsigned FastISel::lookUpRegForValue(const Value *V) {
|
||||
DenseMap<const Value *, unsigned>::iterator I = FuncInfo.ValueMap.find(V);
|
||||
if (I != FuncInfo.ValueMap.end())
|
||||
return I->second;
|
||||
unsigned Reg = LocalValueMap[V];
|
||||
|
||||
// If we managed to find a register here then go ahead and replace the
|
||||
// current location with the location we're currently emitted for,
|
||||
// 'moving' the value to a place that's closer to where it originally
|
||||
// started.
|
||||
if (Reg)
|
||||
MRI.getVRegDef(Reg)->setDebugLoc(DL);
|
||||
|
||||
return Reg;
|
||||
return LocalValueMap[V];
|
||||
}
|
||||
|
||||
/// UpdateValueMap - Update the value map to include the new mapping for this
|
||||
@ -325,18 +316,22 @@ void FastISel::removeDeadCode(MachineBasicBlock::iterator I,
|
||||
recomputeInsertPt();
|
||||
}
|
||||
|
||||
MachineBasicBlock::iterator FastISel::enterLocalValueArea() {
|
||||
FastISel::SavePoint FastISel::enterLocalValueArea() {
|
||||
MachineBasicBlock::iterator OldInsertPt = FuncInfo.InsertPt;
|
||||
DebugLoc OldDL = DL;
|
||||
recomputeInsertPt();
|
||||
return OldInsertPt;
|
||||
DL = DebugLoc();
|
||||
SavePoint SP = { OldInsertPt, OldDL };
|
||||
return SP;
|
||||
}
|
||||
|
||||
void FastISel::leaveLocalValueArea(MachineBasicBlock::iterator I) {
|
||||
void FastISel::leaveLocalValueArea(SavePoint OldInsertPt) {
|
||||
if (FuncInfo.InsertPt != FuncInfo.MBB->begin())
|
||||
LastLocalValue = llvm::prior(FuncInfo.InsertPt);
|
||||
|
||||
// Restore the previous insert position.
|
||||
FuncInfo.InsertPt = I;
|
||||
FuncInfo.InsertPt = OldInsertPt.InsertPt;
|
||||
DL = OldInsertPt.DL;
|
||||
}
|
||||
|
||||
/// SelectBinaryOp - Select and emit code for a binary operator instruction,
|
||||
|
@ -545,7 +545,7 @@ bool X86FastISel::X86SelectAddress(const Value *V, X86AddressMode &AM) {
|
||||
StubAM.GVOpFlags = GVFlags;
|
||||
|
||||
// Prepare for inserting code in the local-value area.
|
||||
MachineBasicBlock::iterator SaveIter = enterLocalValueArea();
|
||||
SavePoint SaveInsertPt = enterLocalValueArea();
|
||||
|
||||
if (TLI.getPointerTy() == MVT::i64) {
|
||||
Opc = X86::MOV64rm;
|
||||
@ -564,7 +564,7 @@ bool X86FastISel::X86SelectAddress(const Value *V, X86AddressMode &AM) {
|
||||
addFullAddress(LoadMI, StubAM);
|
||||
|
||||
// Ok, back to normal mode.
|
||||
leaveLocalValueArea(SaveIter);
|
||||
leaveLocalValueArea(SaveInsertPt);
|
||||
|
||||
// Prevent loading GV stub multiple times in same MBB.
|
||||
LocalValueMap[V] = LoadReg;
|
||||
|
@ -146,8 +146,7 @@ static
|
||||
void emitSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI,
|
||||
unsigned StackPtr, int64_t NumBytes,
|
||||
bool Is64Bit, bool UseLEA,
|
||||
const TargetInstrInfo &TII, const TargetRegisterInfo &TRI,
|
||||
DebugLoc DL) {
|
||||
const TargetInstrInfo &TII, const TargetRegisterInfo &TRI) {
|
||||
bool isSub = NumBytes < 0;
|
||||
uint64_t Offset = isSub ? -NumBytes : NumBytes;
|
||||
unsigned Opc;
|
||||
@ -159,6 +158,7 @@ void emitSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI,
|
||||
: getADDriOpcode(Is64Bit, Offset);
|
||||
|
||||
uint64_t Chunk = (1LL << 31) - 1;
|
||||
DebugLoc DL = MBB.findDebugLoc(MBBI);
|
||||
|
||||
while (Offset) {
|
||||
uint64_t ThisVal = (Offset > Chunk) ? Chunk : Offset;
|
||||
@ -912,7 +912,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const {
|
||||
// FIXME: %rax preserves the offset and should be available.
|
||||
if (isSPUpdateNeeded)
|
||||
emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit,
|
||||
UseLEA, TII, *RegInfo, MBB.findDebugLoc(MBBI));
|
||||
UseLEA, TII, *RegInfo);
|
||||
|
||||
if (isEAXAlive) {
|
||||
// Restore EAX
|
||||
@ -924,7 +924,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const {
|
||||
}
|
||||
} else if (NumBytes)
|
||||
emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit,
|
||||
UseLEA, TII, *RegInfo, DL);
|
||||
UseLEA, TII, *RegInfo);
|
||||
|
||||
// If we need a base pointer, set it up here. It's whatever the value
|
||||
// of the stack pointer is at this point. Any variable size objects
|
||||
@ -1075,8 +1075,7 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF,
|
||||
}
|
||||
} else if (NumBytes) {
|
||||
// Adjust stack pointer back: ESP += numbytes.
|
||||
emitSPUpdate(MBB, MBBI, StackPtr, NumBytes, Is64Bit, UseLEA, TII,
|
||||
*RegInfo, MBB.findDebugLoc(MBBI));
|
||||
emitSPUpdate(MBB, MBBI, StackPtr, NumBytes, Is64Bit, UseLEA, TII, *RegInfo);
|
||||
}
|
||||
|
||||
// We're returning from function via eh_return.
|
||||
@ -1111,8 +1110,7 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF,
|
||||
if (Offset) {
|
||||
// Check for possible merge with preceding ADD instruction.
|
||||
Offset += mergeSPUpdates(MBB, MBBI, StackPtr, true);
|
||||
emitSPUpdate(MBB, MBBI, StackPtr, Offset, Is64Bit, UseLEA, TII,
|
||||
*RegInfo, MBB.findDebugLoc(MBBI));
|
||||
emitSPUpdate(MBB, MBBI, StackPtr, Offset, Is64Bit, UseLEA, TII, *RegInfo);
|
||||
}
|
||||
|
||||
// Jump to label or value in register.
|
||||
@ -1155,8 +1153,7 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF,
|
||||
|
||||
// Check for possible merge with preceding ADD instruction.
|
||||
delta += mergeSPUpdates(MBB, MBBI, StackPtr, true);
|
||||
emitSPUpdate(MBB, MBBI, StackPtr, delta, Is64Bit, UseLEA, TII,
|
||||
*RegInfo, MBB.findDebugLoc(MBBI));
|
||||
emitSPUpdate(MBB, MBBI, StackPtr, delta, Is64Bit, UseLEA, TII, *RegInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,65 +0,0 @@
|
||||
; RUN: llc -disable-fp-elim -O0 %s -mtriple x86_64-unknown-linux-gnu -o - | FileCheck %s
|
||||
|
||||
; int callme(int);
|
||||
;
|
||||
; int isel_line_test(int arg)
|
||||
; {
|
||||
; callme(100);
|
||||
; if (arg > 5000)
|
||||
; callme(200);
|
||||
; callme(300);
|
||||
; return 0;
|
||||
; }
|
||||
|
||||
define i32 @isel_line_test(i32 %arg) nounwind uwtable {
|
||||
; The start of each non-entry block (or sub-block) should get a .loc directive.
|
||||
; CHECK: isel_line_test:
|
||||
; CHECK: # BB#1:
|
||||
; CHECK-NEXT: .loc 1 7 5
|
||||
; CHECK: LBB0_2:
|
||||
; CHECK-NEXT: .loc 1 8 3
|
||||
; CHECK: callq callme
|
||||
; CHECK-NEXT: .loc 1 9 3
|
||||
|
||||
entry:
|
||||
%arg.addr = alloca i32, align 4
|
||||
store i32 %arg, i32* %arg.addr, align 4
|
||||
call void @llvm.dbg.declare(metadata !{i32* %arg.addr}, metadata !10), !dbg !11
|
||||
%call = call i32 @callme(i32 100), !dbg !12
|
||||
%0 = load i32* %arg.addr, align 4, !dbg !14
|
||||
%cmp = icmp sgt i32 %0, 5000, !dbg !14
|
||||
br i1 %cmp, label %if.then, label %if.end, !dbg !14
|
||||
|
||||
if.then: ; preds = %entry
|
||||
%call1 = call i32 @callme(i32 200), !dbg !15
|
||||
br label %if.end, !dbg !15
|
||||
|
||||
if.end: ; preds = %if.then, %entry
|
||||
%call2 = call i32 @callme(i32 300), !dbg !16
|
||||
ret i32 0, !dbg !17
|
||||
}
|
||||
|
||||
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
|
||||
|
||||
declare i32 @callme(i32)
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
|
||||
!0 = metadata !{i32 786449, i32 0, i32 12, metadata !"foo.c", metadata !"/usr/local/google/home/echristo/tmp", metadata !"clang version 3.2 (trunk 164952) (llvm/trunk 164949)", i1 true, i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !3, metadata !1} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/echristo/tmp/foo.c] [DW_LANG_C99]
|
||||
!1 = metadata !{metadata !2}
|
||||
!2 = metadata !{i32 0}
|
||||
!3 = metadata !{metadata !4}
|
||||
!4 = metadata !{metadata !5}
|
||||
!5 = metadata !{i32 786478, i32 0, metadata !6, metadata !"isel_line_test", metadata !"isel_line_test", metadata !"", metadata !6, i32 3, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32)* @isel_line_test, null, null, metadata !1, i32 4} ; [ DW_TAG_subprogram ] [line 3] [def] [scope 4] [isel_line_test]
|
||||
!6 = metadata !{i32 786473, metadata !"foo.c", metadata !"/usr/local/google/home/echristo/tmp", null} ; [ DW_TAG_file_type ]
|
||||
!7 = metadata !{i32 786453, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
||||
!8 = metadata !{metadata !9, metadata !9}
|
||||
!9 = metadata !{i32 786468, null, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
|
||||
!10 = metadata !{i32 786689, metadata !5, metadata !"arg", metadata !6, i32 16777219, metadata !9, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [arg] [line 3]
|
||||
!11 = metadata !{i32 3, i32 24, metadata !5, null}
|
||||
!12 = metadata !{i32 5, i32 3, metadata !13, null}
|
||||
!13 = metadata !{i32 786443, metadata !5, i32 4, i32 1, metadata !6, i32 0} ; [ DW_TAG_lexical_block ] [/usr/local/google/home/echristo/tmp/foo.c]
|
||||
!14 = metadata !{i32 6, i32 3, metadata !13, null}
|
||||
!15 = metadata !{i32 7, i32 5, metadata !13, null}
|
||||
!16 = metadata !{i32 8, i32 3, metadata !13, null}
|
||||
!17 = metadata !{i32 9, i32 3, metadata !13, null}
|
Loading…
Reference in New Issue
Block a user