[PATCH] D131838: [ValueTracking] computeKnownBits - attempt to use a branch condition feeding a phi to improve known bits range (PR38280)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 16 08:14:38 PDT 2022


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

LGTM - see inline comment to restore one test bit for 'ne'. 
The 'ule' case looks fine via inspection, so I'm not concerned if we don't have a direct test for it here.
The new test changes to the loop latch code are potential trouble if it harms indvars or LSR, so you might want to pipe that through to codegen to see if there's any obvious regression before pushing.



================
Comment at: llvm/test/Transforms/InstCombine/known-phi-br.ll:32
-; TODO: %x either eq 255 or is set to 255
+; %x either eq 255 or is set to 255
 define i64 @limit_i64_ne_255(i64 %x) {
 ; CHECK-LABEL: @limit_i64_ne_255(
----------------
The extra use on just this one test actually did accomplish the goal - it kept the predicate as 'ne' because the invert of the branch is predicated on one-use.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131838



More information about the llvm-commits mailing list