commit | b6befc3bc4d7b7677e71be471d3a6ed1c2ac4199 | [log] [tgz] |
---|---|---|
author | Eli Friedman <efriedma@codeaurora.org> | Wed Nov 02 20:48:11 2016 +0000 |
committer | Eli Friedman <efriedma@codeaurora.org> | Wed Nov 02 20:48:11 2016 +0000 |
tree | d235e6032ca8b43546739d2ff5d66a78dd17c5b5 | |
parent | ce65364afc657318d937ace660afff305817935d [diff] [blame] |
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
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 5c46111..e52d87a 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -340,6 +340,10 @@ 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; }