brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · cf50d0f Raw
34 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -O1 -mtriple i686-unknown-linux-gnu -o - %s | FileCheck %s3 4@foo = global i16 0, align 15@aliasFoo = alias i16, ptr @foo6@bar = global i16 0, align 17 8; This used to miscompile due to not realizing that the store to @aliasFoo9; clobbered @foo (see PR51878).10;11; With some improvements to codegen it should be possible to detect that @foo12; and @aliasFoo are aliases, and that @aliasFoo isn't aliasing with @bar. So13; ideally we would end up with three movw instructions here. Running opt14; before llc on this test case would take care of that, but llc is not smart15; enough to deduce that itself yet.16define i16 @main() {17; CHECK-LABEL: main:18; CHECK:       # %bb.0: # %entry19; CHECK-NEXT:    movw $1, foo20; CHECK-NEXT:    movw $2, bar21; CHECK-NEXT:    movw $4, aliasFoo22; CHECK-NEXT:    movzwl foo, %eax23; CHECK-NEXT:    addw bar, %ax24; CHECK-NEXT:    retl25entry:26  store i16 1, ptr @foo27  store i16 2, ptr @bar28  store i16 4, ptr @aliasFoo29  %foo = load i16, ptr @foo30  %bar = load i16, ptr @bar31  %res = add i16 %foo, %bar32  ret i16 %res33}34