1; RUN: opt < %s -instcombine -S | FileCheck %s 2target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" 3target triple = "x86_64-apple-macosx10.9.0" 4 5%struct._my_struct = type <{ [12 x i8], [4 x i8] }> 6 7@initval = common global %struct._my_struct zeroinitializer, align 1 8 9; InstCombine will try to change the %struct._my_struct alloca into an 10; allocation of an i96 because of the bitcast to create %2. That's not valid, 11; as the other 32 bits of the structure still feed into the return value 12define { i64, i64 } @function(i32 %x, i32 %y, i32 %z) nounwind { 13; CHECK-LABEL: @function( 14; CHECK-NEXT: entry: 15; CHECK-NEXT: %retval = alloca %struct._my_struct, align 8 16; CHECK-NOT: bitcast i96* %retval to %struct._my_struct* 17entry: 18 %retval = alloca %struct._my_struct, align 8 19 %k.sroa.0.0.copyload = load i96, i96* bitcast (%struct._my_struct* @initval to i96*), align 1 20 %k.sroa.1.12.copyload = load i32, i32* bitcast ([4 x i8]* getelementptr inbounds (%struct._my_struct, %struct._my_struct* @initval, i64 0, i32 1) to i32*), align 1 21 %0 = zext i32 %x to i96 22 %bf.value = shl nuw nsw i96 %0, 6 23 %bf.clear = and i96 %k.sroa.0.0.copyload, -288230376151711744 24 %1 = zext i32 %y to i96 25 %bf.value2 = shl nuw nsw i96 %1, 32 26 %bf.shl3 = and i96 %bf.value2, 288230371856744448 27 %bf.value.masked = and i96 %bf.value, 4294967232 28 %2 = zext i32 %z to i96 29 %bf.value8 = and i96 %2, 63 30 %bf.clear4 = or i96 %bf.shl3, %bf.value.masked 31 %bf.set5 = or i96 %bf.clear4, %bf.value8 32 %bf.set10 = or i96 %bf.set5, %bf.clear 33 %retval.0.cast7 = bitcast %struct._my_struct* %retval to i96* 34 store i96 %bf.set10, i96* %retval.0.cast7, align 8 35 %retval.12.idx8 = getelementptr inbounds %struct._my_struct, %struct._my_struct* %retval, i64 0, i32 1 36 %retval.12.cast9 = bitcast [4 x i8]* %retval.12.idx8 to i32* 37 store i32 %k.sroa.1.12.copyload, i32* %retval.12.cast9, align 4 38 %trunc = trunc i96 %bf.set10 to i64 39 %.fca.0.insert = insertvalue { i64, i64 } undef, i64 %trunc, 0 40 %retval.8.idx12 = getelementptr inbounds %struct._my_struct, %struct._my_struct* %retval, i64 0, i32 0, i64 8 41 %retval.8.cast13 = bitcast i8* %retval.8.idx12 to i64* 42 %retval.8.load14 = load i64, i64* %retval.8.cast13, align 8 43 %.fca.1.insert = insertvalue { i64, i64 } %.fca.0.insert, i64 %retval.8.load14, 1 44 ret { i64, i64 } %.fca.1.insert 45} 46