[Hexagon] Make sure duplexed dealloc_returns are checked for double jumps
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Tue, 2 May 2017 18:03:08 +0000 (18:03 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Tue, 2 May 2017 18:03:08 +0000 (18:03 +0000)
Patch by Colin LeMahieu.

llvm-svn: 301951

llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp
llvm/test/MC/Hexagon/dealloc-return-jump.s [new file with mode: 0644]

index 4844862..2a3af20 100644 (file)
@@ -336,6 +336,14 @@ bool HexagonShuffler::check() {
         ++jumps;
         foundBranches.push_back(ISJ);
       }
+      if (HexagonMCInstrInfo::getDesc(MCII, Inst0).isReturn()) {
+        ++deallocs, ++jumps, ++jump1; // DEALLOC_RETURN is of type LD.
+        foundBranches.push_back(ISJ);
+      }
+      if (HexagonMCInstrInfo::getDesc(MCII, Inst1).isReturn()) {
+        ++deallocs, ++jumps, ++jump1; // DEALLOC_RETURN is of type LD.
+        foundBranches.push_back(ISJ);
+      }
       break;
     }
     }
diff --git a/llvm/test/MC/Hexagon/dealloc-return-jump.s b/llvm/test/MC/Hexagon/dealloc-return-jump.s
new file mode 100644 (file)
index 0000000..0d480be
--- /dev/null
@@ -0,0 +1,7 @@
+# RUN: not llvm-mc -arch=hexagon -mcpu=hexagonv62 -filetype=obj -o - %s
+# Check that a duplex involving dealloc_return is correctly checked
+# dealloc_return cannot be involved in a double jump packet
+
+{ r0=add(r0,#-1)
+  p0=cmp.eq(r0,r0); if (p0.new) jump:nt 0
+  if (p0) dealloc_return }