1; RUN: opt < %s -instcombine -S | FileCheck %s 2 3; Don't assume that external global variables or those with weak linkage have 4; their preferred alignment. They may only have the ABI minimum alignment. 5 6target datalayout = "i32:8:32" 7 8@A = external global i32 9@B = weak_odr global i32 0 10 11@C = available_externally global <4 x i32> zeroinitializer, align 4 12; CHECK: @C = available_externally global <4 x i32> zeroinitializer, align 4 13 14define i64 @foo(i64 %a) { 15 %t = ptrtoint i32* @A to i64 16 %s = shl i64 %a, 3 17 %r = or i64 %t, %s 18 %q = add i64 %r, 1 19 ret i64 %q 20} 21 22; CHECK-LABEL: define i64 @foo(i64 %a) 23; CHECK: %s = shl i64 %a, 3 24; CHECK: %r = or i64 %s, ptrtoint (i32* @A to i64) 25; CHECK: %q = add i64 %r, 1 26; CHECK: ret i64 %q 27 28define i32 @bar() { 29 %r = load i32, i32* @B, align 1 30 ret i32 %r 31} 32 33; CHECK-LABEL: @bar() 34; CHECK: align 1 35 36define void @vec_store() { 37 store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* @C, align 4 38 ret void 39} 40; CHECK: define void @vec_store() 41; CHECK: store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* @C, align 4 42