Skip to content

Commit

Permalink
ConstProp: stop pooling inline constants
Browse files Browse the repository at this point in the history
despite conventional wisdom, the robin map is slower than emitting extra nodes.

without multiblock, shaves around 2% off node. with multiblock, a bit less than
1% but still a win.

Signed-off-by: Alyssa Rosenzweig <[email protected]>
  • Loading branch information
alyssarosenzweig committed Sep 5, 2024
1 parent 8fe1e95 commit ec3723e
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions FEXCore/Source/Interface/IR/Passes/ConstProp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,8 @@ class ConstProp final : public FEXCore::IR::Pass {

fextl::unordered_map<uint64_t, Ref> ConstPool;

// Pool inline constant generation. These are typically very small and pool efficiently.
fextl::robin_map<uint64_t, Ref> InlineConstantGen;
Ref CreateInlineConstant(IREmitter* IREmit, uint64_t Constant) {
const auto it = InlineConstantGen.find(Constant);
if (it != InlineConstantGen.end()) {
return it->second;
}
auto Result = InlineConstantGen.insert_or_assign(Constant, IREmit->_InlineConstant(Constant));
return Result.first->second;
return IREmit->_InlineConstant(Constant);
}
bool SupportsTSOImm9 {};
const FEXCore::CPUIDEmu* CPUID;
Expand Down Expand Up @@ -577,8 +570,6 @@ void ConstProp::ConstantPropagation(IREmitter* IREmit, const IRListView& Current
}

void ConstProp::ConstantInlining(IREmitter* IREmit, const IRListView& CurrentIR) {
InlineConstantGen.clear();

for (auto [CodeNode, IROp] : CurrentIR.GetAllCode()) {
switch (IROp->Op) {
case OP_LSHR:
Expand Down

0 comments on commit ec3723e

Please sign in to comment.