mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 937540 part 3 - Use placement new for GVN ValueNumberData. r=mjrosenb
This commit is contained in:
parent
5e64da9a8a
commit
36fd8f30f8
@ -20,6 +20,12 @@ ValueNumberer::ValueNumberer(MIRGenerator *mir, MIRGraph &graph, bool optimistic
|
||||
count_(0)
|
||||
{ }
|
||||
|
||||
TempAllocator &
|
||||
ValueNumberer::alloc() const
|
||||
{
|
||||
return mir->temp();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ValueNumberer::lookupValue(MDefinition *ins)
|
||||
{
|
||||
@ -51,7 +57,7 @@ ValueNumberer::simplify(MDefinition *def, bool useValueNumbers)
|
||||
|
||||
// ensure this instruction has a VN
|
||||
if (!ins->valueNumberData())
|
||||
ins->setValueNumberData(new ValueNumberData);
|
||||
ins->setValueNumberData(new(alloc()) ValueNumberData);
|
||||
if (!ins->block()) {
|
||||
// In this case, we made a new def by constant folding, for
|
||||
// example, we replaced add(#3,#4) with a new const(#7) node.
|
||||
@ -83,7 +89,7 @@ ValueNumberer::simplifyControlInstruction(MControlInstruction *def)
|
||||
|
||||
// Ensure this instruction has a value number.
|
||||
if (!repl->valueNumberData())
|
||||
repl->setValueNumberData(new ValueNumberData);
|
||||
repl->setValueNumberData(new(alloc()) ValueNumberData);
|
||||
|
||||
MBasicBlock *block = def->block();
|
||||
|
||||
@ -177,9 +183,9 @@ ValueNumberer::computeValueNumbers()
|
||||
if (mir->shouldCancel("Value Numbering (preparation loop"))
|
||||
return false;
|
||||
for (MDefinitionIterator iter(*block); iter; iter++)
|
||||
iter->setValueNumberData(new ValueNumberData);
|
||||
iter->setValueNumberData(new(alloc()) ValueNumberData);
|
||||
MControlInstruction *jump = block->lastIns();
|
||||
jump->setValueNumberData(new ValueNumberData);
|
||||
jump->setValueNumberData(new(alloc()) ValueNumberData);
|
||||
}
|
||||
|
||||
// Assign unique value numbers if pessimistic.
|
||||
|
@ -50,6 +50,7 @@ class ValueNumberer
|
||||
IonAllocPolicy> InstructionMap;
|
||||
|
||||
protected:
|
||||
TempAllocator &alloc() const;
|
||||
uint32_t lookupValue(MDefinition *ins);
|
||||
MDefinition *findDominatingDef(InstructionMap &defs, MDefinition *ins, size_t index);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user