[safestack] Fix handling of array allocas.
[oota-llvm.git] / test / Transforms / Reassociate / pr21205.ll
1 ; RUN: opt -reassociate -S < %s | FileCheck %s
2 ; PR21205
3
4 @a = common global i32 0, align 4
5 @b = common global i32 0, align 4
6
7 ; Don't canonicalize %conv - undef into %conv + (-undef).
8 ; CHECK-LABEL: @test1
9 ; CHECK: %sub = fsub fast float %conv, undef
10 ; CHECK: %sub1 = fadd fast float %sub, -1.000000e+00
11
12 define i32 @test1() {
13 entry:
14   %0 = load i32, i32* @a, align 4
15   %conv = sitofp i32 %0 to float
16   %sub = fsub fast float %conv, undef
17   %sub1 = fadd fast float %sub, -1.000000e+00
18   %conv2 = fptosi float %sub1 to i32
19   store i32 %conv2, i32* @b, align 4
20   ret i32 undef
21 }