[PATCH] D99687: [SCEV] Compute ranges for ashr/lshr recurrences

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 6 19:33:16 PDT 2021


reames planned changes to this revision.
reames added a comment.

Need to add additional tests (or pointers to them), but also intentionally stalling this until issues with handling of unreachable code in the underlying infrastructure are resolved and nothing new pops up for a few days.



================
Comment at: llvm/test/Analysis/ScalarEvolution/shift-recurrences.ll:580
 ; CHECK-NEXT:    %iv.lshr = phi i8 [ -1, %entry ], [ %iv.lshr.next, %loop ]
-; CHECK-NEXT:    --> %iv.lshr U: [-1,-128) S: [-1,-128) Exits: 15 LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:    --> %iv.lshr U: [15,0) S: [-1,-128) Exits: 15 LoopDispositions: { %loop: Variant }
 ; CHECK-NEXT:    %iv.next = add i64 %iv, 1
----------------
reames wrote:
> The choice of the inverted range here looks odd.  I dug into this a bit, and am suspecting a generic bug in the preferred range mechanism in ConstantRange.  The key point is that we're making a heuristic driven chosen between two possible ranges, and we simply happen to pick the other one after this patch.
Dug into this further, and it's not a bug in the code, it was a bug in my understanding.  The broad point about it being a legal choice for the answer still holds though.  


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

https://reviews.llvm.org/D99687



More information about the llvm-commits mailing list