[PATCH] D111549: [AMDGPU] Fix copying a machine operand
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 11 07:15:54 PDT 2021
foad created this revision.
foad added reviewers: arsenm, rampitec.
Herald added subscribers: kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
foad requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
Without this I get:
- Bad machine code: Instruction has operand with wrong parent set ***
- function: available_externally_test
- basic block: %bb.0 (0x7dad598)
- instruction: %0:r600_treg32_x = MOV 1, 0, 0, 0, $alu_literal_x, 0, 0, 0, -1, 1, $pred_sel_off, @available_externally, 0
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D111549
Files:
llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
llvm/test/CodeGen/AMDGPU/global-constant.ll
Index: llvm/test/CodeGen/AMDGPU/global-constant.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/global-constant.ll
+++ llvm/test/CodeGen/AMDGPU/global-constant.ll
@@ -2,7 +2,7 @@
; RUN: llc -mtriple=amdgcn-- -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
-; RUN: llc -mtriple=r600-- -mcpu=cypress < %s | FileCheck -check-prefix=R600 %s
+; RUN: llc -mtriple=r600-- -mcpu=cypress -verify-machineinstrs < %s | FileCheck -check-prefix=R600 %s
@private1 = private unnamed_addr addrspace(4) constant [4 x float] [float 0.0, float 1.0, float 2.0, float 3.0]
@private2 = private unnamed_addr addrspace(4) constant [4 x float] [float 4.0, float 5.0, float 6.0, float 7.0]
Index: llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
+++ llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
@@ -336,7 +336,9 @@
*BB, MI, R600::MOV, MI.getOperand(0).getReg(), R600::ALU_LITERAL_X);
int Idx = TII->getOperandIdx(*MIB, R600::OpName::literal);
//TODO: Ugh this is rather ugly
- MIB->getOperand(Idx) = MI.getOperand(1);
+ const MachineOperand &MO = MI.getOperand(1);
+ MIB->getOperand(Idx).ChangeToGA(MO.getGlobal(), MO.getOffset(),
+ MO.getTargetFlags());
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111549.378657.patch
Type: text/x-patch
Size: 1625 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211011/7893f737/attachment.bin>
More information about the llvm-commits
mailing list