[llvm] 100df68 - [SCEV] Add test coverage for invertible functions of IVs
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 18 09:02:01 PST 2021
Author: Philip Reames
Date: 2021-11-18T08:56:45-08:00
New Revision: 100df68496d1de6795fbc2878b91e5930ac231a6
URL: https://github.com/llvm/llvm-project/commit/100df68496d1de6795fbc2878b91e5930ac231a6
DIFF: https://github.com/llvm/llvm-project/commit/100df68496d1de6795fbc2878b91e5930ac231a6.diff
LOG: [SCEV] Add test coverage for invertible functions of IVs
Added:
Modified:
llvm/test/Analysis/ScalarEvolution/ne-overflow.ll
Removed:
################################################################################
diff --git a/llvm/test/Analysis/ScalarEvolution/ne-overflow.ll b/llvm/test/Analysis/ScalarEvolution/ne-overflow.ll
index 48835b36ac18e..67afbf1b381fe 100644
--- a/llvm/test/Analysis/ScalarEvolution/ne-overflow.ll
+++ b/llvm/test/Analysis/ScalarEvolution/ne-overflow.ll
@@ -1,6 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
-
-; RUN: opt %s -passes='print<scalar-evolution>' -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
+; RUN: opt %s -passes='print<scalar-evolution>' -scalar-evolution-classify-expressions=0 -disable-output 2>&1 | FileCheck %s
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@@ -228,4 +227,110 @@ for.cond.cleanup:
ret void
}
+define void @test_zext(i64 %N) mustprogress {
+; CHECK-LABEL: 'test_zext'
+; CHECK-NEXT: Determining loop execution counts for: @test_zext
+; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %for.body: Unpredictable max backedge-taken count.
+; CHECK-NEXT: Loop %for.body: Unpredictable predicated backedge-taken count.
+;
+entry:
+ br label %for.body
+
+for.body:
+ %iv = phi i32 [ %iv.next, %for.body ], [ 0, %entry ]
+ %iv.next = add i32 %iv, 2
+ %zext = zext i32 %iv to i64
+ %cmp = icmp ne i64 %zext, %N
+ br i1 %cmp, label %for.body, label %for.cond.cleanup
+
+for.cond.cleanup:
+ ret void
+}
+
+define void @test_sext(i64 %N) mustprogress {
+; CHECK-LABEL: 'test_sext'
+; CHECK-NEXT: Determining loop execution counts for: @test_sext
+; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %for.body: Unpredictable max backedge-taken count.
+; CHECK-NEXT: Loop %for.body: Unpredictable predicated backedge-taken count.
+;
+entry:
+ br label %for.body
+
+for.body:
+ %iv = phi i32 [ %iv.next, %for.body ], [ 0, %entry ]
+ %iv.next = add i32 %iv, 2
+ %sext = sext i32 %iv to i64
+ %cmp = icmp ne i64 %sext, %N
+ br i1 %cmp, label %for.body, label %for.cond.cleanup
+
+for.cond.cleanup:
+ ret void
+}
+
+define void @test_zext_of_sext(i64 %N) mustprogress {
+; CHECK-LABEL: 'test_zext_of_sext'
+; CHECK-NEXT: Determining loop execution counts for: @test_zext_of_sext
+; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %for.body: Unpredictable max backedge-taken count.
+; CHECK-NEXT: Loop %for.body: Unpredictable predicated backedge-taken count.
+;
+entry:
+ br label %for.body
+for.body:
+ %iv = phi i32 [ %iv.next, %for.body ], [ 0, %entry ]
+ %iv.next = add i32 %iv, 2
+ %sext = sext i32 %iv to i48
+ %zext = zext i48 %sext to i64
+ %cmp = icmp ne i64 %zext, %N
+ br i1 %cmp, label %for.body, label %for.cond.cleanup
+
+for.cond.cleanup:
+ ret void
+}
+
+define void @test_zext_offset(i64 %N) mustprogress {
+; CHECK-LABEL: 'test_zext_offset'
+; CHECK-NEXT: Determining loop execution counts for: @test_zext_offset
+; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %for.body: Unpredictable max backedge-taken count.
+; CHECK-NEXT: Loop %for.body: Unpredictable predicated backedge-taken count.
+;
+entry:
+ br label %for.body
+
+for.body:
+ %iv = phi i32 [ %iv.next, %for.body ], [ 0, %entry ]
+ %iv.next = add i32 %iv, 2
+ %zext = zext i32 %iv to i64
+ %offset = add i64 %zext, 21
+ %cmp = icmp ne i64 %offset, %N
+ br i1 %cmp, label %for.body, label %for.cond.cleanup
+
+for.cond.cleanup:
+ ret void
+}
+
+define void @test_sext_offset(i64 %N) mustprogress {
+; CHECK-LABEL: 'test_sext_offset'
+; CHECK-NEXT: Determining loop execution counts for: @test_sext_offset
+; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %for.body: Unpredictable max backedge-taken count.
+; CHECK-NEXT: Loop %for.body: Unpredictable predicated backedge-taken count.
+;
+entry:
+ br label %for.body
+
+for.body:
+ %iv = phi i32 [ %iv.next, %for.body ], [ 0, %entry ]
+ %iv.next = add i32 %iv, 2
+ %sext = sext i32 %iv to i64
+ %offset = add i64 %sext, 21
+ %cmp = icmp ne i64 %offset, %N
+ br i1 %cmp, label %for.body, label %for.cond.cleanup
+
+for.cond.cleanup:
+ ret void
+}
More information about the llvm-commits
mailing list