ssa: simplifies initializeCurrentBlockKnownBounds (#2263)

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
This commit is contained in:
Takeshi Yoneda
2024-06-23 13:43:45 -07:00
committed by GitHub
parent 98d6b90da2
commit 78f2e9395e

View File

@@ -275,7 +275,7 @@ func (c *Compiler) LowerToSSA() {
builder.DefineVariable(variable, value, entryBlock)
c.setWasmLocalVariable(wasm.Index(i), variable)
}
c.declareWasmLocals(entryBlock)
c.declareWasmLocals()
c.declareNecessaryVariables()
c.lowerBody(entryBlock)
@@ -295,7 +295,7 @@ func (c *Compiler) setWasmLocalVariable(index wasm.Index, variable ssa.Variable)
}
// declareWasmLocals declares the SSA variables for the Wasm locals.
func (c *Compiler) declareWasmLocals(entry ssa.BasicBlock) {
func (c *Compiler) declareWasmLocals() {
localCount := wasm.Index(len(c.wasmFunctionTyp.Params))
for i, typ := range c.wasmFunctionLocalTypes {
st := WasmTypeToSSAType(typ)
@@ -543,11 +543,11 @@ func (c *Compiler) initializeCurrentBlockKnownBounds() {
cb := &c.bounds[i][c.pointers[i]]
if cb.id != smallestID {
same = false
break
} else {
if cb.bound < minBound {
minBound = cb.bound
}
c.pointers[i]++
}
}
@@ -555,14 +555,6 @@ func (c *Compiler) initializeCurrentBlockKnownBounds() {
// Absolute address cannot be used in the intersection since the value might be only defined in one of the predecessors.
c.recordKnownSafeBound(smallestID, minBound, ssa.ValueInvalid)
}
// Move pointer(s) for the smallest ID forward (if same, move all).
for i := 0; i < preds; i++ {
cb := &c.bounds[i][c.pointers[i]]
if cb.id == smallestID {
c.pointers[i]++
}
}
}
}
}