mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-19 01:13:25 +00:00
42c3f554f4
move loads back past a check that the load address is valid, see new testcase. The test that went in with 72661 has exactly this case, except that the conditional it's moving past is checking something else; I've settled for changing that test to reference a global, not a pointer. It may be possible to scan all the tests you pass and make sure none of them are checking any component of the address, but it's not trivial and I'm not trying to do that here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73632 91177308-0d34-0410-b5e6-96231b3b80d8
34 lines
1.0 KiB
LLVM
34 lines
1.0 KiB
LLVM
; RUN: llvm-as < %s | opt -gvn -enable-load-pre | llvm-dis | not grep {tmp3 = load}
|
|
|
|
@p = external global i32
|
|
define i32 @f(i32 %n) nounwind {
|
|
entry:
|
|
br label %for.cond
|
|
|
|
for.cond: ; preds = %for.inc, %entry
|
|
%i.0 = phi i32 [ 0, %entry ], [ %indvar.next, %for.inc ] ; <i32> [#uses=2]
|
|
%cmp = icmp slt i32 %i.0, %n ; <i1> [#uses=1]
|
|
br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge
|
|
|
|
for.cond.for.end_crit_edge: ; preds = %for.cond
|
|
br label %for.end
|
|
|
|
for.body: ; preds = %for.cond
|
|
%tmp3 = load i32* @p ; <i32> [#uses=1]
|
|
%dec = add i32 %tmp3, -1 ; <i32> [#uses=2]
|
|
store i32 %dec, i32* @p
|
|
%cmp6 = icmp slt i32 %dec, 0 ; <i1> [#uses=1]
|
|
br i1 %cmp6, label %for.body.for.end_crit_edge, label %for.inc
|
|
|
|
for.body.for.end_crit_edge: ; preds = %for.body
|
|
br label %for.end
|
|
|
|
for.inc: ; preds = %for.body
|
|
%indvar.next = add i32 %i.0, 1 ; <i32> [#uses=1]
|
|
br label %for.cond
|
|
|
|
for.end: ; preds = %for.body.for.end_crit_edge, %for.cond.for.end_crit_edge
|
|
%tmp9 = load i32* @p ; <i32> [#uses=1]
|
|
ret i32 %tmp9
|
|
}
|