[PATCH] D125774: [InstCombine] fold float trunc into exact itofp for small constants

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 02:29:20 PDT 2022


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:1536
+                BO->hasNoSignedWrap() && Known2.isNonNegative() &&
+                dyn_cast<ConstantInt>(L) && CmpInst->hasOneUse()) {
+              BranchInst *BI =
----------------
This doesn't seem to be taking the predicate of the icmp into account?


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:1757-1758
 
+  // If all the value is within the value range of 2^DestNumSigBits, then the
+  // value can be accurately represented.
+  KnownBits SrcKnown = llvm::computeKnownBits(Src, IC.getDataLayout());
----------------
Allen wrote:
> spatel wrote:
> > This part is mentioned in the TODO right under here (update that...) and independent of any control-flow changes, so you could remove the changes to ValueTracking and just focus on this part.
> Apply your comment, thanks @spatel 
It doesn't look like this comment was applied: You need to create a separate patch that includes only this change, without any changes to ValueTracking.


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

https://reviews.llvm.org/D125774



More information about the llvm-commits mailing list