1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -scoped-noalias-aa -slp-vectorizer -mtriple=x86_64-apple-darwin -enable-new-pm=false -S %s | FileCheck %s 3 4define void @version_multiple(i32* nocapture %out_block, i32* nocapture readonly %counter) { 5; CHECK-LABEL: @version_multiple( 6; CHECK-NEXT: entry: 7; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[COUNTER:%.*]], align 4 8; CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* [[OUT_BLOCK:%.*]], align 4 9; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[TMP1]], [[TMP0]] 10; CHECK-NEXT: store i32 [[XOR]], i32* [[OUT_BLOCK]], align 4 11; CHECK-NEXT: [[ARRAYIDX_1:%.*]] = getelementptr inbounds i32, i32* [[COUNTER]], i64 1 12; CHECK-NEXT: [[TMP2:%.*]] = load i32, i32* [[ARRAYIDX_1]], align 4 13; CHECK-NEXT: [[ARRAYIDX2_1:%.*]] = getelementptr inbounds i32, i32* [[OUT_BLOCK]], i64 1 14; CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* [[ARRAYIDX2_1]], align 4 15; CHECK-NEXT: [[XOR_1:%.*]] = xor i32 [[TMP3]], [[TMP2]] 16; CHECK-NEXT: store i32 [[XOR_1]], i32* [[ARRAYIDX2_1]], align 4 17; CHECK-NEXT: [[ARRAYIDX_2:%.*]] = getelementptr inbounds i32, i32* [[COUNTER]], i64 2 18; CHECK-NEXT: [[TMP4:%.*]] = load i32, i32* [[ARRAYIDX_2]], align 4 19; CHECK-NEXT: [[ARRAYIDX2_2:%.*]] = getelementptr inbounds i32, i32* [[OUT_BLOCK]], i64 2 20; CHECK-NEXT: [[TMP5:%.*]] = load i32, i32* [[ARRAYIDX2_2]], align 4 21; CHECK-NEXT: [[XOR_2:%.*]] = xor i32 [[TMP5]], [[TMP4]] 22; CHECK-NEXT: store i32 [[XOR_2]], i32* [[ARRAYIDX2_2]], align 4 23; CHECK-NEXT: [[ARRAYIDX_3:%.*]] = getelementptr inbounds i32, i32* [[COUNTER]], i64 3 24; CHECK-NEXT: [[TMP6:%.*]] = load i32, i32* [[ARRAYIDX_3]], align 4 25; CHECK-NEXT: [[ARRAYIDX2_3:%.*]] = getelementptr inbounds i32, i32* [[OUT_BLOCK]], i64 3 26; CHECK-NEXT: [[TMP7:%.*]] = load i32, i32* [[ARRAYIDX2_3]], align 4 27; CHECK-NEXT: [[XOR_3:%.*]] = xor i32 [[TMP7]], [[TMP6]] 28; CHECK-NEXT: store i32 [[XOR_3]], i32* [[ARRAYIDX2_3]], align 4 29; CHECK-NEXT: ret void 30; 31entry: 32 %0 = load i32, i32* %counter, align 4 33 %1 = load i32, i32* %out_block, align 4 34 %xor = xor i32 %1, %0 35 store i32 %xor, i32* %out_block, align 4 36 %arrayidx.1 = getelementptr inbounds i32, i32* %counter, i64 1 37 %2 = load i32, i32* %arrayidx.1, align 4 38 %arrayidx2.1 = getelementptr inbounds i32, i32* %out_block, i64 1 39 %3 = load i32, i32* %arrayidx2.1, align 4 40 %xor.1 = xor i32 %3, %2 41 store i32 %xor.1, i32* %arrayidx2.1, align 4 42 %arrayidx.2 = getelementptr inbounds i32, i32* %counter, i64 2 43 %4 = load i32, i32* %arrayidx.2, align 4 44 %arrayidx2.2 = getelementptr inbounds i32, i32* %out_block, i64 2 45 %5 = load i32, i32* %arrayidx2.2, align 4 46 %xor.2 = xor i32 %5, %4 47 store i32 %xor.2, i32* %arrayidx2.2, align 4 48 %arrayidx.3 = getelementptr inbounds i32, i32* %counter, i64 3 49 %6 = load i32, i32* %arrayidx.3, align 4 50 %arrayidx2.3 = getelementptr inbounds i32, i32* %out_block, i64 3 51 %7 = load i32, i32* %arrayidx2.3, align 4 52 %xor.3 = xor i32 %7, %6 53 store i32 %xor.3, i32* %arrayidx2.3, align 4 54 ret void 55} 56 57declare void @use(<8 x float>) 58define void @delete_pointer_bound(float* %a, float* %b, i1 %c) #0 { 59; CHECK-LABEL: @delete_pointer_bound( 60; CHECK-NEXT: entry: 61; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x float*> poison, float* [[B:%.*]], i32 0 62; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x float*> [[TMP0]], float* [[B]], i32 1 63; CHECK-NEXT: [[TMP2:%.*]] = getelementptr float, <2 x float*> [[TMP1]], <2 x i64> <i64 10, i64 14> 64; CHECK-NEXT: br i1 [[C:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]] 65; CHECK: else: 66; CHECK-NEXT: [[TMP3:%.*]] = call <2 x float> @llvm.masked.gather.v2f32.v2p0f32(<2 x float*> [[TMP2]], i32 4, <2 x i1> <i1 true, i1 true>, <2 x float> undef) 67; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x float> [[TMP3]], <2 x float> poison, <4 x i32> <i32 0, i32 0, i32 1, i32 1> 68; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <4 x float> [[SHUFFLE]], <4 x float> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 undef, i32 undef, i32 3, i32 undef, i32 undef> 69; CHECK-NEXT: [[I71:%.*]] = shufflevector <8 x float> undef, <8 x float> [[TMP4]], <8 x i32> <i32 0, i32 1, i32 8, i32 9, i32 10, i32 5, i32 6, i32 13> 70; CHECK-NEXT: call void @use(<8 x float> [[I71]]) 71; CHECK-NEXT: ret void 72; CHECK: then: 73; CHECK-NEXT: [[A_8:%.*]] = getelementptr inbounds float, float* [[A:%.*]], i64 8 74; CHECK-NEXT: store float 0.000000e+00, float* [[A_8]], align 4 75; CHECK-NEXT: [[TMP5:%.*]] = extractelement <2 x float*> [[TMP2]], i32 1 76; CHECK-NEXT: [[L6:%.*]] = load float, float* [[TMP5]], align 4 77; CHECK-NEXT: [[A_5:%.*]] = getelementptr inbounds float, float* [[A]], i64 5 78; CHECK-NEXT: store float [[L6]], float* [[A_5]], align 4 79; CHECK-NEXT: [[A_6:%.*]] = getelementptr inbounds float, float* [[A]], i64 6 80; CHECK-NEXT: store float 0.000000e+00, float* [[A_6]], align 4 81; CHECK-NEXT: [[A_7:%.*]] = getelementptr inbounds float, float* [[A]], i64 7 82; CHECK-NEXT: store float 0.000000e+00, float* [[A_7]], align 4 83; CHECK-NEXT: ret void 84; 85entry: 86 %b.10 = getelementptr inbounds float, float* %b, i64 10 87 %b.14 = getelementptr inbounds float, float* %b, i64 14 88 br i1 %c, label %then, label %else 89 90else: 91 %l0 = load float, float* %b.10, align 4 92 %l1 = load float, float* %b.14, align 4 93 %i2 = insertelement <8 x float> undef, float %l0, i32 2 94 %i3 = insertelement <8 x float> %i2, float %l0, i32 3 95 %i4 = insertelement <8 x float> %i3, float %l1, i32 4 96 %i7 = insertelement <8 x float> %i4, float %l1, i32 7 97 call void @use(<8 x float> %i7) 98 ret void 99 100then: 101 %a.8 = getelementptr inbounds float, float* %a, i64 8 102 store float 0.0, float* %a.8, align 4 103 %l6 = load float, float* %b.14, align 4 104 %a.5 = getelementptr inbounds float, float* %a, i64 5 105 store float %l6, float* %a.5, align 4 106 %a.6 = getelementptr inbounds float, float* %a, i64 6 107 store float 0.0, float* %a.6, align 4 108 %a.7 = getelementptr inbounds float, float* %a, i64 7 109 store float 0.0, float* %a.7, align 4 110 ret void 111} 112 113%struct.zot = type { i16, i16, i16, i32, float, float, float, %struct.quux*, %struct.zot*, %struct.wombat*, %struct.wombat.0 } 114%struct.quux = type { i16, %struct.quux*, %struct.quux* } 115%struct.wombat = type { i32, i16, i8, i8, %struct.eggs* } 116%struct.eggs = type { float, i8, %struct.ham } 117%struct.ham = type { [2 x double], [8 x i8] } 118%struct.wombat.0 = type { %struct.bar } 119%struct.bar = type { [3 x double], [3 x double], double, double, i16, [3 x double]*, i32, [3 x double] } 120 121define double @preserve_loop_info(%struct.zot* %arg) { 122; CHECK-LABEL: @preserve_loop_info( 123; CHECK-NEXT: entry: 124; CHECK-NEXT: [[TMP:%.*]] = alloca [3 x double], align 16 125; CHECK-NEXT: br label [[OUTER_HEADER:%.*]] 126; CHECK: outer.header: 127; CHECK-NEXT: br label [[INNER:%.*]] 128; CHECK: inner: 129; CHECK-NEXT: br i1 undef, label [[OUTER_LATCH:%.*]], label [[INNER]] 130; CHECK: outer.latch: 131; CHECK-NEXT: br i1 undef, label [[BB:%.*]], label [[OUTER_HEADER]] 132; CHECK: bb: 133; CHECK-NEXT: [[TMP5:%.*]] = load [3 x double]*, [3 x double]** undef, align 8 134; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds [3 x double], [3 x double]* [[TMP]], i64 0, i64 0 135; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds [3 x double], [3 x double]* [[TMP]], i64 0, i64 1 136; CHECK-NEXT: br label [[LOOP_3HEADER:%.*]] 137; CHECK: loop.3header: 138; CHECK-NEXT: br i1 undef, label [[LOOP_3LATCH:%.*]], label [[BB9:%.*]] 139; CHECK: bb9: 140; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds [3 x double], [3 x double]* [[TMP5]], i64 undef, i64 1 141; CHECK-NEXT: store double undef, double* [[TMP6]], align 16 142; CHECK-NEXT: [[TMP12:%.*]] = load double, double* [[TMP10]], align 8 143; CHECK-NEXT: store double [[TMP12]], double* [[TMP7]], align 8 144; CHECK-NEXT: br label [[LOOP_3LATCH]] 145; CHECK: loop.3latch: 146; CHECK-NEXT: br i1 undef, label [[BB14:%.*]], label [[LOOP_3HEADER]] 147; CHECK: bb14: 148; CHECK-NEXT: [[TMP15:%.*]] = call double undef(double* [[TMP6]], %struct.zot* [[ARG:%.*]]) 149; CHECK-NEXT: ret double undef 150; 151entry: 152 %tmp = alloca [3 x double], align 16 153 br label %outer.header 154 155outer.header: ; preds = %bb3, %bb 156 br label %inner 157 158inner: 159 br i1 undef, label %outer.latch, label %inner 160 161outer.latch: ; preds = %bb16 162 br i1 undef, label %bb, label %outer.header 163 164bb: ; preds = %bb3 165 %tmp5 = load [3 x double]*, [3 x double]** undef, align 8 166 %tmp6 = getelementptr inbounds [3 x double], [3 x double]* %tmp, i64 0, i64 0 167 %tmp7 = getelementptr inbounds [3 x double], [3 x double]* %tmp, i64 0, i64 1 168 br label %loop.3header 169 170loop.3header: ; preds = %bb13, %bb4 171 br i1 undef, label %loop.3latch, label %bb9 172 173bb9: ; preds = %bb8 174 %tmp10 = getelementptr inbounds [3 x double], [3 x double]* %tmp5, i64 undef, i64 1 175 store double undef, double* %tmp6, align 16 176 %tmp12 = load double, double* %tmp10, align 8 177 store double %tmp12, double* %tmp7, align 8 178 br label %loop.3latch 179 180loop.3latch: ; preds = %bb11, %bb8 181 br i1 undef, label %bb14, label %loop.3header 182 183bb14: ; preds = %bb13 184 %tmp15 = call double undef(double* %tmp6, %struct.zot* %arg) 185 ret double undef 186} 187 188attributes #0 = { "target-features"="+avx2" } 189