mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-09 15:57:28 +00:00
4177e6fff5
This was done through the aid of a terrible Perl creation. I will not paste any of the horrors here. Suffice to say, it require multiple staged rounds of replacements, state carried between, and a few nested-construct-parsing hacks that I'm not proud of. It happens, by luck, to be able to deal with all the TCL-quoting patterns in evidence in the LLVM test suite. If anyone is maintaining large out-of-tree test trees, feel free to poke me and I'll send you the steps I used to convert things, as well as answer any painful questions etc. IRC works best for this type of thing I find. Once converted, switch the LLVM lit config to use ShTests the same as Clang. In addition to being able to delete large amounts of Python code from 'lit', this will also simplify the entire test suite and some of lit's architecture. Finally, the test suite runs 33% faster on Linux now. ;] For my 16-hardware-thread (2x 4-core xeon e5520): 36s -> 24s git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159525 91177308-0d34-0410-b5e6-96231b3b80d8
58 lines
1.8 KiB
LLVM
58 lines
1.8 KiB
LLVM
; RUN: opt < %s -ipconstprop -S > %t
|
|
; RUN: cat %t | grep "store i32 %Z, i32\* %Q"
|
|
; RUN: cat %t | grep "add i32 1, 3"
|
|
|
|
;; This function returns its second argument on all return statements
|
|
define internal i32* @incdec(i1 %C, i32* %V) {
|
|
%X = load i32* %V
|
|
br i1 %C, label %T, label %F
|
|
|
|
T: ; preds = %0
|
|
%X1 = add i32 %X, 1
|
|
store i32 %X1, i32* %V
|
|
ret i32* %V
|
|
|
|
F: ; preds = %0
|
|
%X2 = sub i32 %X, 1
|
|
store i32 %X2, i32* %V
|
|
ret i32* %V
|
|
}
|
|
|
|
;; This function returns its first argument as a part of a multiple return
|
|
;; value
|
|
define internal { i32, i32 } @foo(i32 %A, i32 %B) {
|
|
%X = add i32 %A, %B
|
|
%Y = insertvalue { i32, i32 } undef, i32 %A, 0
|
|
%Z = insertvalue { i32, i32 } %Y, i32 %X, 1
|
|
ret { i32, i32 } %Z
|
|
}
|
|
|
|
define void @caller(i1 %C) {
|
|
%Q = alloca i32
|
|
;; Call incdec to see if %W is properly replaced by %Q
|
|
%W = call i32* @incdec(i1 %C, i32* %Q ) ; <i32> [#uses=1]
|
|
;; Call @foo twice, to prevent the arguments from propagating into the
|
|
;; function (so we can check the returned argument is properly
|
|
;; propagated per-caller).
|
|
%S1 = call { i32, i32 } @foo(i32 1, i32 2)
|
|
%X1 = extractvalue { i32, i32 } %S1, 0
|
|
%S2 = invoke { i32, i32 } @foo(i32 3, i32 4) to label %OK unwind label %LPAD
|
|
|
|
OK:
|
|
%X2 = extractvalue { i32, i32 } %S2, 0
|
|
;; Do some stuff with the returned values which we can grep for
|
|
%Z = add i32 %X1, %X2
|
|
store i32 %Z, i32* %W
|
|
br label %RET
|
|
|
|
LPAD:
|
|
%exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
|
|
cleanup
|
|
br label %RET
|
|
|
|
RET:
|
|
ret void
|
|
}
|
|
|
|
declare i32 @__gxx_personality_v0(...)
|