mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-26 10:29:36 +00:00
Similar to gep (r230786) and load (r230794) changes. Similar migration script can be used to update test cases, which successfully migrated all of LLVM and Polly, but about 4 test cases needed manually changes in Clang. (this script will read the contents of stdin and massage it into stdout - wrap it in the 'apply.sh' script shown in previous commits + xargs to apply it over a large set of test cases) import fileinput import sys import re rep = re.compile(r"(getelementptr(?:\s+inbounds)?\s*\()((<\d*\s+x\s+)?([^@]*?)(|\s*addrspace\(\d+\))\s*\*(?(3)>)\s*)(?=$|%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|zeroinitializer|<|\[\[[a-zA-Z]|\{\{)", re.MULTILINE | re.DOTALL) def conv(match): line = match.group(1) line += match.group(4) line += ", " line += match.group(2) return line line = sys.stdin.read() off = 0 for match in re.finditer(rep, line): sys.stdout.write(line[off:match.start()]) sys.stdout.write(conv(match)) off = match.end() sys.stdout.write(line[off:]) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232184 91177308-0d34-0410-b5e6-96231b3b80d8
50 lines
1.6 KiB
LLVM
50 lines
1.6 KiB
LLVM
; RUN: opt < %s -loop-rotate -licm -S | FileCheck %s
|
|
; PR9604
|
|
|
|
@g_3 = global i32 0, align 4
|
|
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00"
|
|
|
|
define i32 @main() nounwind {
|
|
entry:
|
|
%tmp = load i32, i32* @g_3, align 4
|
|
%tobool = icmp eq i32 %tmp, 0
|
|
br i1 %tobool, label %for.cond, label %if.then
|
|
|
|
if.then: ; preds = %entry
|
|
br label %for.cond
|
|
|
|
for.cond: ; preds = %for.inc10, %if.then, %entry
|
|
%g.0 = phi i32* [ %g.0, %for.inc10 ], [ @g_3, %entry ], [ null, %if.then ]
|
|
%x.0 = phi i32 [ %inc12, %for.inc10 ], [ 0, %entry ], [ 0, %if.then ]
|
|
%cmp = icmp slt i32 %x.0, 5
|
|
br i1 %cmp, label %for.cond4, label %for.end13
|
|
|
|
for.cond4: ; preds = %for.body7, %for.cond
|
|
%y.0 = phi i32 [ %inc, %for.body7 ], [ 0, %for.cond ]
|
|
%cmp6 = icmp slt i32 %y.0, 5
|
|
br i1 %cmp6, label %for.body7, label %for.inc10
|
|
|
|
; CHECK: for.body7:
|
|
; CHECK-NEXT: phi
|
|
; CHECK-NEXT: store i32 0
|
|
; CHECK-NEXT: store i32 1
|
|
|
|
for.body7: ; preds = %for.cond4
|
|
store i32 0, i32* @g_3, align 4
|
|
store i32 1, i32* %g.0, align 4
|
|
%inc = add nsw i32 %y.0, 1
|
|
br label %for.cond4
|
|
|
|
for.inc10: ; preds = %for.cond4
|
|
%inc12 = add nsw i32 %x.0, 1
|
|
br label %for.cond
|
|
|
|
for.end13: ; preds = %for.cond
|
|
%tmp14 = load i32, i32* @g_3, align 4
|
|
%call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %tmp14) nounwind
|
|
ret i32 0
|
|
}
|
|
|
|
declare i32 @printf(i8* nocapture, ...) nounwind
|
|
|