diff --git a/test/Transforms/IndVarSimplify/addrec-gep.ll b/test/Transforms/IndVarSimplify/addrec-gep.ll index 58cba605704..9e8b5289640 100644 --- a/test/Transforms/IndVarSimplify/addrec-gep.ll +++ b/test/Transforms/IndVarSimplify/addrec-gep.ll @@ -1,8 +1,8 @@ -; RUN: opt < %s -indvars -S > %t -; RUN: grep getelementptr %t | count 1 -; RUN: grep {mul .*, 37} %t | count 1 -; RUN: grep {add .*, 5203} %t | count 1 -; RUN: not grep cast %t +; RUN: opt < %s -indvars -S -enable-iv-rewrite | FileCheck %s +; CHECK: getelementptr +; CHECK: mul {{.*}}, 37 +; CHECK: add {{.*}}, 5203 +; CHECK-NOT: cast ; This test tests several things. The load and store should use the ; same address instead of having it computed twice, and SCEVExpander should diff --git a/test/Transforms/IndVarSimplify/preserve-gep-loop-variant.ll b/test/Transforms/IndVarSimplify/preserve-gep-loop-variant.ll index 26f05c4b1ee..66a1ab526f3 100644 --- a/test/Transforms/IndVarSimplify/preserve-gep-loop-variant.ll +++ b/test/Transforms/IndVarSimplify/preserve-gep-loop-variant.ll @@ -1,7 +1,7 @@ -; RUN: opt < %s -indvars -S > %t -; RUN: not grep inttoptr %t -; RUN: not grep ptrtoint %t -; RUN: grep scevgep %t +; RUN: opt < %s -indvars -S -enable-iv-rewrite | FileCheck %s +; CHECK-NOT: {{inttoptr|ptrtoint}} +; CHECK: scevgep +; CHECK-NOT: {{inttoptr|ptrtoint}} 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" ; Indvars shouldn't need inttoptr/ptrtoint to expand an address here. diff --git a/test/Transforms/IndVarSimplify/preserve-gep-nested.ll b/test/Transforms/IndVarSimplify/preserve-gep-nested.ll index b41de5828a9..613e30f7705 100644 --- a/test/Transforms/IndVarSimplify/preserve-gep-nested.ll +++ b/test/Transforms/IndVarSimplify/preserve-gep-nested.ll @@ -1,15 +1,16 @@ -; RUN: opt < %s -indvars -S > %t -; Exactly one getelementptr for each load+store. -; RUN: grep getelementptr %t | count 6 -; Each getelementptr using %struct.Q* %s as a base and not i8*. -; RUN: grep {getelementptr \[%\]struct\\.Q\\* \[%\]s,} %t | count 6 +; RUN: opt < %s -indvars -S -enable-iv-rewrite | FileCheck %s ; No explicit integer multiplications! -; RUN: not grep {= mul} %t ; No i8* arithmetic or pointer casting anywhere! -; RUN: not grep {i8\\*} %t -; RUN: not grep bitcast %t -; RUN: not grep inttoptr %t -; RUN: not grep ptrtoint %t +; CHECK-NOT: = {{= mul|i8\*|bitcast|inttoptr|ptrtoint}} +; Exactly one getelementptr for each load+store. +; Each getelementptr using %struct.Q* %s as a base and not i8*. +; CHECK: getelementptr %struct.Q* %s, +; CHECK: getelementptr %struct.Q* %s, +; CHECK: getelementptr %struct.Q* %s, +; CHECK: getelementptr %struct.Q* %s, +; CHECK: getelementptr %struct.Q* %s, +; CHECK: getelementptr %struct.Q* %s, +; CHECK-NOT: = {{= mul|i8\*|bitcast|inttoptr|ptrtoint}} ; FIXME: This test should pass with or without TargetData. Until opt ; supports running tests without targetdata, just hardware this in. diff --git a/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll b/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll index ca0c3999276..a4b1d78b85d 100644 --- a/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll +++ b/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -indvars -S \ -; RUN: | grep {\[%\]p.2.ip.1 = getelementptr \\\[3 x \\\[3 x double\\\]\\\]\\* \[%\]p, i64 2, i64 \[%\]tmp, i64 1} +; RUN: opt < %s -indvars -S -enable-iv-rewrite | FileCheck %s +; CHECK: %p.2.ip.1 = getelementptr [3 x [3 x double]]* %p, i64 2, i64 %tmp, i64 1 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" ; Indvars shouldn't expand this to diff --git a/test/Transforms/IndVarSimplify/preserve-gep.ll b/test/Transforms/IndVarSimplify/preserve-gep.ll index 82eda0386e7..f970826abc5 100644 --- a/test/Transforms/IndVarSimplify/preserve-gep.ll +++ b/test/Transforms/IndVarSimplify/preserve-gep.ll @@ -1,7 +1,7 @@ -; RUN: opt < %s -indvars -S > %t -; RUN: not grep ptrtoint %t -; RUN: not grep inttoptr %t -; RUN: grep getelementptr %t | count 1 +; RUN: opt < %s -indvars -S -enable-iv-rewrite | FileCheck %s +; CHECK-NOT: {{ptrtoint|inttoptr}} +; CHECK: getelementptr +; CHECK-NOT: {{ptrtoint|inttoptr|getelementptr}} ; Indvars shouldn't leave getelementptrs expanded out as ; inttoptr+ptrtoint in its output in common cases.