44 lines · plain
1; RUN: opt -passes='loop-mssa(licm<allowspeculation>)' -S %s | FileCheck --check-prefixes=COMMON,SPEC_ON %s2; RUN: opt -passes='loop-mssa(licm<no-allowspeculation>)' -S %s | FileCheck --check-prefixes=COMMON,SPEC_OFF %s3; RUN: opt -passes='licm<no-allowspeculation>' -S %s | FileCheck --check-prefixes=COMMON,SPEC_OFF %s4; RUN: opt -passes='loop-mssa(lnicm<allowspeculation>)' -S %s | FileCheck --check-prefixes=COMMON,SPEC_ON %s5; RUN: opt -passes='loop-mssa(lnicm<no-allowspeculation>)' -S %s | FileCheck --check-prefixes=COMMON,SPEC_OFF %s6; RUN: opt -passes='lnicm<no-allowspeculation>' -S %s | FileCheck --check-prefixes=COMMON,SPEC_OFF %s7 8define void @test(ptr %ptr, i32 %N) {9; COMMON-LABEL: @test(10; COMMON-NEXT: entry:11; SPEC_ON-NEXT: [[GEP:%.*]] = getelementptr [10 x i32], ptr [[PTR:%.*]], i32 0, i32 112; COMMON-NEXT: br label [[LOOP_HEADER:%.*]]13; COMMON: loop.header:14; COMMON-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[LOOP_LATCH:%.*]] ]15; COMMON-NEXT: [[CMP:%.*]] = icmp ult i32 [[IV]], [[N:%.*]]16; COMMON-NEXT: br i1 [[CMP]], label [[LOOP_LATCH]], label [[EXIT:%.*]]17; COMMON: loop.latch:18; SPEC_OFF-NEXT: [[GEP:%.*]] = getelementptr [10 x i32], ptr [[PTR:%.*]], i32 0, i32 119; COMMON-NEXT: [[GEP_IV:%.*]] = getelementptr i32, ptr [[GEP]], i32 [[IV]]20; COMMON-NEXT: store i32 9999, ptr [[GEP_IV]], align 421; COMMON-NEXT: [[IV_NEXT]] = add i32 [[IV]], 122; COMMON-NEXT: br label [[LOOP_HEADER]]23; COMMON: exit:24; COMMON-NEXT: ret void25;26entry:27 br label %loop.header28 29loop.header:30 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop.latch ]31 %cmp = icmp ult i32 %iv, %N32 br i1 %cmp, label %loop.latch, label %exit33 34loop.latch:35 %gep = getelementptr [10 x i32], ptr %ptr, i32 0, i32 136 %gep.iv = getelementptr i32, ptr %gep, i32 %iv37 store i32 9999, ptr %gep.iv38 %iv.next = add i32 %iv, 139 br label %loop.header40 41exit:42 ret void43}44