[PATCH] D99912: Look through invertible recurrences in isKnownNonEqual
    Nikita Popov via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Apr 14 13:44:20 PDT 2021
    
    
  
nikic added a comment.
I think you're missing an important precondition here: You need that `Step1 == Step2`. Otherwise you could have `<0,+,2>` and `<1,+,1>`, which have non-equal start values, but are still equal on the second iteration.
Something the implementation does account for, but doesn't appear to be tested, is if the second operand is invertible rather than the first.
================
Comment at: llvm/test/Analysis/ValueTracking/known-non-equal.ll:890
 
 define i1 @recurrence_mul_noflags(i8 %A, i8 %B) {
 ; CHECK-LABEL: @recurrence_mul_noflags(
----------------
This doesn't test what you want it to because %A/%B are unknown. You need to make them non-equal so that the nowrap flags are the *only* thing that prevents the fold.
================
Comment at: llvm/test/Analysis/ValueTracking/known-non-equal.ll:1024
 
 define i1 @recurrence_shl_noflags(i8 %A, i8 %B) {
 ; CHECK-LABEL: @recurrence_shl_noflags(
----------------
Same here.
================
Comment at: llvm/test/Analysis/ValueTracking/known-non-equal.ll:1158
 
 define i1 @recurrence_lshr_noflags(i8 %A, i8 %B) {
 ; CHECK-LABEL: @recurrence_lshr_noflags(
----------------
Same here.
================
Comment at: llvm/test/Analysis/ValueTracking/known-non-equal.ll:1292
 
 define i1 @recurrence_ashr_noflags(i8 %A, i8 %B) {
 ; CHECK-LABEL: @recurrence_ashr_noflags(
----------------
Same here.
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99912/new/
https://reviews.llvm.org/D99912
    
    
More information about the llvm-commits
mailing list