Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt < %s -instcombine -S | FileCheck %s
      2 
      3 ; Don't assume that external global variables have their preferred
      4 ; 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 
     11 target datalayout = "-i32:8:32"
     12 
     13 @A = external global i32
     14 @B = external global i32
     15 
     16 define 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