[llvm] r271068 - Update the stack coloring pass to remove lifetime intrinsics in the optnone/opt-bisect skip case.

Andrew Kaylor via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 15:56:50 PDT 2016


Author: akaylor
Date: Fri May 27 17:56:49 2016
New Revision: 271068

URL: http://llvm.org/viewvc/llvm-project?rev=271068&view=rev
Log:
Update the stack coloring pass to remove lifetime intrinsics in the optnone/opt-bisect skip case.

Differential Revision: http://reviews.llvm.org/D20453


Modified:
    llvm/trunk/lib/CodeGen/StackColoring.cpp
    llvm/trunk/test/Feature/optnone-llc.ll
    llvm/trunk/test/Other/opt-bisect-legacy-pass-manager.ll

Modified: llvm/trunk/lib/CodeGen/StackColoring.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackColoring.cpp?rev=271068&r1=271067&r2=271068&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/StackColoring.cpp (original)
+++ llvm/trunk/lib/CodeGen/StackColoring.cpp Fri May 27 17:56:49 2016
@@ -963,9 +963,6 @@ void StackColoring::expungeSlotMap(Dense
 }
 
 bool StackColoring::runOnMachineFunction(MachineFunction &Func) {
-  if (skipFunction(*Func.getFunction()))
-    return false;
-
   DEBUG(dbgs() << "********** Stack Coloring **********\n"
                << "********** Function: "
                << ((const Value*)Func.getFunction())->getName() << '\n');
@@ -1005,7 +1002,8 @@ bool StackColoring::runOnMachineFunction
 
   // Don't continue because there are not enough lifetime markers, or the
   // stack is too small, or we are told not to optimize the slots.
-  if (NumMarkers < 2 || TotalSize < 16 || DisableColoring) {
+  if (NumMarkers < 2 || TotalSize < 16 || DisableColoring ||
+      skipFunction(*Func.getFunction())) {
     DEBUG(dbgs()<<"Will not try to merge slots.\n");
     return removeAllMarkers();
   }

Modified: llvm/trunk/test/Feature/optnone-llc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/optnone-llc.ll?rev=271068&r1=271067&r2=271068&view=diff
==============================================================================
--- llvm/trunk/test/Feature/optnone-llc.ll (original)
+++ llvm/trunk/test/Feature/optnone-llc.ll Fri May 27 17:56:49 2016
@@ -46,7 +46,6 @@ attributes #0 = { optnone noinline }
 ; LLC-Ox-DAG: Skipping pass 'Machine Copy Propagation Pass'
 ; LLC-Ox-DAG: Skipping pass 'Machine Instruction Scheduler'
 ; LLC-Ox-DAG: Skipping pass 'Machine Loop Invariant Code Motion'
-; LLC-Ox-DAG: Skipping pass 'Merge disjoint stack slots'
 ; LLC-Ox-DAG: Skipping pass 'Optimize machine instruction PHIs'
 ; LLC-Ox-DAG: Skipping pass 'Peephole Optimizations'
 ; LLC-Ox-DAG: Skipping pass 'Post{{.*}}RA{{.*}}{{[Ss]}}cheduler'

Modified: llvm/trunk/test/Other/opt-bisect-legacy-pass-manager.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/opt-bisect-legacy-pass-manager.ll?rev=271068&r1=271067&r2=271068&view=diff
==============================================================================
--- llvm/trunk/test/Other/opt-bisect-legacy-pass-manager.ll (original)
+++ llvm/trunk/test/Other/opt-bisect-legacy-pass-manager.ll Fri May 27 17:56:49 2016
@@ -154,3 +154,25 @@ bb.true:
 bb.false:
   ret i32 0
 }
+
+; This function is here to verify that opt-bisect can skip all passes for
+; functions that contain lifetime intrinsics.
+define void @f4() {
+entry:
+  %i = alloca i32, align 4
+  %tmp = bitcast i32* %i to i8*
+  call void @llvm.lifetime.start(i64 4, i8* %tmp)
+  br label %for.cond
+
+for.cond:
+  br i1 undef, label %for.body, label %for.end
+
+for.body:
+  br label %for.cond
+
+for.end:
+  ret void
+}
+
+declare void @llvm.lifetime.start(i64, i8* nocapture)
+




More information about the llvm-commits mailing list