aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/WinEHPrepare.cpp
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-07-27 23:46:57 +0000
committerJustin Lebar <jlebar@google.com>2016-07-27 23:46:57 +0000
commit45bcdcbefbfda867965fec755391f6ad0925f74a (patch)
tree8037c44903747af63d7a16a777685dd8dafbcd6d /llvm/lib/CodeGen/WinEHPrepare.cpp
parentff5ce639deb23595b4c4c9b995d6d6d47dda64fb (diff)
downloadllvm-45bcdcbefbfda867965fec755391f6ad0925f74a.zip
llvm-45bcdcbefbfda867965fec755391f6ad0925f74a.tar.gz
llvm-45bcdcbefbfda867965fec755391f6ad0925f74a.tar.bz2
Don't invoke getName() from Function::isIntrinsic().
Summary: getName() involves a hashtable lookup, so is expensive given how frequently isIntrinsic() is called. (In particular, many users cast to IntrinsicInstr or one of its subclasses before calling getIntrinsicID().) This has an incidental functional change: Before, isIntrinsic() would return true for any function whose name started with "llvm.", even if it wasn't properly an intrinsic. The new behavior seems more correct to me, because it's strange to say that isIntrinsic() is true, but getIntrinsicId() returns "not an intrinsic". Some callers want the old behavior -- they want to know whether the caller is a recognized intrinsic, or might be one in some other version of LLVM. For them, we added Function::hasLLVMReservedName(), which checks whether the name starts with "llvm.". This change is good for a 1.5% e2e speedup compiling a large Eigen benchmark. Reviewers: bogner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D22065 llvm-svn: 276942
Diffstat (limited to 'llvm/lib/CodeGen/WinEHPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/WinEHPrepare.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp
index 041fb7b..28efee0 100644
--- a/llvm/lib/CodeGen/WinEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WinEHPrepare.cpp
@@ -949,10 +949,14 @@ void WinEHPrepare::removeImplausibleInstructions(Function &F) {
continue;
// Skip call sites which are nounwind intrinsics or inline asm.
+ //
+ // FIXME: Should this check isIntrinsic() instead of
+ // hasLLVMReservedName? The latter is conservative.
auto *CalledFn =
dyn_cast<Function>(CS.getCalledValue()->stripPointerCasts());
- if (CalledFn && ((CalledFn->isIntrinsic() && CS.doesNotThrow()) ||
- CS.isInlineAsm()))
+ if (CalledFn &&
+ ((CalledFn->hasLLVMReservedName() && CS.doesNotThrow()) ||
+ CS.isInlineAsm()))
continue;
// This call site was not part of this funclet, remove it.