[llvm] r334426 - [Hexagon] Late predicate producers cannot be used as dot-new sources

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 11 11:45:53 PDT 2018


Author: kparzysz
Date: Mon Jun 11 11:45:52 2018
New Revision: 334426

URL: http://llvm.org/viewvc/llvm-project?rev=334426&view=rev
Log:
[Hexagon] Late predicate producers cannot be used as dot-new sources

Added:
    llvm/trunk/test/CodeGen/Hexagon/late-pred.ll
Modified:
    llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp

Modified: llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp?rev=334426&r1=334425&r2=334426&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp Mon Jun 11 11:45:52 2018
@@ -3048,10 +3048,29 @@ bool HexagonInstrInfo::predCanBeUsedAsDo
       return false;
   }
 
-  // Hexagon Programmer's Reference says that decbin, memw_locked, and
-  // memd_locked cannot be used as .new as well,
-  // but we don't seem to have these instructions defined.
-  return MI.getOpcode() != Hexagon::A4_tlbmatch;
+  // Instruction that produce late predicate cannot be used as sources of
+  // dot-new.
+  switch (MI.getOpcode()) {
+    case Hexagon::A4_addp_c:
+    case Hexagon::A4_subp_c:
+    case Hexagon::A4_tlbmatch:
+    case Hexagon::A5_ACS:
+    case Hexagon::F2_sfinvsqrta:
+    case Hexagon::F2_sfrecipa:
+    case Hexagon::J2_endloop0:
+    case Hexagon::J2_endloop01:
+    case Hexagon::J2_ploop1si:
+    case Hexagon::J2_ploop1sr:
+    case Hexagon::J2_ploop2si:
+    case Hexagon::J2_ploop2sr:
+    case Hexagon::J2_ploop3si:
+    case Hexagon::J2_ploop3sr:
+    case Hexagon::S2_cabacdecbin:
+    case Hexagon::S2_storew_locked:
+    case Hexagon::S4_stored_locked:
+      return false;
+  }
+  return true;
 }
 
 bool HexagonInstrInfo::PredOpcodeHasJMP_c(unsigned Opcode) const {

Added: llvm/trunk/test/CodeGen/Hexagon/late-pred.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/late-pred.ll?rev=334426&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/late-pred.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/late-pred.ll Mon Jun 11 11:45:52 2018
@@ -0,0 +1,26 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+
+; This generates A4_addp_c, which cannot be used as a dot-new predicate
+; producer (resulting in a crash).
+; CHECK-NOT: p{{[0-3]+}}.new
+
+target triple = "hexagon"
+
+define void @ext4_group_extend() #0 {
+entry:
+  %es.idx.val = load i32, i32* undef, align 4
+  %conv1.i = zext i32 %es.idx.val to i64
+  %or.i = or i64 undef, %conv1.i
+  %add20 = add i64 %or.i, undef
+  %cmp21 = icmp ult i64 %add20, %or.i
+  br i1 %cmp21, label %if.then23, label %if.end24
+
+if.then23:                                        ; preds = %entry
+  unreachable
+
+if.end24:                                         ; preds = %entry
+  unreachable
+}
+
+attributes #0 = { nounwind "target-cpu"="hexagonv65" }
+




More information about the llvm-commits mailing list