[PATCH] D20453: Remove optnone/opt-bisect check from StackColoring

Andy Kaylor via llvm-commits llvm-commits at lists.llvm.org
Thu May 19 15:55:32 PDT 2016


andrew.w.kaylor created this revision.
andrew.w.kaylor added a reviewer: probinson.
andrew.w.kaylor added a subscriber: llvm-commits.
andrew.w.kaylor set the repository for this revision to rL LLVM.

This removes the skipFunction() call in the StackColoring pass that allows the pass to be skipped for opt-bisect and "optnone" function attribute handling.

This pass was calling skipOptnoneFunction() before I made the opt-bisect changes, but if a function reaches this pass with lifetime.start/lifetime.end intrinsics in place and the pass is skipped code generation will fail.  This pass is not called at opt-level zero, but the lifetime intrinsics are never translated to machine instructions at opt-level zero.

It would be possible to have the pass simply remove the intrinsics and do nothing else if the skipFunction() call returns 'true' but I don't like the idea of having a pass that changes the IR in a different way when it is told not to change the IR.  We could always re-visit that later if the need arises.

Repository:
  rL LLVM

http://reviews.llvm.org/D20453

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

Index: lib/CodeGen/StackColoring.cpp
===================================================================
--- lib/CodeGen/StackColoring.cpp
+++ lib/CodeGen/StackColoring.cpp
@@ -660,9 +660,6 @@
 }
 
 bool StackColoring::runOnMachineFunction(MachineFunction &Func) {
-  if (skipFunction(*Func.getFunction()))
-    return false;
-
   DEBUG(dbgs() << "********** Stack Coloring **********\n"
                << "********** Function: "
                << ((const Value*)Func.getFunction())->getName() << '\n');
Index: test/Feature/optnone-llc.ll
===================================================================
--- test/Feature/optnone-llc.ll
+++ test/Feature/optnone-llc.ll
@@ -46,7 +46,6 @@
 ; 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'
Index: test/Other/opt-bisect-legacy-pass-manager.ll
===================================================================
--- test/Other/opt-bisect-legacy-pass-manager.ll
+++ test/Other/opt-bisect-legacy-pass-manager.ll
@@ -154,3 +154,23 @@
 bb.false:
   ret i32 0
 }
+
+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)
+


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20453.57871.patch
Type: text/x-patch
Size: 1735 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160519/70a8f54d/attachment.bin>


More information about the llvm-commits mailing list