Skip to content

Commit 525f9c0

Browse files
committed
[AMDGPU][DPP] Corrected DPP combiner
Added a check to make sure that the selected dpp opcode is supported by target. Reviewers: vpykhtin, arsenm, rampitec Differential Revision: https://reviews.llvm.org/D70402
1 parent 5e0b7df commit 525f9c0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

llvm/lib/Target/AMDGPU/GCNDPPCombine.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ class GCNDPPCombine : public MachineFunctionPass {
104104
AU.setPreservesCFG();
105105
MachineFunctionPass::getAnalysisUsage(AU);
106106
}
107+
108+
private:
109+
int getDPPOp(unsigned Op) const;
107110
};
108111

109112
} // end anonymous namespace
@@ -118,13 +121,13 @@ FunctionPass *llvm::createGCNDPPCombinePass() {
118121
return new GCNDPPCombine();
119122
}
120123

121-
static int getDPPOp(unsigned Op) {
124+
int GCNDPPCombine::getDPPOp(unsigned Op) const {
122125
auto DPP32 = AMDGPU::getDPPOp32(Op);
123-
if (DPP32 != -1)
124-
return DPP32;
125-
126-
auto E32 = AMDGPU::getVOPe32(Op);
127-
return E32 != -1 ? AMDGPU::getDPPOp32(E32) : -1;
126+
if (DPP32 == -1) {
127+
auto E32 = AMDGPU::getVOPe32(Op);
128+
DPP32 = (E32 == -1)? -1 : AMDGPU::getDPPOp32(E32);
129+
}
130+
return (DPP32 == -1 || TII->pseudoToMCOpcode(DPP32) == -1) ? -1 : DPP32;
128131
}
129132

130133
// tracks the register operand definition and returns:

0 commit comments

Comments
 (0)