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

Chris Lattner lattner at cs.uiuc.edu
Mon Feb 23 23:35:01 PST 2004


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

switch_create.ll added (r1.1)

---
Log message:

The simplifycfg pass should be able to turn stuff like:
  if (X == 4 || X == 7)
and 
  if (X != 4 && X != 7)

into switch instructions.



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

Index: llvm/test/Regression/Transforms/SimplifyCFG/switch_create.ll
diff -c /dev/null llvm/test/Regression/Transforms/SimplifyCFG/switch_create.ll:1.1
*** /dev/null	Mon Feb 23 23:34:55 2004
--- llvm/test/Regression/Transforms/SimplifyCFG/switch_create.ll	Mon Feb 23 23:34:44 2004
***************
*** 0 ****
--- 1,33 ----
+ ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+ 
+ declare void %foo1()
+ declare void %foo2()
+ 
+ void %test1(uint %V) {
+ 	%C1 = seteq uint %V, 4
+ 	%C2 = seteq uint %V, 17
+ 	%CN = or bool %C1, %C2
+ 	br bool %CN, label %T, label %F
+ T:
+ 	call void %foo1()
+ 	ret void
+ F:
+ 	call void %foo2()
+ 	ret void
+ }
+ 
+ 
+ void %test2(int %V) {
+ 	%C1 = setne int %V, 4
+ 	%C2 = setne int %V, 17
+ 	%CN = and bool %C1, %C2
+ 	br bool %CN, label %T, label %F
+ T:
+ 	call void %foo1()
+ 	ret void
+ F:
+ 	call void %foo2()
+ 	ret void
+ }
+ 
+ 





More information about the llvm-commits mailing list