[PATCH] D118426: [InstCombine] Remove side effect of replaced constrained intrinsics
Serge Pavlov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 4 02:15:51 PDT 2022
sepavloff marked an inline comment as done.
sepavloff added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1057
+ if (CI.use_empty() && isa<ConstrainedFPIntrinsic>(CI))
+ if (SimplifyCall(&CI, SQ.getWithInstruction(&CI)))
+ return &CI;
----------------
andrew.w.kaylor wrote:
> Relying on SimplifyCall() here to determine whether the call has side effects is still more restrictive than necessary. For example, if the exception behavior argument is not fp::ExceptionBehavior::ebStrict and the call has no users, it can be removed even if the arguments are non-constant or the operation would raise an exception.
Actually there is no additional restrictions. `wouldInstructionBeTriviallyDead` already recognizes that a constrained intrinsic calls with the exception behavior argument other than `ebStrict` may be removed. So if such call result is not used, it is removed in `prepareICWorklistFromFunction` and does not participate in instruction combining. If such call is replaced by `SimplifyCall`, it is removed due to the same reason. The test `f_eval_maytrap` demonstrates this case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118426/new/
https://reviews.llvm.org/D118426
More information about the llvm-commits
mailing list