xref: /llvm-project/llvm/test/Transforms/GVNHoist/pr30499.ll (revision 055fb7795aa219a3d274d280ec9129784f169f56)
1; RUN: opt -S -passes=gvn-hoist < %s
2
3define void @_Z3fn2v() #0 {
4entry:
5  %a = alloca ptr, align 8
6  %b = alloca i32, align 4
7  %0 = load ptr, ptr %a, align 8
8  store i8 0, ptr %0, align 1
9  %1 = load i32, ptr %b, align 4
10  %tobool = icmp ne i32 %1, 0
11  br i1 %tobool, label %if.then, label %if.end
12
13if.then:                                          ; preds = %entry
14  %call = call i64 @_Z3fn1v() #2
15  %conv = trunc i64 %call to i32
16  store i32 %conv, ptr %b, align 4
17  br label %if.end
18
19if.end:                                           ; preds = %if.then, %entry
20  %2 = load ptr, ptr %a, align 8
21  store i8 0, ptr %2, align 1
22  ret void
23}
24
25; Function Attrs: nounwind readonly
26declare i64 @_Z3fn1v() #1
27
28attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
29attributes #1 = { nounwind readonly "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
30attributes #2 = { nounwind readonly }
31