• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -O2 -march=bpfel -mcpu=v2 -mattr=+alu32 < %s | FileCheck %s
2;
3; For the below test case, both 'ret' and 'b' at 'ret == b'
4; need SLL/SLR. For 'ret', 'ret = a' may receive the value
5; from argument with high 32-bit invalid data.
6;
7; extern int helper(int);
8; int test(int a, int b, int c, int d) {
9;   int ret;
10;   if (a < b)
11;     ret = (c < d) ? a : 0;
12;   else
13;     ret = (c < a) ? 1 : 2;
14;   return helper(ret == b);
15; }
16
17define dso_local i32 @test(i32 %a, i32 %b, i32 %c, i32 %d) local_unnamed_addr {
18entry:
19  %cmp = icmp slt i32 %a, %b
20  %cmp1 = icmp slt i32 %c, %d
21  %cond = select i1 %cmp1, i32 %a, i32 0
22  %cmp2 = icmp slt i32 %c, %a
23  %cond3 = select i1 %cmp2, i32 1, i32 2
24  %ret.0 = select i1 %cmp, i32 %cond, i32 %cond3
25  %cmp4 = icmp eq i32 %ret.0, %b
26  %conv = zext i1 %cmp4 to i32
27  %call = tail call i32 @helper(i32 %conv)
28  ret i32 %call
29}
30; CHECK: r{{[0-9]+}} = w{{[0-9]+}}
31; CHECK: r{{[0-9]+}} = w{{[0-9]+}}
32; CHECK: if r{{[0-9]+}} == r{{[0-9]+}} goto
33
34declare dso_local i32 @helper(i32) local_unnamed_addr
35