AMDGPU/SI: The SIShrinkInstructions pass should only fold immediates with one use

This is convered by existing testcases and will be exposed by a future
commit.

llvm-svn: 241817
This commit is contained in:
Tom Stellard 2015-07-09 16:30:36 +00:00
parent 9ebf7ca2f0
commit ab6e9c0f94
1 changed files with 1 additions and 1 deletions

View File

@ -149,7 +149,7 @@ static void foldImmediates(MachineInstr &MI, const SIInstrInfo *TII,
return;
// Try to fold Src0
if (Src0.isReg()) {
if (Src0.isReg() && MRI.hasOneUse(Src0.getReg())) {
unsigned Reg = Src0.getReg();
MachineInstr *Def = MRI.getUniqueVRegDef(Reg);
if (Def && Def->isMoveImmediate()) {