Disable bogus cast elimination when the cast is used by a setcc instruction.

llvm-svn: 17583
This commit is contained in:
Nate Begeman 2004-11-07 20:23:42 +00:00
parent f45ec621cc
commit f5f0b6b6b0
1 changed files with 4 additions and 4 deletions

View File

@ -3163,15 +3163,15 @@ void PPC32ISel::visitCastInst(CastInst &CI) {
// emit them, as the store instruction will implicitly not store the zero or // emit them, as the store instruction will implicitly not store the zero or
// sign extended bytes. // sign extended bytes.
if (SrcClass <= cInt && SrcClass >= DestClass) { if (SrcClass <= cInt && SrcClass >= DestClass) {
bool AllUsesAreStoresOrSetCC = true; bool AllUsesAreStores = true;
for (Value::use_iterator I = CI.use_begin(), E = CI.use_end(); I != E; ++I) for (Value::use_iterator I = CI.use_begin(), E = CI.use_end(); I != E; ++I)
if (!isa<StoreInst>(*I) && !isa<SetCondInst>(*I)) { if (!isa<StoreInst>(*I)) {
AllUsesAreStoresOrSetCC = false; AllUsesAreStores = false;
break; break;
} }
// Turn this cast directly into a move instruction, which the register // Turn this cast directly into a move instruction, which the register
// allocator will deal with. // allocator will deal with.
if (AllUsesAreStoresOrSetCC) { if (AllUsesAreStores) {
unsigned SrcReg = getReg(Op, BB, MI); unsigned SrcReg = getReg(Op, BB, MI);
BuildMI(*BB, MI, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg); BuildMI(*BB, MI, PPC::OR, 2, DestReg).addReg(SrcReg).addReg(SrcReg);
return; return;