1 ; RUN: opt -passes=gvn -S < %s | FileCheck %s
3 ; The Global Value Numbering pass (GVN) propagates boolean values
4 ; that are constant in dominated basic blocks to all the uses
5 ; in these basic blocks. However, we don't want the constant propagated
6 ; into fake.use intrinsics since this would render the intrinsic useless
7 ; with respect to keeping the variable live up until the fake.use.
8 ; This test checks that we don't generate any fake.uses with constant 0.
10 ; Reduced from the following test case, generated with clang -O2 -S -emit-llvm -fextend-lifetimes test.c
12 ; extern void func1();
14 ; extern void baz(int);
16 ; int foo(int i, float f, int *punused)
34 ;; GVN should propagate a constant value through to a regular call, but not to
35 ;; a fake use, which should continue to track the original value.
36 ; CHECK: %[[CONV_VAR:[a-zA-Z0-9]+]] = fptosi
37 ; CHECK: call {{.+}} @bees(i8 0)
38 ; CHECK: call {{.+}} @llvm.fake.use(i8 %[[CONV_VAR]])
40 define i32 @foo(float %f) optdebug {
41 %conv = fptosi float %f to i8
42 %tobool3 = icmp eq i8 %conv, 0
43 br i1 %tobool3, label %if.end, label %lab
46 tail call void (...) @bees(i8 %conv)
47 tail call void (...) @llvm.fake.use(i8 %conv)
56 declare void @baz(i32)
58 declare void @bees(i32)
60 declare void @func1(...)