[llvm] r257590 - AMDGPU/SI: Fix a bug in SIFoldOperands
Marek Olsak via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 13 03:44:29 PST 2016
Author: mareko
Date: Wed Jan 13 05:44:29 2016
New Revision: 257590
URL: http://llvm.org/viewvc/llvm-project?rev=257590&view=rev
Log:
AMDGPU/SI: Fix a bug in SIFoldOperands
Summary: ret.ll will contain a test for this
Reviewers: tstellarAMD, arsenm
Subscribers: arsenm
Differential Revision: http://reviews.llvm.org/D16029
Modified:
llvm/trunk/lib/Target/AMDGPU/SIFoldOperands.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/SIFoldOperands.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIFoldOperands.cpp?rev=257590&r1=257589&r2=257590&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIFoldOperands.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIFoldOperands.cpp Wed Jan 13 05:44:29 2016
@@ -338,6 +338,17 @@ bool SIFoldOperands::runOnMachineFunctio
!TargetRegisterInfo::isVirtualRegister(OpToFold.getReg()))
continue;
+ // Prevent folding operands backwards in the function. For example,
+ // the COPY opcode must not be replaced by 1 in this example:
+ //
+ // %vreg3<def> = COPY %VGPR0; VGPR_32:%vreg3
+ // ...
+ // %VGPR0<def> = V_MOV_B32_e32 1, %EXEC<imp-use>
+ MachineOperand &Dst = MI.getOperand(0);
+ if (Dst.isReg() &&
+ !TargetRegisterInfo::isVirtualRegister(Dst.getReg()))
+ continue;
+
// We need mutate the operands of new mov instructions to add implicit
// uses of EXEC, but adding them invalidates the use_iterator, so defer
// this.
More information about the llvm-commits
mailing list