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)) 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 +}