[ARM] Enable shrink-wrapping by default.
[oota-llvm.git] / test / CodeGen / Thumb2 / thumb2-jtb.ll
index 7d093ecce201af820aba8a923ad492309bf0da61..ce7fb9f10fecc512cfc7a9a83ef4a59a761ad11f 100644 (file)
@@ -1,13 +1,27 @@
-; RUN: llc < %s -march=thumb -mattr=+thumb2 | not grep tbb
+; RUN: llc -mtriple=thumb-eabi -mcpu=arm1156t2-s -mattr=+thumb2 -arm-adjust-jump-tables=0 %s -o - | FileCheck %s
 
 ; Do not use tbb / tbh if any destination is before the jumptable.
 ; rdar://7102917
 
-define i16 @main__getopt_internal_2E_exit_2E_ce(i32) nounwind {
+define i16 @main__getopt_internal_2E_exit_2E_ce(i32, i1 %b) nounwind {
+; CHECK: main__getopt_internal_2E_exit_2E_ce
+; CHECK-NOT: tbb
+; CHECK-NOT: tbh
+; 32-bit jump tables use explicit branches, not data regions, so make sure
+; we don't annotate this region.
+; CHECK-NOT: data_region
+entry:
+  br i1 %b, label %codeRepl127.exitStub, label %newFuncRoot
+
 newFuncRoot:
        br label %_getopt_internal.exit.ce
 
 codeRepl127.exitStub:          ; preds = %_getopt_internal.exit.ce
+  ; Add an explicit edge back to before the jump table to ensure this block
+  ; is placed first.
+  br i1 %b, label %newFuncRoot, label %codeRepl127.exitStub.exit
+
+codeRepl127.exitStub.exit:
        ret i16 0
 
 parse_options.exit.loopexit.exitStub:          ; preds = %_getopt_internal.exit.ce