1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -O1 -mtriple i686-unknown-linux-gnu -o - %s | FileCheck %s
4 @foo = global i16 0, align 1
5 @aliasFoo = alias i16, ptr @foo
6 @bar = global i16 0, align 1
8 ; This used to miscompile due to not realizing that the store to @aliasFoo
9 ; clobbered @foo (see PR51878).
11 ; With some improvements to codegen it should be possible to detect that @foo
12 ; and @aliasFoo are aliases, and that @aliasFoo isn't aliasing with @bar. So
13 ; ideally we would end up with three movw instructions here. Running opt
14 ; before llc on this test case would take care of that, but llc is not smart
15 ; enough to deduce that itself yet.
18 ; CHECK: # %bb.0: # %entry
19 ; CHECK-NEXT: movw $1, foo
20 ; CHECK-NEXT: movw $2, bar
21 ; CHECK-NEXT: movw $4, aliasFoo
22 ; CHECK-NEXT: movzwl foo, %eax
23 ; CHECK-NEXT: addw bar, %ax
28 store i16 4, ptr @aliasFoo
29 %foo = load i16, ptr @foo
30 %bar = load i16, ptr @bar
31 %res = add i16 %foo, %bar