[PATCH] D44871: [CodeGen] Fixed unreachable with -print-machineinstrs and custom pseudo source value

Tim Renouf via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 27 14:18:41 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL328668: [CodeGen] Fixed unreachable with -print-machineinstrs and custom pseudo sourceā€¦ (authored by tpr, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D44871?vs=139721&id=140001#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D44871

Files:
  llvm/trunk/lib/CodeGen/MachineOperand.cpp
  llvm/trunk/test/CodeGen/AMDGPU/print-mir-custom-pseudo.ll


Index: llvm/trunk/test/CodeGen/AMDGPU/print-mir-custom-pseudo.ll
===================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/print-mir-custom-pseudo.ll
+++ llvm/trunk/test/CodeGen/AMDGPU/print-mir-custom-pseudo.ll
@@ -0,0 +1,17 @@
+; RUN: llc -mtriple=amdgcn--amdpal -mcpu=fiji -print-after=isel -verify-machineinstrs < %s 2>&1 | FileCheck -check-prefix=SI %s
+
+; This checks that the -print-after of MIR containing a target custom pseudo
+; value works correctly.
+
+; SI: TargetCustom
+
+target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-A5"
+target triple = "amdgcn--amdpal"
+
+define dllexport amdgpu_ps <2 x float> @_amdgpu_ps_main(i32 inreg, i32 inreg, i32 inreg, i32 inreg, <2 x float>, <2 x float>, <2 x float>, <3 x float>, <2 x float>, <2 x float>, <2 x float>, float, float, float, float, float, i32, i32, i32, i32) local_unnamed_addr {
+.entry:
+  %res = call <2 x float> @llvm.amdgcn.image.sample.l.v2f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 3, i1 false, i1 false, i1 false, i1 false, i1 false)
+  ret <2 x float> %res
+}
+
+declare <2 x float> @llvm.amdgcn.image.sample.l.v2f32.v4f32.v8i32(<4 x float>, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1)
Index: llvm/trunk/lib/CodeGen/MachineOperand.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/MachineOperand.cpp
+++ llvm/trunk/lib/CodeGen/MachineOperand.cpp
@@ -1100,7 +1100,12 @@
           OS, cast<ExternalSymbolPseudoSourceValue>(PVal)->getSymbol());
       break;
     case PseudoSourceValue::TargetCustom:
-      llvm_unreachable("TargetCustom pseudo source values are not supported");
+      // FIXME: This is not necessarily the correct MIR serialization format for
+      // a custom pseudo source value, but at least it allows
+      // -print-machineinstrs to work on a target with custom pseudo source
+      // values.
+      OS << "custom ";
+      PVal->printCustom(OS);
       break;
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44871.140001.patch
Type: text/x-patch
Size: 2137 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180327/1ed08650/attachment.bin>


More information about the llvm-commits mailing list