[PATCH] D52367: Remove address taken, add optnone

Aditya Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 21 12:48:14 PDT 2018


hiraditya updated this revision to Diff 170349.
hiraditya added a comment.

Adding test


Repository:
  rL LLVM

https://reviews.llvm.org/D52367

Files:
  lib/Transforms/IPO/HotColdSplitting.cpp
  test/Transforms/HotColdSplit/split-cold-1.ll


Index: test/Transforms/HotColdSplit/split-cold-1.ll
===================================================================
--- test/Transforms/HotColdSplit/split-cold-1.ll
+++ test/Transforms/HotColdSplit/split-cold-1.ll
@@ -1,6 +1,7 @@
 ; RUN: opt -hotcoldsplit -S < %s | FileCheck %s
 
 ; Outlined function is called from a basic block named codeRepl
+; CHECK-LABEL: @foo
 ; CHECK: codeRepl:
 ; CHECK-NEXT: call void @foo
 define void @foo() {
@@ -22,3 +23,25 @@
 return:                                           ; preds = %cleanup40
   ret void
 }
+
+; CHECK-LABEL: @bar
+; CHECK-NOT: codeRepl:
+define void @bar() noinline optnone {
+entry:
+  br i1 undef, label %if.then, label %if.end
+
+if.then:                                          ; preds = %entry
+  unreachable
+
+if.end:                                           ; preds = %entry
+  br label %if.then12
+
+if.then12:                                        ; preds = %if.end
+  br label %cleanup40
+
+cleanup40:                                        ; preds = %if.then12
+  br label %return
+
+return:                                           ; preds = %cleanup40
+  ret void
+}
Index: lib/Transforms/IPO/HotColdSplitting.cpp
===================================================================
--- lib/Transforms/IPO/HotColdSplitting.cpp
+++ lib/Transforms/IPO/HotColdSplitting.cpp
@@ -272,7 +272,7 @@
   if (F.size() <= 2)
     return false;
 
-  if (F.hasAddressTaken())
+  if (F.hasFnAttribute(Attribute::OptimizeNone))
     return false;
 
   if (F.hasFnAttribute(Attribute::AlwaysInline))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52367.170349.patch
Type: text/x-patch
Size: 1559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181021/744ff60e/attachment.bin>


More information about the llvm-commits mailing list