Commit c08060c6 authored by Julia Koval's avatar Julia Koval

Fix ConstantCoalescing spawning add with 0

Change-Id: Iecf334054f9b907199662e9c0994ddd606f4776d
parent dd76bf44
......@@ -1348,12 +1348,20 @@ void ConstantCoalescing::AdjustChunk( BufChunk *cov_chunk, uint start_adj, uint
}
else
{
Value *eac = cast<Instruction>(addr_ptr)->getOperand(0);
assert(isa<Instruction>(eac));
assert(cast<Instruction>(eac)->getOpcode() == Instruction::Add ||
cast<Instruction>(eac)->getOpcode() == Instruction::Or);
Value *cv_start = ConstantInt::get(irBuilder->getInt32Ty(), cov_chunk->chunkStart << 2);
cast<Instruction>(eac)->setOperand(1, cv_start);
Value *op = cast<Instruction>(addr_ptr)->getOperand(0);
assert(isa<Instruction>(op));
Instruction* eac = cast<Instruction>(op);
assert(eac->getOpcode() == Instruction::Add ||
eac->getOpcode() == Instruction::Or);
ConstantInt *cv_start = ConstantInt::get(irBuilder->getInt32Ty(), cov_chunk->chunkStart << 2);
if (cv_start->isZero())
{
cast<Instruction>(addr_ptr)->setOperand(0, eac->getOperand(0));
}
else
{
eac->setOperand(1, cv_start);
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment