[llvm-commits] CVS: llvm/test/Regression/Transforms/SimplifyCFG/UncondBranchToReturn.ll

Chris Lattner lattner at cs.uiuc.edu
Mon Feb 16 00:36:01 PST 2004


Changes in directory llvm/test/Regression/Transforms/SimplifyCFG:

UncondBranchToReturn.ll added (r1.1)

---
Log message:

New testcase, details in the comments


---
Diffs of the changes:  (+32 -0)

Index: llvm/test/Regression/Transforms/SimplifyCFG/UncondBranchToReturn.ll
diff -c /dev/null llvm/test/Regression/Transforms/SimplifyCFG/UncondBranchToReturn.ll:1.1
*** /dev/null	Mon Feb 16 00:35:29 2004
--- llvm/test/Regression/Transforms/SimplifyCFG/UncondBranchToReturn.ll	Mon Feb 16 00:35:19 2004
***************
*** 0 ****
--- 1,32 ----
+ ; The unify-function-exit-nodes pass often makes basic blocks that just contain
+ ; a PHI node and a return.  Make sure the simplify cfg can straighten out this
+ ; important case.  This is basically the most trivial form of tail-duplication.
+ 
+ ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep 'br label'
+ 
+ int %test(bool %B, int %A, int %B) {
+ 	br bool %B, label %T, label %F
+ T:
+ 	br label %ret
+ F:
+ 	br label %ret
+ ret:
+ 	%X = phi int [%A, %F], [%B, %T]
+ 	ret int %X
+ }
+ 
+ ; Make sure it's willing to move unconditional branches to return instructions
+ ; as well, even if the return block is shared and the source blocks are
+ ; non-empty.
+ int %test2(bool %B, int %A, int %B) {
+ 	br bool %B, label %T, label %F
+ T:
+ 	call int %test(bool true, int 5, int 8)
+ 	br label %ret
+ F:
+ 	call int %test(bool true, int 5, int 8)
+ 	br label %ret
+ ret:
+ 	ret int %A
+ }
+ 





More information about the llvm-commits mailing list