[PATCH] D154496: InstCombine: Fold ldexp(ldexp(x, a), b) -> ldexp(x, a + b)

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 5 08:29:11 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:2381-2383
+    // It's also safe to fold if we know both exponents have the same sign since
+    // it would just double down on the overflow/underflow which would occur
+    // anyway.
----------------
foad wrote:
> arsenm wrote:
> > foad wrote:
> > > Additionally it would be safe if both exponents are known to be <= 0, but I guess we don't have a helper function for that.
> > Right we totally lack FP range tracking
> I just mean for the integer exponents, you're checking if they're both < 0, but that could be relaxed to both <= 0.
This checks that they are both positive or both negative so I’m not sure what you mean 


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

https://reviews.llvm.org/D154496



More information about the llvm-commits mailing list