[PATCH] D158648: InstCombine: Introduce SimplifyDemandedUseFPClass

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 4 10:20:02 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:1825
+    Known = computeKnownFPClass(V, DL, fcAllFlags, Depth, &TLI, &AC, CxtI, &DT);
+    if ((DemandedMask & Known.KnownFPClasses) == fcNone)
+      return PoisonValue::get(VTy);
----------------
nikic wrote:
> arsenm wrote:
> > nikic wrote:
> > > Should this be using getFPClassConstant() instead, just like the main code path?
> > No, otherwise it will infinite loop since constants will always yield the same result after simplification. The isa<UndefValue> check above is the special case that works for poison
> Check that getFPClassConstant() != V?
> No, otherwise it will infinite loop since constants will always yield the same result after simplification. The isa<UndefValue> check above is the special case that works for poison




================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:1825
+    Known = computeKnownFPClass(V, DL, fcAllFlags, Depth, &TLI, &AC, CxtI, &DT);
+    if ((DemandedMask & Known.KnownFPClasses) == fcNone)
+      return PoisonValue::get(VTy);
----------------
goldstein.w.n wrote:
> nikic wrote:
> > arsenm wrote:
> > > nikic wrote:
> > > > Should this be using getFPClassConstant() instead, just like the main code path?
> > > No, otherwise it will infinite loop since constants will always yield the same result after simplification. The isa<UndefValue> check above is the special case that works for poison
> > Check that getFPClassConstant() != V?
> > No, otherwise it will infinite loop since constants will always yield the same result after simplification. The isa<UndefValue> check above is the special case that works for poison
> 
> 
> No, otherwise it will infinite loop since constants will always yield the same result after simplification. The isa<UndefValue> check above is the special case that works for poison

Isn't the same true in the many places you return `I`?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158648/new/

https://reviews.llvm.org/D158648



More information about the llvm-commits mailing list