1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S -basic-aa -gvn -enable-split-backedge-in-load-pre=true < %s | FileCheck %s --check-prefix=ON 3; RUN: opt -S -basic-aa -gvn -enable-split-backedge-in-load-pre=false < %s | FileCheck %s --check-prefix=OFF 4 5target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32" 6 7define i32 @test(i1 %b, i1 %c, i32* noalias %p, i32* noalias %q) { 8; ON-LABEL: @test( 9; ON-NEXT: entry: 10; ON-NEXT: [[Y1:%.*]] = load i32, i32* [[P:%.*]], align 4 11; ON-NEXT: call void @use(i32 [[Y1]]) 12; ON-NEXT: br label [[HEADER:%.*]] 13; ON: header: 14; ON-NEXT: [[Y:%.*]] = phi i32 [ [[Y_PRE:%.*]], [[SKIP_HEADER_CRIT_EDGE:%.*]] ], [ [[Y]], [[HEADER]] ], [ [[Y1]], [[ENTRY:%.*]] ] 15; ON-NEXT: call void @use(i32 [[Y]]) 16; ON-NEXT: br i1 [[B:%.*]], label [[SKIP:%.*]], label [[HEADER]] 17; ON: skip: 18; ON-NEXT: call void @clobber(i32* [[P]], i32* [[Q:%.*]]) 19; ON-NEXT: br i1 [[C:%.*]], label [[SKIP_HEADER_CRIT_EDGE]], label [[EXIT:%.*]] 20; ON: skip.header_crit_edge: 21; ON-NEXT: [[Y_PRE]] = load i32, i32* [[P]], align 4 22; ON-NEXT: br label [[HEADER]] 23; ON: exit: 24; ON-NEXT: ret i32 [[Y]] 25; 26; OFF-LABEL: @test( 27; OFF-NEXT: entry: 28; OFF-NEXT: [[Y1:%.*]] = load i32, i32* [[P:%.*]], align 4 29; OFF-NEXT: call void @use(i32 [[Y1]]) 30; OFF-NEXT: br label [[HEADER:%.*]] 31; OFF: header: 32; OFF-NEXT: [[Y:%.*]] = load i32, i32* [[P]], align 4 33; OFF-NEXT: call void @use(i32 [[Y]]) 34; OFF-NEXT: br i1 [[B:%.*]], label [[SKIP:%.*]], label [[HEADER]] 35; OFF: skip: 36; OFF-NEXT: call void @clobber(i32* [[P]], i32* [[Q:%.*]]) 37; OFF-NEXT: br i1 [[C:%.*]], label [[HEADER]], label [[EXIT:%.*]] 38; OFF: exit: 39; OFF-NEXT: ret i32 [[Y]] 40; 41entry: 42 %y1 = load i32, i32* %p 43 call void @use(i32 %y1) 44 br label %header 45header: 46 %y = load i32, i32* %p 47 call void @use(i32 %y) 48 br i1 %b, label %skip, label %header 49skip: 50 call void @clobber(i32* %p, i32* %q) 51 br i1 %c, label %header, label %exit 52exit: 53 ret i32 %y 54} 55 56declare void @use(i32) readonly 57declare void @clobber(i32* %p, i32* %q) 58