[PATCH] D32250: [Thumb-1] Fix corner cases for compressed jump tables

Weiming Zhao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 20 11:44:25 PDT 2017


weimingz updated this revision to Diff 95996.
weimingz added a comment.

Just find that one case was fixed by r297871 ARM: avoid clobbering register in v6 jump-table expansion.


https://reviews.llvm.org/D32250

Files:
  lib/Target/ARM/ARMConstantIslandPass.cpp


Index: lib/Target/ARM/ARMConstantIslandPass.cpp
===================================================================
--- lib/Target/ARM/ARMConstantIslandPass.cpp
+++ lib/Target/ARM/ARMConstantIslandPass.cpp
@@ -2158,6 +2158,15 @@
 
       // If we're in PIC mode, there should be another ADD following.
       auto *TRI = STI->getRegisterInfo();
+
+      // %base cannot be redefined after the load as it will appear before
+      // TBB/TBH like:
+      //      %base =
+      //      %base =
+      //      tBB %base, %idx
+      if (registerDefinedBetween(BaseReg, Load->getNextNode(), MBB->end(), TRI))
+        continue;
+
       if (isPositionIndependentOrROPI) {
         MachineInstr *Add = Load->getNextNode();
         if (Add->getOpcode() != ARM::tADDrr ||


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32250.95996.patch
Type: text/x-patch
Size: 767 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170420/f8ba4593/attachment.bin>


More information about the llvm-commits mailing list