diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-05-03 13:42:56 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-05-03 13:42:56 +0000 |
| commit | 2c8936fd264239db1438358fc01c83412aa161ed (patch) | |
| tree | 73b1456d7a147dae1b8fa36c20f8dbc2484c4e72 /llvm/lib/Target | |
| parent | 2636460f0e1cb582f3793775efbffdc02bf55d23 (diff) | |
| download | bcm5719-llvm-2c8936fd264239db1438358fc01c83412aa161ed.tar.gz bcm5719-llvm-2c8936fd264239db1438358fc01c83412aa161ed.zip | |
AMDGPU: Fix incorrect commute with sub when folding immediates
When a fold of an immediate into a sub/subrev required shrinking the
instruction, the wrong VOP2 opcode was used. This was using the VOP2
equivalent of the original instruction, not the commuted instruction
with the inverted opcode.
llvm-svn: 359883
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/SIFoldOperands.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp index 75d201245b8..8db2ee21603 100644 --- a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp +++ b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp @@ -372,7 +372,10 @@ static bool tryAddToFoldList(SmallVectorImpl<FoldCandidate> &FoldList, assert(MI->getOperand(1).isDef()); - int Op32 = AMDGPU::getVOPe32(Opc); + // Make sure to get the 32-bit version of the commuted opcode. + unsigned MaybeCommutedOpc = MI->getOpcode(); + int Op32 = AMDGPU::getVOPe32(MaybeCommutedOpc); + FoldList.push_back(FoldCandidate(MI, CommuteOpNo, OpToFold, true, Op32)); return true; |

