[PATCH] D118319: Pass for fixing dependencies of constrained intrinsics
Serge Pavlov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 27 19:58:54 PST 2022
sepavloff abandoned this revision.
sepavloff added a comment.
In D118319#3275319 <https://reviews.llvm.org/D118319#3275319>, @nikic wrote:
> I think it would be better to do this as part of InstCombine. I don't think having a single pass at the end of the pipeline would be a good solution to this, as it means that these dead calls will survive through most of the optimization pipeline, blocking cost models and other optimizations. This doesn't look expensive enough that including it in InstCombine would be a problem.
Indeed, this particular task can be solved in InstCombiner. It wouldn't allow to remove side effect in more complex cases, but this patch does not provide a solution for such. The fix in InstCombiner is implemented in D118426 <https://reviews.llvm.org/D118426>.
In D118319#3276725 <https://reviews.llvm.org/D118319#3276725>, @kpn wrote:
> And if an instruction will _never_ be executed then I don't see the harm in DCE removing it. We wouldn't be removing a potential trap from runtime because the code won't be executed and the DCE pass knows it.
The problem is that the instruction is executed but its result is not used, so it can be safely removed.
================
Comment at: llvm/test/Transforms/FloatDependencyFixup/float-dep-fixup.ll:21
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[RESULT:%.*]] = call float @llvm.experimental.constrained.fdiv.f32(float 1.000000e+00, float 3.000000e+00, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0:[0-9]+]]
+; CHECK-NEXT: ret float 1.000000e+00
----------------
kpn wrote:
> Why is this not getting removed as well?
This function has a side effect: it raises inexact exception. So removing it produces function that is not equivalent to the original.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118319/new/
https://reviews.llvm.org/D118319
More information about the llvm-commits
mailing list