[llvm] c49e56a - [SCEV] Add coverage for a missing flag inference case

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 18:41:34 PDT 2023


Author: Philip Reames
Date: 2023-03-21T18:41:18-07:00
New Revision: c49e56a2954fe77742487394279bf670213525b5

URL: https://github.com/llvm/llvm-project/commit/c49e56a2954fe77742487394279bf670213525b5
DIFF: https://github.com/llvm/llvm-project/commit/c49e56a2954fe77742487394279bf670213525b5.diff

LOG: [SCEV] Add coverage for a missing flag inference case

Added: 
    

Modified: 
    llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
index 3f900eeecd34a..e1acec162d3c8 100644
--- a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
+++ b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
@@ -1685,3 +1685,39 @@ loop:
 exit:
   ret i32 0
 }
+
+; TODO: The pointer induction variable can be implied No Self Wrap.
+define void @gep_addrec_nw(ptr %a) {
+; CHECK-LABEL: 'gep_addrec_nw'
+; CHECK-NEXT:  Classifying expressions for: @gep_addrec_nw
+; CHECK-NEXT:    %lsr.iv1 = phi ptr [ %uglygep2, %for.body ], [ %a, %entry ]
+; CHECK-NEXT:    --> {%a,+,4}<%for.body> U: full-set S: full-set Exits: (1512 + %a) LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:    %lsr.iv = phi i64 [ %lsr.iv.next, %for.body ], [ 379, %entry ]
+; CHECK-NEXT:    --> {379,+,-1}<nsw><%for.body> U: [1,380) S: [1,380) Exits: 1 LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:    %lsr.iv.next = add nsw i64 %lsr.iv, -1
+; CHECK-NEXT:    --> {378,+,-1}<nsw><%for.body> U: [0,379) S: [0,379) Exits: 0 LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:    %uglygep2 = getelementptr i8, ptr %lsr.iv1, i64 4
+; CHECK-NEXT:    --> {(4 + %a),+,4}<%for.body> U: full-set S: full-set Exits: (1516 + %a) LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @gep_addrec_nw
+; CHECK-NEXT:  Loop %for.body: backedge-taken count is 378
+; CHECK-NEXT:  Loop %for.body: constant max backedge-taken count is 378
+; CHECK-NEXT:  Loop %for.body: symbolic max backedge-taken count is 378
+; CHECK-NEXT:  Loop %for.body: Predicated backedge-taken count is 378
+; CHECK-NEXT:   Predicates:
+; CHECK:       Loop %for.body: Trip multiple is 379
+;
+entry:
+  br label %for.body
+
+for.body:                                         ; preds = %for.body, %entry
+  %lsr.iv1 = phi ptr [ %uglygep2, %for.body ], [ %a, %entry ]
+  %lsr.iv = phi i64 [ %lsr.iv.next, %for.body ], [ 379, %entry ]
+  store i32 1, ptr %lsr.iv1, align 4
+  %lsr.iv.next = add nsw i64 %lsr.iv, -1
+  %uglygep2 = getelementptr i8, ptr %lsr.iv1, i64 4
+  %exitcond.not = icmp eq i64 %lsr.iv.next, 0
+  br i1 %exitcond.not, label %for.end, label %for.body
+
+for.end:                                          ; preds = %for.body
+  ret void
+}


        


More information about the llvm-commits mailing list