[PATCH] D47516: AMDGPU/R600: Make sure functions are 8 byte aligned

Jan Vesely via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 30 00:56:02 PDT 2018


jvesely created this revision.
jvesely added reviewers: arsenm, tstellar.
Herald added subscribers: llvm-commits, t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, kzhuravl.

Control flow instructions need to be 8 byte aligned, and thus functions do as well.
Fixes GPU hangs since r333219:
"AMDGPU: Split R600 AsmPrinter code into its own class"


Repository:
  rL LLVM

https://reviews.llvm.org/D47516

Files:
  lib/Target/AMDGPU/R600AsmPrinter.cpp
  test/CodeGen/AMDGPU/r600.func-alignment.ll


Index: test/CodeGen/AMDGPU/r600.func-alignment.ll
===================================================================
--- /dev/null
+++ test/CodeGen/AMDGPU/r600.func-alignment.ll
@@ -0,0 +1,13 @@
+; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
+; RUN: llc < %s -march=r600 -mcpu=rs880 | FileCheck  %s
+
+; CHECK: .globl test
+; CHECK: .p2align 8
+; CHECK: {{^}}test:
+; CHECK: CF_END
+
+define amdgpu_ps void @test(<4 x float> inreg %reg0) {
+entry:
+  ret void
+}
+
Index: lib/Target/AMDGPU/R600AsmPrinter.cpp
===================================================================
--- lib/Target/AMDGPU/R600AsmPrinter.cpp
+++ lib/Target/AMDGPU/R600AsmPrinter.cpp
@@ -103,6 +103,11 @@
 
 bool R600AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
 
+
+  // All CF instructions need to be 8 byte aligned. Since functions begin
+  // with a CF instruction, they all need to be 8 by aligned.
+  MF.setAlignment(8);
+
   SetupMachineFunction(MF);
 
   MCContext &Context = getObjFileLowering().getContext();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47516.149053.patch
Type: text/x-patch
Size: 1017 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180530/4ca14982/attachment.bin>


More information about the llvm-commits mailing list