[llvm] r360934 - [Tests] Start consolidating lftr tests into a single file
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu May 16 13:33:42 PDT 2019
Author: reames
Date: Thu May 16 13:33:41 2019
New Revision: 360934
URL: http://llvm.org/viewvc/llvm-project?rev=360934&view=rev
Log:
[Tests] Start consolidating lftr tests into a single file
Added:
llvm/trunk/test/Transforms/IndVarSimplify/lftr.ll
- copied, changed from r360933, llvm/trunk/test/Transforms/IndVarSimplify/lftr_simple.ll
Removed:
llvm/trunk/test/Transforms/IndVarSimplify/lftr-udiv-tripcount.ll
llvm/trunk/test/Transforms/IndVarSimplify/lftr-zext.ll
llvm/trunk/test/Transforms/IndVarSimplify/lftr_simple.ll
Removed: llvm/trunk/test/Transforms/IndVarSimplify/lftr-udiv-tripcount.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/lftr-udiv-tripcount.ll?rev=360933&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/IndVarSimplify/lftr-udiv-tripcount.ll (original)
+++ llvm/trunk/test/Transforms/IndVarSimplify/lftr-udiv-tripcount.ll (removed)
@@ -1,46 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -indvars -S | FileCheck %s
-
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
-
-; It is okay to do LFTR on this loop even though the trip count is a
-; division because in this case the division can be optimized to a
-; shift.
-
-define void @foo(i8* %a, i8 %n) nounwind uwtable ssp {
-; CHECK-LABEL: @foo(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: [[E:%.*]] = icmp sgt i8 [[N:%.*]], 3
-; CHECK-NEXT: br i1 [[E]], label [[LOOP_PREHEADER:%.*]], label [[EXIT:%.*]]
-; CHECK: loop.preheader:
-; CHECK-NEXT: [[TMP0:%.*]] = add i8 [[N]], 3
-; CHECK-NEXT: [[TMP1:%.*]] = lshr i8 [[TMP0]], 2
-; CHECK-NEXT: [[TMP2:%.*]] = add i8 [[TMP1]], 1
-; CHECK-NEXT: br label [[LOOP:%.*]]
-; CHECK: loop:
-; CHECK-NEXT: [[I1:%.*]] = phi i8 [ [[I1_INC:%.*]], [[LOOP]] ], [ 0, [[LOOP_PREHEADER]] ]
-; CHECK-NEXT: [[I1_INC]] = add nuw nsw i8 [[I1]], 1
-; CHECK-NEXT: store volatile i8 0, i8* [[A:%.*]]
-; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8 [[I1_INC]], [[TMP2]]
-; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT_LOOPEXIT:%.*]]
-; CHECK: exit.loopexit:
-; CHECK-NEXT: br label [[EXIT]]
-; CHECK: exit:
-; CHECK-NEXT: ret void
-;
-entry:
- %e = icmp sgt i8 %n, 3
- br i1 %e, label %loop, label %exit
-
-loop:
- %i = phi i8 [ 0, %entry ], [ %i.inc, %loop ]
- %i1 = phi i8 [ 0, %entry ], [ %i1.inc, %loop ]
- %i.inc = add nsw i8 %i, 4
- %i1.inc = add i8 %i1, 1
- store volatile i8 0, i8* %a
- %c = icmp slt i8 %i, %n
- br i1 %c, label %loop, label %exit
-
-exit:
- ret void
-}
Removed: llvm/trunk/test/Transforms/IndVarSimplify/lftr-zext.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/lftr-zext.ll?rev=360933&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/IndVarSimplify/lftr-zext.ll (original)
+++ llvm/trunk/test/Transforms/IndVarSimplify/lftr-zext.ll (removed)
@@ -1,41 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -indvars -S | FileCheck %s
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.9.0"
-
- at data = common global [240 x i8] zeroinitializer, align 16
-
-define void @foo(i8* %a) #0 {
-; CHECK-LABEL: @foo(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: br label [[LOOP:%.*]]
-; CHECK: loop:
-; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), [[ENTRY:%.*]] ], [ [[TMP3:%.*]], [[LOOP]] ]
-; CHECK-NEXT: [[DOT0:%.*]] = phi i8* [ [[A:%.*]], [[ENTRY]] ], [ [[TMP:%.*]], [[LOOP]] ]
-; CHECK-NEXT: [[TMP]] = getelementptr inbounds i8, i8* [[DOT0]], i64 1
-; CHECK-NEXT: [[TMP2:%.*]] = load i8, i8* [[DOT0]], align 1
-; CHECK-NEXT: [[TMP3]] = getelementptr inbounds i8, i8* [[P_0]], i64 1
-; CHECK-NEXT: store i8 [[TMP2]], i8* [[P_0]], align 1
-; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8* [[TMP3]], getelementptr (i8, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), i64 240)
-; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT:%.*]]
-; CHECK: exit:
-; CHECK-NEXT: ret void
-;
-entry:
- br label %loop
-
-loop:
- %i.0 = phi i8 [ 0, %entry ], [ %tmp4, %loop ]
- %p.0 = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), %entry ], [ %tmp3, %loop ]
- %.0 = phi i8* [ %a, %entry ], [ %tmp, %loop ]
- %tmp = getelementptr inbounds i8, i8* %.0, i64 1
- %tmp2 = load i8, i8* %.0, align 1
- %tmp3 = getelementptr inbounds i8, i8* %p.0, i64 1
- store i8 %tmp2, i8* %p.0, align 1
- %tmp4 = add i8 %i.0, 1
- %tmp5 = icmp ult i8 %tmp4, -16
- br i1 %tmp5, label %loop, label %exit
-
-exit:
- ret void
-}
Copied: llvm/trunk/test/Transforms/IndVarSimplify/lftr.ll (from r360933, llvm/trunk/test/Transforms/IndVarSimplify/lftr_simple.ll)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/lftr.ll?p2=llvm/trunk/test/Transforms/IndVarSimplify/lftr.ll&p1=llvm/trunk/test/Transforms/IndVarSimplify/lftr_simple.ll&r1=360933&r2=360934&rev=360934&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/IndVarSimplify/lftr_simple.ll (original)
+++ llvm/trunk/test/Transforms/IndVarSimplify/lftr.ll Thu May 16 13:33:41 2019
@@ -37,3 +37,81 @@ loopexit:
ret i32 %i
}
+
+ at data = common global [240 x i8] zeroinitializer, align 16
+
+define void @test_zext(i8* %a) #0 {
+; CHECK-LABEL: @test_zext(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[LOOP:%.*]]
+; CHECK: loop:
+; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), [[ENTRY:%.*]] ], [ [[TMP3:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[DOT0:%.*]] = phi i8* [ [[A:%.*]], [[ENTRY]] ], [ [[TMP:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[TMP]] = getelementptr inbounds i8, i8* [[DOT0]], i64 1
+; CHECK-NEXT: [[TMP2:%.*]] = load i8, i8* [[DOT0]], align 1
+; CHECK-NEXT: [[TMP3]] = getelementptr inbounds i8, i8* [[P_0]], i64 1
+; CHECK-NEXT: store i8 [[TMP2]], i8* [[P_0]], align 1
+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8* [[TMP3]], getelementptr (i8, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), i64 240)
+; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT:%.*]]
+; CHECK: exit:
+; CHECK-NEXT: ret void
+;
+entry:
+ br label %loop
+
+loop:
+ %i.0 = phi i8 [ 0, %entry ], [ %tmp4, %loop ]
+ %p.0 = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), %entry ], [ %tmp3, %loop ]
+ %.0 = phi i8* [ %a, %entry ], [ %tmp, %loop ]
+ %tmp = getelementptr inbounds i8, i8* %.0, i64 1
+ %tmp2 = load i8, i8* %.0, align 1
+ %tmp3 = getelementptr inbounds i8, i8* %p.0, i64 1
+ store i8 %tmp2, i8* %p.0, align 1
+ %tmp4 = add i8 %i.0, 1
+ %tmp5 = icmp ult i8 %tmp4, -16
+ br i1 %tmp5, label %loop, label %exit
+
+exit:
+ ret void
+}
+
+; It is okay to do LFTR on this loop even though the trip count is a
+; division because in this case the division can be optimized to a
+; shift.
+define void @test_udiv_as_shift(i8* %a, i8 %n) nounwind uwtable ssp {
+; CHECK-LABEL: @test_udiv_as_shift(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[E:%.*]] = icmp sgt i8 [[N:%.*]], 3
+; CHECK-NEXT: br i1 [[E]], label [[LOOP_PREHEADER:%.*]], label [[EXIT:%.*]]
+; CHECK: loop.preheader:
+; CHECK-NEXT: [[TMP0:%.*]] = add i8 [[N]], 3
+; CHECK-NEXT: [[TMP1:%.*]] = lshr i8 [[TMP0]], 2
+; CHECK-NEXT: [[TMP2:%.*]] = add i8 [[TMP1]], 1
+; CHECK-NEXT: br label [[LOOP:%.*]]
+; CHECK: loop:
+; CHECK-NEXT: [[I1:%.*]] = phi i8 [ [[I1_INC:%.*]], [[LOOP]] ], [ 0, [[LOOP_PREHEADER]] ]
+; CHECK-NEXT: [[I1_INC]] = add nuw nsw i8 [[I1]], 1
+; CHECK-NEXT: store volatile i8 0, i8* [[A:%.*]]
+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8 [[I1_INC]], [[TMP2]]
+; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT_LOOPEXIT:%.*]]
+; CHECK: exit.loopexit:
+; CHECK-NEXT: br label [[EXIT]]
+; CHECK: exit:
+; CHECK-NEXT: ret void
+;
+entry:
+ %e = icmp sgt i8 %n, 3
+ br i1 %e, label %loop, label %exit
+
+loop:
+ %i = phi i8 [ 0, %entry ], [ %i.inc, %loop ]
+ %i1 = phi i8 [ 0, %entry ], [ %i1.inc, %loop ]
+ %i.inc = add nsw i8 %i, 4
+ %i1.inc = add i8 %i1, 1
+ store volatile i8 0, i8* %a
+ %c = icmp slt i8 %i, %n
+ br i1 %c, label %loop, label %exit
+
+exit:
+ ret void
+}
Removed: llvm/trunk/test/Transforms/IndVarSimplify/lftr_simple.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/lftr_simple.ll?rev=360933&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/IndVarSimplify/lftr_simple.ll (original)
+++ llvm/trunk/test/Transforms/IndVarSimplify/lftr_simple.ll (removed)
@@ -1,39 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -indvars -dce -S | FileCheck %s
-
-; LFTR should eliminate the need for the computation of i*i completely. It
-; is only used to compute the exit value.
-
-; Provide legal integer types.
-target datalayout = "n8:16:32:64"
-
- at A = external global i32
-
-define i32 @quadratic_setlt() {
-; CHECK-LABEL: @quadratic_setlt(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: br label [[LOOP:%.*]]
-; CHECK: loop:
-; CHECK-NEXT: [[I:%.*]] = phi i32 [ 7, [[ENTRY:%.*]] ], [ [[I_NEXT:%.*]], [[LOOP]] ]
-; CHECK-NEXT: [[I_NEXT]] = add nuw nsw i32 [[I]], 1
-; CHECK-NEXT: store i32 [[I]], i32* @A
-; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[I_NEXT]], 33
-; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[LOOPEXIT:%.*]]
-; CHECK: loopexit:
-; CHECK-NEXT: ret i32 32
-;
-entry:
- br label %loop
-
-loop:
- %i = phi i32 [ 7, %entry ], [ %i.next, %loop ]
- %i.next = add i32 %i, 1
- store i32 %i, i32* @A
- %i2 = mul i32 %i, %i
- %c = icmp slt i32 %i2, 1000
- br i1 %c, label %loop, label %loopexit
-
-loopexit:
- ret i32 %i
-}
-
More information about the llvm-commits
mailing list