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 6; CHECK: %s = shl i64 %a, 3 7; CHECK: %r = or i64 %s, ptrtoint (i32* @A to i64) 8; CHECK: %q = add i64 %r, 1 9; CHECK: ret i64 %q 10 11target datalayout = "i32:8:32" 12 13@A = external global i32 14@B = weak_odr global i32 0 15 16define i64 @foo(i64 %a) { 17 %t = ptrtoint i32* @A to i64 18 %s = shl i64 %a, 3 19 %r = or i64 %t, %s 20 %q = add i64 %r, 1 21 ret i64 %q 22} 23 24define i32 @bar() { 25; CHECK: @bar 26 %r = load i32* @B, align 1 27; CHECK: align 1 28 ret i32 %r 29} 30