1; RUN: opt -basic-aa -loop-versioning -S < %s | FileCheck %s 2target triple = "x86_64-unknown-linux-gnu" 3 4define void @fill(i8** %ls1.20, i8** %ls2.21, i8* %cse3.22) { 5; CHECK-LABEL: @fill( 6; CHECK-NEXT: bb1.lver.check: 7; CHECK-NEXT: [[LS1_20_PROMOTED:%.*]] = load i8*, i8** [[LS1_20:%.*]], align 8 8; CHECK-NEXT: [[LS2_21_PROMOTED:%.*]] = load i8*, i8** [[LS2_21:%.*]], align 8 9; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, i8* [[LS1_20_PROMOTED]], i64 -1 10; CHECK-NEXT: [[SCEVGEP1:%.*]] = getelementptr i8, i8* [[LS1_20_PROMOTED]], i64 1 11; CHECK-NEXT: [[SCEVGEP2:%.*]] = getelementptr i8, i8* [[LS2_21_PROMOTED]], i64 1 12; CHECK-NEXT: [[BOUND0:%.*]] = icmp ult i8* [[SCEVGEP]], [[SCEVGEP2]] 13; CHECK-NEXT: [[BOUND1:%.*]] = icmp ult i8* [[LS2_21_PROMOTED]], [[SCEVGEP1]] 14; CHECK-NEXT: [[FOUND_CONFLICT:%.*]] = and i1 [[BOUND0]], [[BOUND1]] 15; CHECK-NEXT: br i1 [[FOUND_CONFLICT]], label %bb1.ph.lver.orig, label %bb1.ph 16; CHECK: bb1.ph.lver.orig: 17; 18bb1.ph: 19 %ls1.20.promoted = load i8*, i8** %ls1.20 20 %ls2.21.promoted = load i8*, i8** %ls2.21 21 br label %bb1 22 23bb1: 24 %_tmp302 = phi i8* [ %ls2.21.promoted, %bb1.ph ], [ %_tmp30, %bb1 ] 25 %_tmp281 = phi i8* [ %ls1.20.promoted, %bb1.ph ], [ %_tmp28, %bb1 ] 26 %_tmp14 = getelementptr i8, i8* %_tmp281, i16 -1 27 %_tmp15 = load i8, i8* %_tmp14 28 %add = add i8 %_tmp15, 1 29 store i8 %add, i8* %_tmp281 30 store i8 %add, i8* %_tmp302 31 %_tmp28 = getelementptr i8, i8* %_tmp281, i16 1 32 %_tmp30 = getelementptr i8, i8* %_tmp302, i16 1 33 br i1 false, label %bb1, label %bb3.loopexit 34 35bb3.loopexit: 36 %_tmp30.lcssa = phi i8* [ %_tmp30, %bb1 ] 37 %_tmp15.lcssa = phi i8 [ %_tmp15, %bb1 ] 38 %_tmp28.lcssa = phi i8* [ %_tmp28, %bb1 ] 39 store i8* %_tmp28.lcssa, i8** %ls1.20 40 store i8 %_tmp15.lcssa, i8* %cse3.22 41 store i8* %_tmp30.lcssa, i8** %ls2.21 42 br label %bb3 43 44bb3: 45 ret void 46} 47 48define void @fill_no_null_opt(i8** %ls1.20, i8** %ls2.21, i8* %cse3.22) #0 { 49; CHECK-LABEL: @fill_no_null_opt( 50; CHECK-NEXT: bb1.lver.check: 51; CHECK-NEXT: [[LS1_20_PROMOTED:%.*]] = load i8*, i8** [[LS1_20:%.*]], align 8 52; CHECK-NEXT: [[LS2_21_PROMOTED:%.*]] = load i8*, i8** [[LS2_21:%.*]], align 8 53; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, i8* [[LS1_20_PROMOTED]], i64 -1 54; CHECK-NEXT: [[SCEVGEP1:%.*]] = getelementptr i8, i8* [[LS1_20_PROMOTED]], i64 1 55; CHECK-NEXT: [[SCEVGEP2:%.*]] = getelementptr i8, i8* [[LS2_21_PROMOTED]], i64 1 56; CHECK-NEXT: [[BOUND0:%.*]] = icmp ult i8* [[SCEVGEP]], [[SCEVGEP2]] 57; CHECK-NEXT: [[BOUND1:%.*]] = icmp ult i8* [[LS2_21_PROMOTED]], [[SCEVGEP1]] 58; CHECK-NEXT: [[FOUND_CONFLICT:%.*]] = and i1 [[BOUND0]], [[BOUND1]] 59; CHECK-NEXT: [[SCEVGEP3:%.*]] = getelementptr i8, i8* [[LS1_20_PROMOTED]], i64 -1 60; CHECK-NEXT: [[TMP0:%.*]] = getelementptr i8, i8* [[SCEVGEP3]], i64 0 61; CHECK-NEXT: [[TMP2:%.*]] = getelementptr i8, i8* [[LS1_20_PROMOTED]], i64 0 62; CHECK-NEXT: br i1 [[FOUND_CONFLICT]], label %bb1.ph.lver.orig, label %bb1.ph 63; CHECK: bb1.ph.lver.orig: 64; 65bb1.ph: 66 %ls1.20.promoted = load i8*, i8** %ls1.20 67 %ls2.21.promoted = load i8*, i8** %ls2.21 68 br label %bb1 69 70bb1: 71 %_tmp302 = phi i8* [ %ls2.21.promoted, %bb1.ph ], [ %_tmp30, %bb1 ] 72 %_tmp281 = phi i8* [ %ls1.20.promoted, %bb1.ph ], [ %_tmp28, %bb1 ] 73 %_tmp14 = getelementptr i8, i8* %_tmp281, i16 -1 74 %_tmp15 = load i8, i8* %_tmp14 75 %add = add i8 %_tmp15, 1 76 store i8 %add, i8* %_tmp281 77 store i8 %add, i8* %_tmp302 78 %_tmp28 = getelementptr i8, i8* %_tmp281, i16 1 79 %_tmp30 = getelementptr i8, i8* %_tmp302, i16 1 80 br i1 false, label %bb1, label %bb3.loopexit 81 82bb3.loopexit: 83 %_tmp30.lcssa = phi i8* [ %_tmp30, %bb1 ] 84 %_tmp15.lcssa = phi i8 [ %_tmp15, %bb1 ] 85 %_tmp28.lcssa = phi i8* [ %_tmp28, %bb1 ] 86 store i8* %_tmp28.lcssa, i8** %ls1.20 87 store i8 %_tmp15.lcssa, i8* %cse3.22 88 store i8* %_tmp30.lcssa, i8** %ls2.21 89 br label %bb3 90 91bb3: 92 ret void 93} 94 95attributes #0 = { null_pointer_is_valid } 96