diff options
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCQPXLoadSplat.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCQPXLoadSplat.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCQPXLoadSplat.cpp b/llvm/lib/Target/PowerPC/PPCQPXLoadSplat.cpp index 642b90e616d..816f05f4bf6 100644 --- a/llvm/lib/Target/PowerPC/PPCQPXLoadSplat.cpp +++ b/llvm/lib/Target/PowerPC/PPCQPXLoadSplat.cpp @@ -130,7 +130,15 @@ bool PPCQPXLoadSplat::runOnMachineFunction(MachineFunction &MF) { } } - if (MI->modifiesRegister(SplatReg, TRI)) { + // If this instruction defines the splat register, then we cannot move + // the previous definition above it. If it reads from the splat + // register, then it must already be alive from some previous + // definition, and if the splat register is different from the source + // register, then this definition must not be the load for which we're + // searching. + if (MI->modifiesRegister(SplatReg, TRI) || + (SrcReg != SplatReg && + MI->readsRegister(SplatReg, TRI))) { SI = Splats.erase(SI); continue; } |