[PATCH] D118319: Pass for fixing dependencies of constrained intrinsics
Serge Pavlov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 26 23:01:32 PST 2022
sepavloff created this revision.
sepavloff added reviewers: kpn, nikic, spatel, craig.topper, andrew.w.kaylor.
Herald added subscribers: ormris, wenlei, steven_wu, hiraditya, mgorny.
sepavloff requested review of this revision.
Herald added a project: LLVM.
Constrained intrinsics model the interaction with floating point
environment as side effect. It creates problems if some transformation
replaces an intrinsic call and leaves the call dangling. As the call has
side effect, it cannot be removed by DCE. On the other hand, in many
cases the side effect is absent or may be ignored and it is safe to
remove such call.
In particular, such problem exists in constant folding. Intrinsic call
cannot be modified inside constant evaluator so it must be made somewhere
in the transformation pass. There are several passes that could call
constant evaluator, putting cleanup code to each of them does not look
like a flexible solution. Instead, this patch introduces a pass that makes
the cleanup in one place. The pass is executed late in a pipeline, when
all relevant replacements have already done.
Although this change is made for solving constant evaluation problems,
removing floating-point operation side effect is useful in other cases
also. For example, if FP exceptions are ignored but rounding mode is
non-default, side effect may be removed in many cases, it can produce
faster code. The new pass could be used for this task also, but in this
case it must be executed also somewhere earlier in pipeline.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118319
Files:
llvm/include/llvm/Transforms/Scalar/FloatDependencyFixup.h
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Passes/PassBuilderPipelines.cpp
llvm/lib/Passes/PassRegistry.def
llvm/lib/Transforms/Scalar/CMakeLists.txt
llvm/lib/Transforms/Scalar/FloatDependencyFixup.cpp
llvm/test/Other/new-pm-defaults.ll
llvm/test/Other/new-pm-thinlto-defaults.ll
llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
llvm/test/Transforms/FloatDependencyFixup/float-dep-fixup.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118319.403508.patch
Type: text/x-patch
Size: 14750 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220127/d880044e/attachment.bin>
More information about the llvm-commits
mailing list