[PATCH] D151887: InstSimplify: Start cleaning up simplifyFCmpInst

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 06:49:09 PDT 2023


arsenm created this revision.
arsenm added reviewers: foad, jcranmer-intel, sepavloff, andrew.w.kaylor.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

Also picks up a few improvements (Some of the fcmp.ll
test names imply they aren't quite testing what was intended.
Checking the sign bit can't be performed with a compare to a 0).

      

Much of the logic in here is the same as the class detection
logic of fcmpToClassTest. We could unify more with a weaker
version of fcmpToClassTest which returns implied classes rather
than exact class-like compares. Also could unify more with detection
of possible classes in non-splat vectors.

      

One problem here is we now only perform folds that used
to always work now require a context instruction. This is
 because fcmpToClassTest requires the parent function.
Either fcmpToClassTest could tolerate a missing context
function, or we could require passing in one to simplifyFCmpInst.
Without this it's possible to hit the !isNan assert (which feels like
an unnecessary assert). In any case, these cases don't appear in
any tests.


https://reviews.llvm.org/D151887

Files:
  llvm/include/llvm/Analysis/ValueTracking.h
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/test/Transforms/InstCombine/fcmp.ll
  llvm/test/Transforms/InstCombine/is_fpclass.ll
  llvm/test/Transforms/InstSimplify/floating-point-compare.ll
  llvm/test/Transforms/InstSimplify/known-never-infinity.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151887.527403.patch
Type: text/x-patch
Size: 21065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230601/fa2be38f/attachment.bin>


More information about the llvm-commits mailing list