diff options
author | Eli Friedman <efriedma@codeaurora.org> | 2016-11-02 20:48:11 +0000 |
---|---|---|
committer | Eli Friedman <efriedma@codeaurora.org> | 2016-11-02 20:48:11 +0000 |
commit | b6befc3bc4d7b7677e71be471d3a6ed1c2ac4199 (patch) | |
tree | d235e6032ca8b43546739d2ff5d66a78dd17c5b5 /llvm/lib/Transforms/Utils/Local.cpp | |
parent | ce65364afc657318d937ace660afff305817935d (diff) | |
download | bcm5719-llvm-b6befc3bc4d7b7677e71be471d3a6ed1c2ac4199.tar.gz bcm5719-llvm-b6befc3bc4d7b7677e71be471d3a6ed1c2ac4199.zip |
DCE math library calls with a constant operand.
On platforms which use -fmath-errno, math libcalls without any uses
require some extra checks to figure out if they are actually dead.
Fixes https://llvm.org/bugs/show_bug.cgi?id=30464 .
Differential Revision: https://reviews.llvm.org/D25970
llvm-svn: 285857
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 5c46111822b..e52d87a7a51 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -340,6 +340,10 @@ bool llvm::isInstructionTriviallyDead(Instruction *I, if (Constant *C = dyn_cast<Constant>(CI->getArgOperand(0))) return C->isNullValue() || isa<UndefValue>(C); + if (CallSite CS = CallSite(I)) + if (isMathLibCallNoop(CS, TLI)) + return true; + return false; } |