summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorEli Friedman <efriedma@codeaurora.org>2016-11-02 20:48:11 +0000
committerEli Friedman <efriedma@codeaurora.org>2016-11-02 20:48:11 +0000
commitb6befc3bc4d7b7677e71be471d3a6ed1c2ac4199 (patch)
treed235e6032ca8b43546739d2ff5d66a78dd17c5b5 /llvm/lib/Transforms/Utils/Local.cpp
parentce65364afc657318d937ace660afff305817935d (diff)
downloadbcm5719-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.cpp4
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;
}
OpenPOWER on IntegriCloud