[llvm-commits] [llvm] r165049 - in /llvm/trunk: include/llvm/CodeGen/FastISel.h lib/CodeGen/SelectionDAG/FastISel.cpp lib/Target/X86/X86FastISel.cpp test/DebugInfo/X86/constant-mat.ll
David Dean
david_dean at apple.com
Tue Oct 2 20:57:13 PDT 2012
Eric,
I'm pretty sure this is the one causing the foreach.m failure in the debuginfo-tests. Can you revert this one. (and if your other reverts were for this failure, it should be save to re-commit them.)
On 2 Oct 2012, at 2:16 PM, Eric Christopher <echristo at apple.com> wrote:
> Author: echristo
> Date: Tue Oct 2 16:16:50 2012
> New Revision: 165049
>
> URL: http://llvm.org/viewvc/llvm-project?rev=165049&view=rev
> Log:
> Remove the SavePoint infrastructure from fast isel, replace
> with just an insert point from the MachineBasicBlock and let
> the location be updated as we access it.
>
> Added:
> llvm/trunk/test/DebugInfo/X86/constant-mat.ll
> Modified:
> llvm/trunk/include/llvm/CodeGen/FastISel.h
> llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
> llvm/trunk/lib/Target/X86/X86FastISel.cpp
>
> Modified: llvm/trunk/include/llvm/CodeGen/FastISel.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FastISel.h?rev=165049&r1=165048&r2=165049&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/FastISel.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/FastISel.h Tue Oct 2 16:16:50 2012
> @@ -131,17 +131,12 @@
> /// 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.
> - SavePoint enterLocalValueArea();
> + MachineBasicBlock::iterator enterLocalValueArea();
>
> /// leaveLocalValueArea - Reset InsertPt to the given old insert position.
> - void leaveLocalValueArea(SavePoint Old);
> + void leaveLocalValueArea(MachineBasicBlock::iterator Old);
>
> virtual ~FastISel();
>
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=165049&r1=165048&r2=165049&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Tue Oct 2 16:16:50 2012
> @@ -149,13 +149,13 @@
> !FuncInfo.StaticAllocaMap.count(cast<AllocaInst>(V))))
> return FuncInfo.InitializeRegForValue(V);
>
> - SavePoint SaveInsertPt = enterLocalValueArea();
> + MachineBasicBlock::iterator SaveIter = enterLocalValueArea();
>
> // Materialize the value in a register. Emit any instructions in the
> // local value area.
> Reg = materializeRegForValue(V, VT);
>
> - leaveLocalValueArea(SaveInsertPt);
> + leaveLocalValueArea(SaveIter);
>
> return Reg;
> }
> @@ -238,7 +238,16 @@
> DenseMap<const Value *, unsigned>::iterator I = FuncInfo.ValueMap.find(V);
> if (I != FuncInfo.ValueMap.end())
> return I->second;
> - return LocalValueMap[V];
> + 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;
> }
>
> /// UpdateValueMap - Update the value map to include the new mapping for this
> @@ -316,22 +325,18 @@
> recomputeInsertPt();
> }
>
> -FastISel::SavePoint FastISel::enterLocalValueArea() {
> +MachineBasicBlock::iterator FastISel::enterLocalValueArea() {
> MachineBasicBlock::iterator OldInsertPt = FuncInfo.InsertPt;
> - DebugLoc OldDL = DL;
> recomputeInsertPt();
> - DL = DebugLoc();
> - SavePoint SP = { OldInsertPt, OldDL };
> - return SP;
> + return OldInsertPt;
> }
>
> -void FastISel::leaveLocalValueArea(SavePoint OldInsertPt) {
> +void FastISel::leaveLocalValueArea(MachineBasicBlock::iterator I) {
> if (FuncInfo.InsertPt != FuncInfo.MBB->begin())
> LastLocalValue = llvm::prior(FuncInfo.InsertPt);
>
> // Restore the previous insert position.
> - FuncInfo.InsertPt = OldInsertPt.InsertPt;
> - DL = OldInsertPt.DL;
> + FuncInfo.InsertPt = I;
> }
>
> /// SelectBinaryOp - Select and emit code for a binary operator instruction,
>
> Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=165049&r1=165048&r2=165049&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Tue Oct 2 16:16:50 2012
> @@ -545,7 +545,7 @@
> StubAM.GVOpFlags = GVFlags;
>
> // Prepare for inserting code in the local-value area.
> - SavePoint SaveInsertPt = enterLocalValueArea();
> + MachineBasicBlock::iterator SaveIter = enterLocalValueArea();
>
> if (TLI.getPointerTy() == MVT::i64) {
> Opc = X86::MOV64rm;
> @@ -564,7 +564,7 @@
> addFullAddress(LoadMI, StubAM);
>
> // Ok, back to normal mode.
> - leaveLocalValueArea(SaveInsertPt);
> + leaveLocalValueArea(SaveIter);
>
> // Prevent loading GV stub multiple times in same MBB.
> LocalValueMap[V] = LoadReg;
>
> Added: llvm/trunk/test/DebugInfo/X86/constant-mat.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/constant-mat.ll?rev=165049&view=auto
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/X86/constant-mat.ll (added)
> +++ llvm/trunk/test/DebugInfo/X86/constant-mat.ll Tue Oct 2 16:16:50 2012
> @@ -0,0 +1,65 @@
> +; 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}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-David
More information about the llvm-commits
mailing list