mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-27 13:30:05 +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
132 lines
3.4 KiB
LLVM
132 lines
3.4 KiB
LLVM
; RUN: opt < %s -simplifycfg -S > %t
|
|
; RUN: not grep "^BB.tomerge" %t
|
|
; RUN: grep "^BB.nomerge" %t | count 2
|
|
|
|
; ModuleID = '<stdin>'
|
|
declare i1 @foo()
|
|
|
|
declare i1 @bar(i32)
|
|
|
|
; This function can't be merged
|
|
define void @a() {
|
|
entry:
|
|
br label %BB.nomerge
|
|
|
|
BB.nomerge: ; preds = %Common, %entry
|
|
; This phi has a conflicting value (0) with below phi (2), so blocks
|
|
; can't be merged.
|
|
%a = phi i32 [ 1, %entry ], [ 0, %Common ] ; <i32> [#uses=1]
|
|
br label %Succ
|
|
|
|
Succ: ; preds = %Common, %BB.nomerge
|
|
%b = phi i32 [ %a, %BB.nomerge ], [ 2, %Common ] ; <i32> [#uses=0]
|
|
%conde = call i1 @foo( ) ; <i1> [#uses=1]
|
|
br i1 %conde, label %Common, label %Exit
|
|
|
|
Common: ; preds = %Succ
|
|
%cond = call i1 @foo( ) ; <i1> [#uses=1]
|
|
br i1 %cond, label %BB.nomerge, label %Succ
|
|
|
|
Exit: ; preds = %Succ
|
|
ret void
|
|
}
|
|
|
|
; This function can't be merged
|
|
define void @b() {
|
|
entry:
|
|
br label %BB.nomerge
|
|
|
|
BB.nomerge: ; preds = %Common, %entry
|
|
br label %Succ
|
|
|
|
Succ: ; preds = %Common, %BB.nomerge
|
|
; This phi has confliction values for Common and (through BB) Common,
|
|
; blocks can't be merged
|
|
%b = phi i32 [ 1, %BB.nomerge ], [ 2, %Common ] ; <i32> [#uses=0]
|
|
%conde = call i1 @foo( ) ; <i1> [#uses=1]
|
|
br i1 %conde, label %Common, label %Exit
|
|
|
|
Common: ; preds = %Succ
|
|
%cond = call i1 @foo( ) ; <i1> [#uses=1]
|
|
br i1 %cond, label %BB.nomerge, label %Succ
|
|
|
|
Exit: ; preds = %Succ
|
|
ret void
|
|
}
|
|
|
|
; This function can be merged
|
|
define void @c() {
|
|
entry:
|
|
br label %BB.tomerge
|
|
|
|
BB.tomerge: ; preds = %Common, %entry
|
|
br label %Succ
|
|
|
|
Succ: ; preds = %Common, %BB.tomerge, %Pre-Exit
|
|
; This phi has identical values for Common and (through BB) Common,
|
|
; blocks can't be merged
|
|
%b = phi i32 [ 1, %BB.tomerge ], [ 1, %Common ], [ 2, %Pre-Exit ]
|
|
%conde = call i1 @foo( ) ; <i1> [#uses=1]
|
|
br i1 %conde, label %Common, label %Pre-Exit
|
|
|
|
Common: ; preds = %Succ
|
|
%cond = call i1 @foo( ) ; <i1> [#uses=1]
|
|
br i1 %cond, label %BB.tomerge, label %Succ
|
|
|
|
Pre-Exit: ; preds = %Succ
|
|
; This adds a backedge, so the %b phi node gets a third branch and is
|
|
; not completely trivial
|
|
%cond2 = call i1 @foo( ) ; <i1> [#uses=1]
|
|
br i1 %cond2, label %Succ, label %Exit
|
|
|
|
Exit: ; preds = %Pre-Exit
|
|
ret void
|
|
}
|
|
|
|
; This function can be merged
|
|
define void @d() {
|
|
entry:
|
|
br label %BB.tomerge
|
|
|
|
BB.tomerge: ; preds = %Common, %entry
|
|
; This phi has a matching value (0) with below phi (0), so blocks
|
|
; can be merged.
|
|
%a = phi i32 [ 1, %entry ], [ 0, %Common ] ; <i32> [#uses=1]
|
|
br label %Succ
|
|
|
|
Succ: ; preds = %Common, %BB.tomerge
|
|
%b = phi i32 [ %a, %BB.tomerge ], [ 0, %Common ] ; <i32> [#uses=0]
|
|
%conde = call i1 @foo( ) ; <i1> [#uses=1]
|
|
br i1 %conde, label %Common, label %Exit
|
|
|
|
Common: ; preds = %Succ
|
|
%cond = call i1 @foo( ) ; <i1> [#uses=1]
|
|
br i1 %cond, label %BB.tomerge, label %Succ
|
|
|
|
Exit: ; preds = %Succ
|
|
ret void
|
|
}
|
|
|
|
; This function can be merged
|
|
define void @e() {
|
|
entry:
|
|
br label %BB.tomerge
|
|
|
|
BB.tomerge: ; preds = %Use, %entry
|
|
; This phi is used somewhere else than Succ, but this should not prevent
|
|
; merging this block
|
|
%a = phi i32 [ 1, %entry ], [ 0, %Use ] ; <i32> [#uses=1]
|
|
br label %Succ
|
|
|
|
Succ: ; preds = %BB.tomerge
|
|
%conde = call i1 @foo( ) ; <i1> [#uses=1]
|
|
br i1 %conde, label %Use, label %Exit
|
|
|
|
Use: ; preds = %Succ
|
|
%cond = call i1 @bar( i32 %a ) ; <i1> [#uses=1]
|
|
br i1 %cond, label %BB.tomerge, label %Exit
|
|
|
|
Exit: ; preds = %Use, %Succ
|
|
ret void
|
|
}
|