llvm.org GIT mirror llvm / 26e5285
Conditionalize indvars tests that rely on SCEV expansion of geps, which is relevant with canonical IVs. Anything else being checked by these tests is already covered by early CSE. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139535 91177308-0d34-0410-b5e6-96231b3b80d8 Andrew Trick 8 years ago
5 changed file(s) with 26 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
None ; RUN: opt < %s -indvars -S > %t
1 ; RUN: grep getelementptr %t | count 1
2 ; RUN: grep {mul .*, 37} %t | count 1
3 ; RUN: grep {add .*, 5203} %t | count 1
4 ; RUN: not grep cast %t
0 ; RUN: opt < %s -indvars -S -enable-iv-rewrite | FileCheck %s
1 ; CHECK: getelementptr
2 ; CHECK: mul {{.*}}, 37
3 ; CHECK: add {{.*}}, 5203
4 ; CHECK-NOT: cast
55
66 ; This test tests several things. The load and store should use the
77 ; same address instead of having it computed twice, and SCEVExpander should
None ; RUN: opt < %s -indvars -S > %t
1 ; RUN: not grep inttoptr %t
2 ; RUN: not grep ptrtoint %t
3 ; RUN: grep scevgep %t
0 ; RUN: opt < %s -indvars -S -enable-iv-rewrite | FileCheck %s
1 ; CHECK-NOT: {{inttoptr|ptrtoint}}
2 ; CHECK: scevgep
3 ; CHECK-NOT: {{inttoptr|ptrtoint}}
44 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128-n:32:64"
55
66 ; Indvars shouldn't need inttoptr/ptrtoint to expand an address here.
None ; RUN: opt < %s -indvars -S > %t
0 ; RUN: opt < %s -indvars -S -enable-iv-rewrite | FileCheck %s
1 ; No explicit integer multiplications!
2 ; No i8* arithmetic or pointer casting anywhere!
3 ; CHECK-NOT: = {{= mul|i8\*|bitcast|inttoptr|ptrtoint}}
14 ; Exactly one getelementptr for each load+store.
2 ; RUN: grep getelementptr %t | count 6
35 ; Each getelementptr using %struct.Q* %s as a base and not i8*.
4 ; RUN: grep {getelementptr \[%\]struct\\.Q\\* \[%\]s,} %t | count 6
5 ; No explicit integer multiplications!
6 ; RUN: not grep {= mul} %t
7 ; No i8* arithmetic or pointer casting anywhere!
8 ; RUN: not grep {i8\\*} %t
9 ; RUN: not grep bitcast %t
10 ; RUN: not grep inttoptr %t
11 ; RUN: not grep ptrtoint %t
6 ; CHECK: getelementptr %struct.Q* %s,
7 ; CHECK: getelementptr %struct.Q* %s,
8 ; CHECK: getelementptr %struct.Q* %s,
9 ; CHECK: getelementptr %struct.Q* %s,
10 ; CHECK: getelementptr %struct.Q* %s,
11 ; CHECK: getelementptr %struct.Q* %s,
12 ; CHECK-NOT: = {{= mul|i8\*|bitcast|inttoptr|ptrtoint}}
1213
1314 ; FIXME: This test should pass with or without TargetData. Until opt
1415 ; supports running tests without targetdata, just hardware this in.
None ; RUN: opt < %s -indvars -S \
1 ; RUN: | grep {\[%\]p.2.ip.1 = getelementptr \\\[3 x \\\[3 x double\\\]\\\]\\* \[%\]p, i64 2, i64 \[%\]tmp, i64 1}
0 ; RUN: opt < %s -indvars -S -enable-iv-rewrite | FileCheck %s
1 ; CHECK: %p.2.ip.1 = getelementptr [3 x [3 x double]]* %p, i64 2, i64 %tmp, i64 1
22 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128-n:32:64"
33
44 ; Indvars shouldn't expand this to
None ; RUN: opt < %s -indvars -S > %t
1 ; RUN: not grep ptrtoint %t
2 ; RUN: not grep inttoptr %t
3 ; RUN: grep getelementptr %t | count 1
0 ; RUN: opt < %s -indvars -S -enable-iv-rewrite | FileCheck %s
1 ; CHECK-NOT: {{ptrtoint|inttoptr}}
2 ; CHECK: getelementptr
3 ; CHECK-NOT: {{ptrtoint|inttoptr|getelementptr}}
44
55 ; Indvars shouldn't leave getelementptrs expanded out as
66 ; inttoptr+ptrtoint in its output in common cases.