[PATCH] D24414: Conditionally eliminate library calls where the result value is not used
Rong Xu via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 9 11:37:38 PDT 2016
xur created this revision.
xur added reviewers: davidxl, hfinkel, mehdi_amini.
xur added subscribers: llvm-commits, xur.
Herald added subscribers: beanz, mehdi_amini.
This pass shrink-wraps a condition to some library calls where the call
result is not used. For example:
sqrt(val);
is transformed to
if (val < 0)
sqrt(val);
Even if the result of library call is not being used, the compiler cannot
safely delete the call because the function can set errno on error
conditions.
Note in many functions, the error condition solely depends on the incoming
parameter. In this optimization, we can generate the condition can lead to
the errno to shrink-wrap the call. Since the chances of hitting the error
condition is low, the runtime call is effectively eliminated.
These partially dead calls are usually results of C++ abstraction penalty
exposed by inlining. This optimization hits 108 times in 19 C/C++ programs
in SPEC2006.
https://reviews.llvm.org/D24414
Files:
include/llvm/InitializePasses.h
include/llvm/LinkAllPasses.h
include/llvm/Transforms/Scalar.h
include/llvm/Transforms/Utils/CondDeadCallElimination.h
lib/Passes/PassBuilder.cpp
lib/Passes/PassRegistry.def
lib/Transforms/IPO/PassManagerBuilder.cpp
lib/Transforms/Utils/CMakeLists.txt
lib/Transforms/Utils/CondDeadCallElimination.cpp
lib/Transforms/Utils/Utils.cpp
test/Transforms/Util/cond-call-dce-double.ll
test/Transforms/Util/cond-call-dce-float.ll
test/Transforms/Util/cond-call-dce-long-double.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24414.70874.patch
Type: text/x-patch
Size: 59153 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160909/5ba8cd13/attachment-0001.bin>
More information about the llvm-commits
mailing list