Index: llvm/lib/Target/ARM/ARMInstrThumb.td =================================================================== --- llvm/lib/Target/ARM/ARMInstrThumb.td +++ llvm/lib/Target/ARM/ARMInstrThumb.td @@ -592,6 +592,7 @@ [(ARMbrjt tGPR:$target, tjumptable:$jt)]>, Sched<[WriteBrTbl]> { let Size = 2; + let isNotDuplicable = 1; list Predicates = [IsThumb, IsThumb1Only]; } } Index: llvm/test/CodeGen/Thumb/pr42760.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/Thumb/pr42760.ll @@ -0,0 +1,30 @@ +; RUN: llc -tail-dup-placement-threshold=3 < %s +; We only check that this doesn't trigger an error due to duplicated jumptable. + +target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" +target triple = "thumbv6m-none-unknown-eabi" + +define hidden void @test() { +entry: + br label %switch + +switch: ; preds = %bb2, %entry + switch i32 undef, label %dead2 [ + i32 0, label %dead + i32 1, label %bb2 + i32 2, label %dead + i32 3, label %bb + ] + +dead: ; preds = %bb2, %bb, %switch, %switch + unreachable + +dead2: ; preds = %switch + unreachable + +bb: ; preds = %switch + br i1 undef, label %dead, label %bb2 + +bb2: ; preds = %bb, %switch + br i1 undef, label %dead, label %switch +}