From 2b2d86178cc8bc4e57a85e544b30e28fb8b615a1 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 9 Jul 2015 16:30:36 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241817 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/AMDGPU/SIShrinkInstructions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Target/AMDGPU/SIShrinkInstructions.cpp b/lib/Target/AMDGPU/SIShrinkInstructions.cpp index 51e72cdb5f9..cb9d7f7c59d 100644 --- a/lib/Target/AMDGPU/SIShrinkInstructions.cpp +++ b/lib/Target/AMDGPU/SIShrinkInstructions.cpp @@ -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()) { -- 2.34.1