summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/switch.ll
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2015-05-08 21:23:39 +0000
committerHans Wennborg <hans@hanshq.net>2015-05-08 21:23:39 +0000
commitae0254dabca242f69e2d534097df84f810c7a2d0 (patch)
tree210f5f4db45bcd4baa5a6efb4b587e12fd26fbdb /llvm/test/CodeGen/X86/switch.ll
parentc67979bf4d301654e3863d0e3adc3f6a3d5bba29 (diff)
downloadbcm5719-llvm-ae0254dabca242f69e2d534097df84f810c7a2d0.tar.gz
bcm5719-llvm-ae0254dabca242f69e2d534097df84f810c7a2d0.zip
Switch lowering: cluster adjacent fall-through cases even at -O0
It's cheap to do, and codegen is much faster if cases can be merged into clusters. llvm-svn: 236905
Diffstat (limited to 'llvm/test/CodeGen/X86/switch.ll')
-rw-r--r--llvm/test/CodeGen/X86/switch.ll15
1 files changed, 12 insertions, 3 deletions
diff --git a/llvm/test/CodeGen/X86/switch.ll b/llvm/test/CodeGen/X86/switch.ll
index d50eabaa261..66a739c8470 100644
--- a/llvm/test/CodeGen/X86/switch.ll
+++ b/llvm/test/CodeGen/X86/switch.ll
@@ -9,18 +9,19 @@ entry:
i32 3, label %bb0
i32 1, label %bb1
i32 4, label %bb1
- i32 5, label %bb0
+ i32 5, label %bb2
]
bb0: tail call void @g(i32 0) br label %return
bb1: tail call void @g(i32 1) br label %return
+bb2: tail call void @g(i32 1) br label %return
return: ret void
; Should be lowered as straight compares in -O0 mode.
; NOOPT-LABEL: basic
-; NOOPT: subl $3, %eax
-; NOOPT: je
; NOOPT: subl $1, %eax
; NOOPT: je
+; NOOPT: subl $3, %eax
+; NOOPT: je
; NOOPT: subl $4, %eax
; NOOPT: je
; NOOPT: subl $5, %eax
@@ -58,6 +59,14 @@ return: ret void
; CHECK: jae
; CHECK: cmpl $3
; CHECK: ja
+
+; We do this even at -O0, because it's cheap and makes codegen faster.
+; NOOPT-LABEL: simple_ranges
+; NOOPT: subl $4
+; NOOPT: jb
+; NOOPT: addl $-100
+; NOOPT: subl $4
+; NOOPT: jb
}
OpenPOWER on IntegriCloud