xref: /llvm-project/llvm/test/Transforms/LoopVersioning/loop-invariant-bound.ll (revision 055fb7795aa219a3d274d280ec9129784f169f56)
179a1a5b3SRoman Lebedev; RUN: opt -passes=loop-versioning -S < %s | FileCheck %s
2cee313d2SEric Christopher; Checks that when introducing check, we don't accidentally introduce non-dominating instructions
3cee313d2SEric Christophertarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4cee313d2SEric Christopher
5cee313d2SEric Christopher%Dual.212 = type { %Dual.213, %Partials.215 }
6cee313d2SEric Christopher%Dual.213 = type { double, %Partials.214 }
7cee313d2SEric Christopher%Partials.214 = type { [2 x double] }
8cee313d2SEric Christopher%Partials.215 = type { [2 x %Dual.213] }
9cee313d2SEric Christopher
10cee313d2SEric Christopher; Function Attrs: sspreq
11*055fb779SNikita Popovdefine void @"julia_axpy!_65480"(ptr, ptr %other) {
12cee313d2SEric Christophertop:
13cee313d2SEric Christopher  br label %if24
14cee313d2SEric Christopher
15*055fb779SNikita Popov; CHECK-NOT: %bc = bitcast ptr %v2.sroa.0.0..sroa_cast
16*055fb779SNikita Popov; CHECK: %bound0 = icmp ult ptr %[[x:[a-z0-9]+]], %[[y:[a-z0-9]+]]
17*055fb779SNikita Popov; CHECK-NOT: %bound1 = icmp ult ptr %[[y]], %[[x]]
18cee313d2SEric Christopher
19cee313d2SEric Christopherif24:                                             ; preds = %if24, %top
20cee313d2SEric Christopher  %"#temp#1.sroa.3.02" = phi i64 [ undef, %top ], [ %2, %if24 ]
21cee313d2SEric Christopher  %"#temp#1.sroa.0.01" = phi i64 [ undef, %top ], [ %1, %if24 ]
22cee313d2SEric Christopher  %1 = add i64 %"#temp#1.sroa.0.01", 1
23cee313d2SEric Christopher  %2 = add i64 %"#temp#1.sroa.3.02", 1
24cee313d2SEric Christopher  ; This pointer is loop invariant. LAA used to re-use it from memcheck, even though it didn't dominate.
25*055fb779SNikita Popov  %v2.sroa.0.0.copyload = load i64, ptr %0, align 1
26cee313d2SEric Christopher  %3 = add i64 %"#temp#1.sroa.0.01", -1
27*055fb779SNikita Popov  %4 = getelementptr inbounds %Dual.212, ptr %other, i64 0, i32 1, i32 0, i64 0, i32 1, i32 0, i64 0
28*055fb779SNikita Popov  store i64 undef, ptr %4, align 8
29cee313d2SEric Christopher  %notlhs27 = icmp eq i64 %2, undef
30cee313d2SEric Christopher  %notrhs28 = icmp eq i64 %1, undef
31*055fb779SNikita Popov  %5 = or i1 %notrhs28, %notlhs27
32*055fb779SNikita Popov  br i1 %5, label %L41.L335_crit_edge, label %if24
33cee313d2SEric Christopher
34cee313d2SEric ChristopherL41.L335_crit_edge:                               ; preds = %if24
35cee313d2SEric Christopher  ret void
36cee313d2SEric Christopher}
37