[llvm] r241817 - AMDGPU/SI: The SIShrinkInstructions pass should only fold immediates with one use

Tom Stellard thomas.stellard at amd.com
Thu Jul 9 09:30:37 PDT 2015


Author: tstellar
Date: Thu Jul  9 11:30:36 2015
New Revision: 241817

URL: http://llvm.org/viewvc/llvm-project?rev=241817&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/Target/AMDGPU/SIShrinkInstructions.cpp

Modified: llvm/trunk/lib/Target/AMDGPU/SIShrinkInstructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIShrinkInstructions.cpp?rev=241817&r1=241816&r2=241817&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIShrinkInstructions.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIShrinkInstructions.cpp Thu Jul  9 11:30:36 2015
@@ -149,7 +149,7 @@ static void foldImmediates(MachineInstr
     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()) {





More information about the llvm-commits mailing list