void foo(void) {
  static unsigned int bm[16];
  int j;
  for (j = 0; j < 16; j++)
    bm[j] = bm[j] * 8;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    1142 <foo+0x42>
movslq -0x4(%rbp),%rcx
lea    0x2f10(%rip),%rax
mov    (%rax,%rcx,4),%edx
shl    $0x3,%edx
movslq -0x4(%rbp),%rcx
lea    0x2eff(%rip),%rax
mov    %edx,(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <foo+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
shll   $0x3,0x2f29(%rip)
shll   $0x3,0x2f32(%rip)
shll   $0x3,0x2f33(%rip)
shll   $0x3,0x2f34(%rip)
shll   $0x3,0x2f3d(%rip)
shll   $0x3,0x2f46(%rip)
shll   $0x3,0x2f47(%rip)
shll   $0x3,0x2f48(%rip)
shll   $0x3,0x2f51(%rip)
shll   $0x3,0x2f5a(%rip)
shll   $0x3,0x2f5b(%rip)
shll   $0x3,0x2f5c(%rip)
shll   $0x3,0x2f65(%rip)
shll   $0x3,0x2f6e(%rip)
shll   $0x3,0x2f6f(%rip)
shll   $0x3,0x2f70(%rip)
ret

LLVM IR (-O0):
@foo.bm = internal global [16 x i32] zeroinitializer
define void @foo() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %14, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 16
br i1 %4, label %5, label %17
5: ; preds = %2
%6 = load i32, i32* %1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [16 x i32], [16 x i32]* @foo.bm, i64 0, i64 %7
%9 = load i32, i32* %8
%10 = mul i32 %9, 8
%11 = load i32, i32* %1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [16 x i32], [16 x i32]* @foo.bm, i64 0, i64 %12
store i32 %10, i32* %13
br label %14
14: ; preds = %5
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 1
store i32 %16, i32* %1
br label %2
17: ; preds = %2
ret void
}

LLVM IR (-O2):
@foo.bm.0 = internal unnamed_addr global i32 0
@foo.bm.1 = internal unnamed_addr global i32 0
@foo.bm.2 = internal unnamed_addr global i32 0
@foo.bm.3 = internal unnamed_addr global i32 0
@foo.bm.4 = internal unnamed_addr global i32 0
@foo.bm.5 = internal unnamed_addr global i32 0
@foo.bm.6 = internal unnamed_addr global i32 0
@foo.bm.7 = internal unnamed_addr global i32 0
@foo.bm.8 = internal unnamed_addr global i32 0
@foo.bm.9 = internal unnamed_addr global i32 0
@foo.bm.10 = internal unnamed_addr global i32 0
@foo.bm.11 = internal unnamed_addr global i32 0
@foo.bm.12 = internal unnamed_addr global i32 0
@foo.bm.13 = internal unnamed_addr global i32 0
@foo.bm.14 = internal unnamed_addr global i32 0
@foo.bm.15 = internal unnamed_addr global i32 0
define void @foo() {
%1 = load i32, i32* @foo.bm.0
%2 = shl i32 %1, 3
store i32 %2, i32* @foo.bm.0
%3 = load i32, i32* @foo.bm.1
%4 = shl i32 %3, 3
store i32 %4, i32* @foo.bm.1
%5 = load i32, i32* @foo.bm.2
%6 = shl i32 %5, 3
store i32 %6, i32* @foo.bm.2
%7 = load i32, i32* @foo.bm.3
%8 = shl i32 %7, 3
store i32 %8, i32* @foo.bm.3
%9 = load i32, i32* @foo.bm.4
%10 = shl i32 %9, 3
store i32 %10, i32* @foo.bm.4
%11 = load i32, i32* @foo.bm.5
%12 = shl i32 %11, 3
store i32 %12, i32* @foo.bm.5
%13 = load i32, i32* @foo.bm.6
%14 = shl i32 %13, 3
store i32 %14, i32* @foo.bm.6
%15 = load i32, i32* @foo.bm.7
%16 = shl i32 %15, 3
store i32 %16, i32* @foo.bm.7
%17 = load i32, i32* @foo.bm.8
%18 = shl i32 %17, 3
store i32 %18, i32* @foo.bm.8
%19 = load i32, i32* @foo.bm.9
%20 = shl i32 %19, 3
store i32 %20, i32* @foo.bm.9
%21 = load i32, i32* @foo.bm.10
%22 = shl i32 %21, 3
store i32 %22, i32* @foo.bm.10
%23 = load i32, i32* @foo.bm.11
%24 = shl i32 %23, 3
store i32 %24, i32* @foo.bm.11
%25 = load i32, i32* @foo.bm.12
%26 = shl i32 %25, 3
store i32 %26, i32* @foo.bm.12
%27 = load i32, i32* @foo.bm.13
%28 = shl i32 %27, 3
store i32 %28, i32* @foo.bm.13
%29 = load i32, i32* @foo.bm.14
%30 = shl i32 %29, 3
store i32 %30, i32* @foo.bm.14
%31 = load i32, i32* @foo.bm.15
%32 = shl i32 %31, 3
store i32 %32, i32* @foo.bm.15
ret void
}