[llvm] r271003 - Disable lifetime-start-on-first-use analysis.
Than McIntosh via llvm-commits
llvm-commits at lists.llvm.org
Fri May 27 08:27:57 PDT 2016
Author: thanm
Date: Fri May 27 10:27:51 2016
New Revision: 271003
URL: http://llvm.org/viewvc/llvm-project?rev=271003&view=rev
Log:
Disable lifetime-start-on-first-use analysis.
Summary:
Turn off lifetime-start-on-first-use enhancement for the moment
pending a fix for bug 27903.
Bug: 27903
Reviewers: tejohnson, wmi, qcolombet, gbiv
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D20731
Modified:
llvm/trunk/lib/CodeGen/StackColoring.cpp
llvm/trunk/test/CodeGen/X86/StackColoring.ll
Modified: llvm/trunk/lib/CodeGen/StackColoring.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackColoring.cpp?rev=271003&r1=271002&r2=271003&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/StackColoring.cpp (original)
+++ llvm/trunk/lib/CodeGen/StackColoring.cpp Fri May 27 10:27:51 2016
@@ -75,10 +75,10 @@ ProtectFromEscapedAllocas("protect-from-
/// Enable enhanced dataflow scheme for lifetime analysis (treat first
/// use of stack slot as start of slot lifetime, as opposed to looking
/// for LIFETIME_START marker). See "Implementation notes" below for
-/// more info.
+/// more info. FIXME: set to false for the moment due to PR27903.
static cl::opt<bool>
LifetimeStartOnFirstUse("stackcoloring-lifetime-start-on-first-use",
- cl::init(true), cl::Hidden,
+ cl::init(false), cl::Hidden,
cl::desc("Treat stack lifetimes as starting on first use, not on START marker."));
Modified: llvm/trunk/test/CodeGen/X86/StackColoring.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/StackColoring.ll?rev=271003&r1=271002&r2=271003&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/StackColoring.ll (original)
+++ llvm/trunk/test/CodeGen/X86/StackColoring.ll Fri May 27 10:27:51 2016
@@ -1,3 +1,4 @@
+; RUN: llc -mcpu=corei7 -no-stack-coloring=false -stackcoloring-lifetime-start-on-first-use=true < %s | FileCheck %s --check-prefix=FIRSTUSE --check-prefix=CHECK
; RUN: llc -mcpu=corei7 -no-stack-coloring=false < %s | FileCheck %s --check-prefix=YESCOLOR --check-prefix=CHECK
; RUN: llc -mcpu=corei7 -no-stack-coloring=true < %s | FileCheck %s --check-prefix=NOCOLOR --check-prefix=CHECK
@@ -87,7 +88,8 @@ bb3:
}
;CHECK-LABEL: myCall_w4:
-;YESCOLOR: subq $120, %rsp
+;FIRSTUSE: subq $120, %rsp
+;YESCOLOR: subq $200, %rsp
;NOCOLOR: subq $408, %rsp
define i32 @myCall_w4(i32 %in) {
@@ -431,7 +433,8 @@ define i32 @shady_range(i32 %argc, i8**
; start. See llvm bug 25776.
;CHECK-LABEL: ifthen_twoslots:
-;YESCOLOR: subq $536, %rsp
+;FIRSTUSE: subq $536, %rsp
+;YESCOLOR: subq $1048, %rsp
;NOCOLOR: subq $1048, %rsp
define i32 @ifthen_twoslots(i32 %x) #0 {
@@ -486,7 +489,8 @@ cleanup:
; markers only.
;CHECK-LABEL: while_loop:
-;YESCOLOR: subq $1032, %rsp
+;FIRSTUSE: subq $1032, %rsp
+;YESCOLOR: subq $1544, %rsp
;NOCOLOR: subq $1544, %rsp
define i32 @while_loop(i32 %x) #0 {
@@ -537,6 +541,52 @@ if.end:
ret i32 0
}
+; Test case motivated by PR27903. Same routine inlined multiple times
+; into a caller results in a multi-segment lifetime, but the second
+; lifetime has no explicit references to the stack slot.
+;
+; FIXME: the "FIRSTUSE" stack size (56) below represents buggy/incorrect
+; behavior not currently exposed on trunk, due to the fact that
+; the "stackcoloring-lifetime-start-on-first-use" now defaults to
+; false. When a better fix for PR27903 is checked in, this result
+; will change to 96.
+
+;CHECK-LABEL: twobod_b27903:
+;FIRSTUSE: subq $56, %rsp
+;YESCOLOR: subq $96, %rsp
+;NOCOLOR: subq $96, %rsp
+
+define i32 @twobod_b27903(i32 %y, i32 %x) {
+entry:
+ %buffer.i = alloca [12 x i32], align 16
+ %abc = alloca [12 x i32], align 16
+ %tmp = bitcast [12 x i32]* %buffer.i to i8*
+ call void @llvm.lifetime.start(i64 48, i8* %tmp)
+ %idxprom.i = sext i32 %y to i64
+ %arrayidx.i = getelementptr inbounds [12 x i32], [12 x i32]* %buffer.i, i64 0, i64 %idxprom.i
+ call void @inita(i32* %arrayidx.i)
+ %add.i = add nsw i32 %x, %y
+ call void @llvm.lifetime.end(i64 48, i8* %tmp)
+ %tobool = icmp eq i32 %y, 0
+ br i1 %tobool, label %if.end, label %if.then
+
+if.then: ; preds = %entry
+ %tmp1 = bitcast [12 x i32]* %abc to i8*
+ call void @llvm.lifetime.start(i64 48, i8* %tmp1)
+ %arrayidx = getelementptr inbounds [12 x i32], [12 x i32]* %abc, i64 0, i64 %idxprom.i
+ call void @inita(i32* %arrayidx)
+ call void @llvm.lifetime.start(i64 48, i8* %tmp)
+ call void @inita(i32* %arrayidx.i)
+ %add.i9 = add nsw i32 %add.i, %y
+ call void @llvm.lifetime.end(i64 48, i8* %tmp)
+ call void @llvm.lifetime.end(i64 48, i8* %tmp1)
+ br label %if.end
+
+if.end: ; preds = %if.then, %entry
+ %x.addr.0 = phi i32 [ %add.i9, %if.then ], [ %add.i, %entry ]
+ ret i32 %x.addr.0
+}
+
declare void @inita(i32*) #2
declare void @bar([100 x i32]* , [100 x i32]*) nounwind
More information about the llvm-commits
mailing list