diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2013-01-24 11:53:01 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2013-01-24 11:53:01 +0000 |
| commit | 8a21005cca67caa0db5db584faada56e1e38627c (patch) | |
| tree | b5ca9a4144dcea53c5fba2aa6c32f2f39a3a3e2d /llvm/test | |
| parent | 7481ca8ff538f96472b32e845b8b086d3364c82d (diff) | |
| download | bcm5719-llvm-8a21005cca67caa0db5db584faada56e1e38627c.tar.gz bcm5719-llvm-8a21005cca67caa0db5db584faada56e1e38627c.zip | |
Switch the constant expression speculation cost evaluation away from
a cost fuction that seems both a bit ad-hoc and also poorly suited to
evaluating constant expressions.
Notably, it is missing any support for trivial expressions such as
'inttoptr'. I could fix this routine, but it isn't clear to me all of
the constraints its other users are operating under.
The core protection that seems relevant here is avoiding the formation
of a select instruction wich a further chain of select operations in
a constant expression operand. Just explicitly encode that constraint.
Also, update the comments and organization here to make it clear where
this needs to go -- this should be driven off of real cost measurements
which take into account the number of constants expressions and the
depth of the constant expression tree.
llvm-svn: 173340
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Transforms/SimplifyCFG/SpeculativeExec.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/SpeculativeExec.ll b/llvm/test/Transforms/SimplifyCFG/SpeculativeExec.ll index a61867fe89c..c66d3ec67be 100644 --- a/llvm/test/Transforms/SimplifyCFG/SpeculativeExec.ll +++ b/llvm/test/Transforms/SimplifyCFG/SpeculativeExec.ll @@ -44,3 +44,25 @@ join: ret i8 %c } +define i8* @test3(i1* %dummy, i8* %a, i8* %b) { +; Test that a weird, unfolded constant cast in the PHI don't block speculation. +; CHECK: @test3 + +entry: + %cond1 = load volatile i1* %dummy + br i1 %cond1, label %if, label %end + +if: + %cond2 = load volatile i1* %dummy + br i1 %cond2, label %then, label %end + +then: + br label %end + +end: + %x = phi i8* [ %a, %entry ], [ %b, %if ], [ inttoptr (i64 42 to i8*), %then ] +; CHECK-NOT: phi +; CHECK: select i1 %cond2, i8* inttoptr + + ret i8* %x +} |

