| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| ; RUN: opt -passes=slp-vectorizer -slp-threshold=-100 -mtriple=x86_64-unknown-linux-gnu -S < %s | FileCheck %s --check-prefixes=VEC |
| ; RUN: opt -passes=slp-vectorizer -slp-threshold=-100 -slp-phi-vectorization-budget=3 -mtriple=x86_64-unknown-linux-gnu -S < %s | FileCheck %s --check-prefixes=BUDGET |
| |
| define void @phi_bundle(ptr %A, i32 %k) { |
| ; VEC-LABEL: @phi_bundle( |
| ; VEC-NEXT: entry: |
| ; VEC-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[K:%.*]], 0 |
| ; VEC-NEXT: br i1 [[TOBOOL]], label [[IF_ELSE:%.*]], label [[IF_END:%.*]] |
| ; VEC: if.else: |
| ; VEC-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds double, ptr [[A:%.*]], i64 10 |
| ; VEC-NEXT: [[TMP0:%.*]] = load <2 x double>, ptr [[ARRAYIDX]], align 8 |
| ; VEC-NEXT: br label [[IF_END]] |
| ; VEC: if.end: |
| ; VEC-NEXT: [[TMP1:%.*]] = phi <2 x double> [ [[TMP0]], [[IF_ELSE]] ], [ <double 3.000000e+00, double 5.000000e+00>, [[ENTRY:%.*]] ] |
| ; VEC-NEXT: store <2 x double> [[TMP1]], ptr [[A]], align 8 |
| ; VEC-NEXT: ret void |
| ; |
| ; BUDGET-LABEL: @phi_bundle( |
| ; BUDGET-NEXT: entry: |
| ; BUDGET-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[K:%.*]], 0 |
| ; BUDGET-NEXT: br i1 [[TOBOOL]], label [[IF_ELSE:%.*]], label [[IF_END:%.*]] |
| ; BUDGET: if.else: |
| ; BUDGET-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds double, ptr [[A:%.*]], i64 10 |
| ; BUDGET-NEXT: [[TMP0:%.*]] = load double, ptr [[ARRAYIDX]], align 8 |
| ; BUDGET-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds double, ptr [[A]], i64 11 |
| ; BUDGET-NEXT: [[TMP1:%.*]] = load double, ptr [[ARRAYIDX1]], align 8 |
| ; BUDGET-NEXT: br label [[IF_END]] |
| ; BUDGET: if.end: |
| ; BUDGET-NEXT: [[A0_0:%.*]] = phi double [ [[TMP0]], [[IF_ELSE]] ], [ 3.000000e+00, [[ENTRY:%.*]] ] |
| ; BUDGET-NEXT: [[A1_0:%.*]] = phi double [ [[TMP1]], [[IF_ELSE]] ], [ 5.000000e+00, [[ENTRY]] ] |
| ; BUDGET-NEXT: store double [[A0_0]], ptr [[A]], align 8 |
| ; BUDGET-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds double, ptr [[A]], i64 1 |
| ; BUDGET-NEXT: store double [[A1_0]], ptr [[ARRAYIDX3]], align 8 |
| ; BUDGET-NEXT: ret void |
| ; |
| entry: |
| %tobool = icmp eq i32 %k, 0 |
| br i1 %tobool, label %if.else, label %if.end |
| |
| if.else: |
| %arrayidx = getelementptr inbounds double, ptr %A, i64 10 |
| %0 = load double, ptr %arrayidx, align 8 |
| %arrayidx1 = getelementptr inbounds double, ptr %A, i64 11 |
| %1 = load double, ptr %arrayidx1, align 8 |
| br label %if.end |
| |
| if.end: |
| %A0.0 = phi double [ %0, %if.else ], [ 3.000000e+00, %entry ] |
| %A1.0 = phi double [ %1, %if.else ], [ 5.000000e+00, %entry ] |
| store double %A0.0, ptr %A, align 8 |
| %arrayidx3 = getelementptr inbounds double, ptr %A, i64 1 |
| store double %A1.0, ptr %arrayidx3, align 8 |
| ret void |
| } |