From: Vedant Kumar Date: Thu, 17 Jan 2019 22:35:47 +0000 (+0000) Subject: [HotColdSplit] Consider resume instructions to be cold X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=390962bc3eb14cffd34318727ef82ca874f578a8;p=llvm [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351491 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/IPO/HotColdSplitting.cpp b/lib/Transforms/IPO/HotColdSplitting.cpp index 2cf8af35401..577f270863c 100644 --- a/lib/Transforms/IPO/HotColdSplitting.cpp +++ b/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(BB.getTerminator())) return true; // The block is cold if it calls/invokes a cold function. diff --git a/test/Transforms/HotColdSplit/resume.ll b/test/Transforms/HotColdSplit/resume.ll new file mode 100644 index 00000000000..cbda078da90 --- /dev/null +++ b/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 +}