1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -O2 -mattr=avx < %s | FileCheck %s
3 ; RUN: opt -S -passes='default<O2>' -mattr=avx < %s | FileCheck %s
5 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-unknown-linux-gnu"
8 ; FIXME: The br -> switch conversion blocks vectorization.
10 define dso_local void @test(i32* %start, i32* %end) #0 {
13 ; CHECK-NEXT: [[I11_NOT1:%.*]] = icmp eq i32* [[START:%.*]], [[END:%.*]]
14 ; CHECK-NEXT: br i1 [[I11_NOT1]], label [[EXIT:%.*]], label [[BB12:%.*]]
16 ; CHECK-NEXT: [[PTR2:%.*]] = phi i32* [ [[PTR_NEXT:%.*]], [[LATCH:%.*]] ], [ [[START]], [[ENTRY:%.*]] ]
17 ; CHECK-NEXT: [[VAL:%.*]] = load i32, i32* [[PTR2]], align 4
18 ; CHECK-NEXT: switch i32 [[VAL]], label [[LATCH]] [
19 ; CHECK-NEXT: i32 -12, label [[STORE:%.*]]
20 ; CHECK-NEXT: i32 13, label [[STORE]]
23 ; CHECK-NEXT: store i32 42, i32* [[PTR2]], align 4
24 ; CHECK-NEXT: br label [[LATCH]]
26 ; CHECK-NEXT: [[PTR_NEXT]] = getelementptr inbounds i32, i32* [[PTR2]], i64 1
27 ; CHECK-NEXT: [[I11_NOT:%.*]] = icmp eq i32* [[PTR_NEXT]], [[END]]
28 ; CHECK-NEXT: br i1 [[I11_NOT]], label [[EXIT]], label [[BB12]]
30 ; CHECK-NEXT: ret void
36 %ptr = phi i32* [ %start, %entry ], [ %ptr.next, %latch ]
37 %i11 = icmp ne i32* %ptr, %end
38 br i1 %i11, label %bb12, label %exit
41 %val = load i32, i32* %ptr, align 4
42 %c1 = icmp eq i32 %val, 13
43 %c2 = icmp eq i32 %val, -12
45 br i1 %c3, label %store, label %latch
48 store i32 42, i32* %ptr, align 4
52 %ptr.next = getelementptr inbounds i32, i32* %ptr, i32 1