[llvm-commits] CVS: llvm/test/Regression/Transforms/LICM/2003-08-04-TrappingInstHoist.ll 2003-08-04-TrappingInstOkHoist.ll

Tanya Brethour tbrethou at niobe.cs.uiuc.edu
Tue Aug 5 13:53:01 PDT 2003


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

2003-08-04-TrappingInstHoist.ll added (r1.1)
2003-08-04-TrappingInstOkHoist.ll added (r1.1)

---
Log message:

Added LICM test cases to:

1) Check that trapping instructionns that are not guaranteed to execute are not hoisted.
2) Check that trapping instructions that are guaranteed to execute are hoisted.



---
Diffs of the changes:

Index: llvm/test/Regression/Transforms/LICM/2003-08-04-TrappingInstHoist.ll
diff -c /dev/null llvm/test/Regression/Transforms/LICM/2003-08-04-TrappingInstHoist.ll:1.1
*** /dev/null	Tue Aug  5 13:52:52 2003
--- llvm/test/Regression/Transforms/LICM/2003-08-04-TrappingInstHoist.ll	Tue Aug  5 13:52:42 2003
***************
*** 0 ****
--- 1,27 ----
+ ; This testcase tests for a problem where LICM hoists 
+ ; potentially trapping instructions when they are not guaranteed to execute.
+ ;
+ ; RUN: as < %s | opt -licm | dis | grep -C 2 "IfUnEqual" | grep div 
+ 
+ %X = global int 0
+ declare void %foo()
+ 
+ int %test(bool %c) {
+ 	%A = load int *%X
+ 	br label %Loop
+ Loop:
+ 	call void %foo()
+         br bool %c, label %LoopTail, label %IfUnEqual
+ 
+ IfUnEqual:
+ 	%B1 = div int 4, %A  ;; Should not hoist this div!
+ 	br label %LoopTail
+ 
+ LoopTail:
+         %B = phi int [ 0, %Loop ], [ %B1, %IfUnEqual] 
+         br bool %c, label %Loop, label %Out
+ 
+ Out:
+ 	%C = sub int %A, %B
+ 	ret int %C
+ }


Index: llvm/test/Regression/Transforms/LICM/2003-08-04-TrappingInstOkHoist.ll
diff -c /dev/null llvm/test/Regression/Transforms/LICM/2003-08-04-TrappingInstOkHoist.ll:1.1
*** /dev/null	Tue Aug  5 13:52:52 2003
--- llvm/test/Regression/Transforms/LICM/2003-08-04-TrappingInstOkHoist.ll	Tue Aug  5 13:52:42 2003
***************
*** 0 ****
--- 1,20 ----
+ ; This testcase tests to make sure a trapping instruction is hoisted when
+ ; it is guaranteed to execute.
+ ;
+ ; RUN: as < %s | opt -licm | dis | grep -C 2 "test" | grep div
+ 
+ %X = global int 0
+ declare void %foo()
+ 
+ int %test(bool %c) {
+ 	%A = load int *%X
+ 	br label %Loop
+ Loop:
+ 	call void %foo()
+ 	%B = div int 4, %A  ;; Should have hoisted this div!
+         br bool %c, label %Loop, label %Out
+ 
+ Out:
+ 	%C = sub int %A, %B
+ 	ret int %C
+ }





More information about the llvm-commits mailing list