Currently there are optimizations for the fsub instruction that do not fire for a constrained fsub. Add some of these optimizations.
Optimizations that require teaching the IR matchers about the constrained intrinsics are for a future patch.
Paths
| Differential D107285
[FPEnv][InstSimplify] Enable more folds for constrained fsub Needs ReviewPublic Authored by kpn on Aug 2 2021, 9:19 AM.
Details
Summary Currently there are optimizations for the fsub instruction that do not fire for a constrained fsub. Add some of these optimizations. Optimizations that require teaching the IR matchers about the constrained intrinsics are for a future patch.
Diff Detail
Event Timeline
Comment Actions Update for review comments. Instructions that are "maytrap" where a SNaN may be seen must not be eliminated. I've also added tests for transforms that won't fire due to a lack of IR matcher support. We're going through codepaths we weren't before so we're testing what we weren't before. Comment Actions Please add the test file as a preliminary commit. Then update here to show the code diffs. Also as part of this patch, apply comments on the tests that are intentionally not changing and/or are expected to change later (TODO).
Comment Actions This review may be stuck/dead, consider abandoning if no longer relevant.
Revision Contents
Diff 363491 llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstSimplify/strictfp-fsub.ll
|
This transformation is valid only if FMF.noNaNs() is set, because it is incorrect if X==SNaN. Similar for other cases below.