43 lines · plain
1; RUN: opt < %s -passes=instcombine -S | FileCheck %s2target 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 18 9; InstCombine will try to change the %struct._my_struct alloca into an10; 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 value12define { 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 816; CHECK-NOT: bitcast ptr %retval to ptr17entry:18 %retval = alloca %struct._my_struct, align 819 %k.sroa.0.0.copyload = load i96, ptr @initval, align 120 %k.sroa.1.12.copyload = load i32, ptr getelementptr inbounds (%struct._my_struct, ptr @initval, i64 0, i32 1), align 121 %0 = zext i32 %x to i9622 %bf.value = shl nuw nsw i96 %0, 623 %bf.clear = and i96 %k.sroa.0.0.copyload, -28823037615171174424 %1 = zext i32 %y to i9625 %bf.value2 = shl nuw nsw i96 %1, 3226 %bf.shl3 = and i96 %bf.value2, 28823037185674444827 %bf.value.masked = and i96 %bf.value, 429496723228 %2 = zext i32 %z to i9629 %bf.value8 = and i96 %2, 6330 %bf.clear4 = or i96 %bf.shl3, %bf.value.masked31 %bf.set5 = or i96 %bf.clear4, %bf.value832 %bf.set10 = or i96 %bf.set5, %bf.clear33 store i96 %bf.set10, ptr %retval, align 834 %retval.12.idx8 = getelementptr inbounds %struct._my_struct, ptr %retval, i64 0, i32 135 store i32 %k.sroa.1.12.copyload, ptr %retval.12.idx8, align 436 %trunc = trunc i96 %bf.set10 to i6437 %.fca.0.insert = insertvalue { i64, i64 } undef, i64 %trunc, 038 %retval.8.idx12 = getelementptr inbounds %struct._my_struct, ptr %retval, i64 0, i32 0, i64 839 %retval.8.load14 = load i64, ptr %retval.8.idx12, align 840 %.fca.1.insert = insertvalue { i64, i64 } %.fca.0.insert, i64 %retval.8.load14, 141 ret { i64, i64 } %.fca.1.insert42}43