aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2015-07-09 16:30:36 +0000
committerTom Stellard <thomas.stellard@amd.com>2015-07-09 16:30:36 +0000
commitab6e9c0f94a016a405cdc9051d8800756221c46f (patch)
tree542b227e1c182cd03257aa97f1a4b8f5607ae5d6 /llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
parent9ebf7ca2f0665e2c88447179d8af9a0065a40d88 (diff)
downloadllvm-ab6e9c0f94a016a405cdc9051d8800756221c46f.zip
llvm-ab6e9c0f94a016a405cdc9051d8800756221c46f.tar.gz
llvm-ab6e9c0f94a016a405cdc9051d8800756221c46f.tar.bz2
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
Diffstat (limited to 'llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp')
-rw-r--r--llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp b/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
index 51e72cd..cb9d7f7 100644
--- a/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
+++ b/llvm/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()) {