diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:17:04 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:17:04 +0000 |
| commit | b915e9e0fc85ba6f398b3fab0db6a81a8913af94 (patch) | |
| tree | 98b8f811c7aff2547cab8642daf372d6c59502fb /test/Transforms/LoopVersioning | |
| parent | 6421cca32f69ac849537a3cff78c352195e99f1b (diff) | |
Notes
Diffstat (limited to 'test/Transforms/LoopVersioning')
3 files changed, 77 insertions, 1 deletions
diff --git a/test/Transforms/LoopVersioning/exit-block-dominates-rt-check-block.ll b/test/Transforms/LoopVersioning/exit-block-dominates-rt-check-block.ll new file mode 100644 index 000000000000..960c890516c8 --- /dev/null +++ b/test/Transforms/LoopVersioning/exit-block-dominates-rt-check-block.ll @@ -0,0 +1,38 @@ +; This test ensures loop versioning does not produce an invalid dominator tree +; if the exit block of the loop (bb0) dominates the runtime check block +; (bb1 will become the runtime check block). + +; RUN: opt -loop-distribute -enable-loop-distribute -verify-dom-info -S -o - %s > %t +; RUN: opt -loop-simplify -loop-distribute -enable-loop-distribute -verify-dom-info -S -o - %s > %t +; RUN: FileCheck --check-prefix CHECK-VERSIONING -input-file %t %s + +; RUN: opt -loop-versioning -verify-dom-info -S -o - %s > %t +; RUN: opt -loop-simplify -loop-versioning -verify-dom-info -S -o - %s > %t +; RUN: FileCheck --check-prefix CHECK-VERSIONING -input-file %t %s + +@c1 = external global i16 + +define void @f(i16 %a) { + br label %bb0 + +bb0: + br label %bb1 + +bb1: + %tmp1 = load i16, i16* @c1 + br label %bb2 + +bb2: + %tmp2 = phi i16 [ %tmp1, %bb1 ], [ %tmp3, %bb2 ] + %tmp4 = getelementptr inbounds [1 x i32], [1 x i32]* undef, i32 0, i32 4 + store i32 1, i32* %tmp4 + %tmp5 = getelementptr inbounds [1 x i32], [1 x i32]* undef, i32 0, i32 9 + store i32 0, i32* %tmp5 + %tmp3 = add i16 %tmp2, 1 + store i16 %tmp2, i16* @c1 + %tmp6 = icmp sle i16 %tmp3, 0 + br i1 %tmp6, label %bb2, label %bb0 +} + +; Simple check to make sure loop versioning happened. +; CHECK-VERSIONING: bb2.lver.check: diff --git a/test/Transforms/LoopVersioning/loop-invariant-bound.ll b/test/Transforms/LoopVersioning/loop-invariant-bound.ll new file mode 100644 index 000000000000..3411adbf245e --- /dev/null +++ b/test/Transforms/LoopVersioning/loop-invariant-bound.ll @@ -0,0 +1,37 @@ +; RUN: opt -loop-versioning -S < %s | FileCheck %s +; Checks that when introducing check, we don't accidentally introduce non-dominating instructions +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +%Dual.212 = type { %Dual.213, %Partials.215 } +%Dual.213 = type { double, %Partials.214 } +%Partials.214 = type { [2 x double] } +%Partials.215 = type { [2 x %Dual.213] } + +; Function Attrs: sspreq +define void @"julia_axpy!_65480"(%Dual.212*) { +top: + br label %if24 + +; CHECK-NOT: %bc = bitcast i64* %v2.sroa.0.0..sroa_cast +; CHECK: %bound0 + +if24: ; preds = %if24, %top + %"#temp#1.sroa.3.02" = phi i64 [ undef, %top ], [ %2, %if24 ] + %"#temp#1.sroa.0.01" = phi i64 [ undef, %top ], [ %1, %if24 ] + %1 = add i64 %"#temp#1.sroa.0.01", 1 + %2 = add i64 %"#temp#1.sroa.3.02", 1 + ; This pointer is loop invariant. LAA used to re-use it from memcheck, even though it didn't dominate. + %v2.sroa.0.0..sroa_cast = bitcast %Dual.212* %0 to i64* + %v2.sroa.0.0.copyload = load i64, i64* %v2.sroa.0.0..sroa_cast, align 1 + %3 = add i64 %"#temp#1.sroa.0.01", -1 + %4 = getelementptr inbounds %Dual.212, %Dual.212* undef, i64 %3, i32 1, i32 0, i64 0, i32 1, i32 0, i64 0 + %5 = bitcast double* %4 to i64* + store i64 undef, i64* %5, align 8 + %notlhs27 = icmp eq i64 %2, undef + %notrhs28 = icmp eq i64 %1, undef + %6 = or i1 %notrhs28, %notlhs27 + br i1 %6, label %L41.L335_crit_edge, label %if24 + +L41.L335_crit_edge: ; preds = %if24 + ret void +} diff --git a/test/Transforms/LoopVersioning/noalias-version-twice.ll b/test/Transforms/LoopVersioning/noalias-version-twice.ll index 81ec0c0dc9f6..c53dc858c5ce 100644 --- a/test/Transforms/LoopVersioning/noalias-version-twice.ll +++ b/test/Transforms/LoopVersioning/noalias-version-twice.ll @@ -1,4 +1,5 @@ -; RUN: opt -basicaa -loop-distribute -scoped-noalias -loop-versioning -S < %s | FileCheck %s +; RUN: opt -basicaa -loop-distribute -enable-loop-distribute -loop-simplify -scoped-noalias \ +; RUN: -loop-versioning -S < %s | FileCheck %s ; Test the metadata generated when versioning an already versioned loop. Here ; we invoke loop distribution to perform the first round of versioning. It |
