diff options
author | Vedant Kumar <vsk@apple.com> | 2019-01-17 22:35:47 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2019-01-17 22:35:47 +0000 |
commit | b70e20db626f8b33d8a671149e0981afcdb10b0e (patch) | |
tree | c87fae260d311bc9f4e466f3b6950e1449449cc5 | |
parent | 03e26de4d26a94f8e7e2bf0d7371712faf299a05 (diff) | |
download | bcm5719-llvm-b70e20db626f8b33d8a671149e0981afcdb10b0e.tar.gz bcm5719-llvm-b70e20db626f8b33d8a671149e0981afcdb10b0e.zip |
[HotColdSplit] Consider resume instructions to be cold
Resuming exception unwinding is roughly as unlikely as throwing an
exception.
Tested on LNT+externals (in particular, the C++ EH regression tests
provide end-to-end test coverage), as well as with a full build of iOS.
llvm-svn: 351491
-rw-r--r-- | llvm/lib/Transforms/IPO/HotColdSplitting.cpp | 2 | ||||
-rw-r--r-- | llvm/test/Transforms/HotColdSplit/resume.ll | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp index 2cf8af35401..577f270863c 100644 --- a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp +++ b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp @@ -101,7 +101,7 @@ bool blockEndsInUnreachable(const BasicBlock &BB) { bool unlikelyExecuted(BasicBlock &BB) { // Exception handling blocks are unlikely executed. - if (BB.isEHPad()) + if (BB.isEHPad() || isa<ResumeInst>(BB.getTerminator())) return true; // The block is cold if it calls/invokes a cold function. diff --git a/llvm/test/Transforms/HotColdSplit/resume.ll b/llvm/test/Transforms/HotColdSplit/resume.ll new file mode 100644 index 00000000000..cbda078da90 --- /dev/null +++ b/llvm/test/Transforms/HotColdSplit/resume.ll @@ -0,0 +1,20 @@ +; RUN: opt -hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s + +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx10.14.0" + +; Consider `resume` to be cold. + +; CHECK-LABEL: define {{.*}}@foo.cold.1( +; CHECK: resume i32 undef + +define i32 @foo(i32 %cond) personality i8 0 { +entry: + br i1 undef, label %resume-eh, label %normal + +resume-eh: + resume i32 undef + +normal: + ret i32 0 +} |