[all-commits] [llvm/llvm-project] 6012fe: AMDGPU: Fix sqrt fast math flags spreading to fdiv...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Wed Aug 30 08:53:21 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6012fed6f5971b71aa56667010fd62c0590c28a1
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2023-08-30 (Wed, 30 Aug 2023)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
    M llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-fdiv.ll

  Log Message:
  AMDGPU: Fix sqrt fast math flags spreading to fdiv fast math flags

This was working around the lack of operator| on FastMathFlags. We
have that now which revealed the bug.

  Commit: ddb3f12c428bc4bd5a98913d74dfd7f2402bdfd8
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2023-08-30 (Wed, 30 Aug 2023)

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

  Log Message:
  InstSimplify: Start cleaning up simplifyFCmpInst

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.


Compare: https://github.com/llvm/llvm-project/compare/2263dfe368ce...ddb3f12c428b

More information about the All-commits mailing list