[PATCH] D65606: [ARM] Fix invalid symbol redefinition due to duplicated jumptable (PR42760)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 12:14:24 PDT 2019


nikic updated this revision to Diff 213109.
nikic added a comment.

Also mark tTBB_JT and tTBH_JT as not duplicable.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65606/new/

https://reviews.llvm.org/D65606

Files:
  llvm/lib/Target/ARM/ARMInstrThumb.td
  llvm/test/CodeGen/Thumb/pr42760.ll


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
+}
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<Predicate> Predicates = [IsThumb, IsThumb1Only];
   }
 }
@@ -1465,7 +1466,7 @@
 // Thumb-1 doesn't have the TBB or TBH instructions, but we can synthesize them
 // and make use of the same compressed jump table format as Thumb-2.
 let Size = 2, isBranch = 1, isTerminator = 1, isBarrier = 1,
-    isIndirectBranch = 1 in {
+    isIndirectBranch = 1, isNotDuplicable = 1 in {
 def tTBB_JT : tPseudoInst<(outs),
         (ins tGPRwithpc:$base, tGPR:$index, i32imm:$jt, i32imm:$pclbl), 0,
          IIC_Br, []>, Sched<[WriteBr]>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65606.213109.patch
Type: text/x-patch
Size: 2039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190802/40f6ab6d/attachment.bin>


More information about the llvm-commits mailing list