mirror of
https://github.com/konsoletyper/teavm.git
synced 2024-11-27 01:30:35 +08:00
Fix bug in GVN that prevented optimizations in same basic block
This commit is contained in:
parent
2414d74002
commit
8ce104ae64
@ -219,8 +219,7 @@ public class GlobalValueNumbering implements MethodOptimization {
|
|||||||
}
|
}
|
||||||
namesCompatible = knownName.isEmpty() || name.isEmpty() || knownName.equals(name);
|
namesCompatible = knownName.isEmpty() || name.isEmpty() || knownName.equals(name);
|
||||||
}
|
}
|
||||||
if (known != null && domTree.dominates(known.location * 2 + 1, currentBlockIndex * 2) && known.value != var
|
if (known != null && dominates(known.location, currentBlockIndex) && known.value != var && namesCompatible) {
|
||||||
&& namesCompatible) {
|
|
||||||
map[var] = known.value;
|
map[var] = known.value;
|
||||||
if (!noReplace) {
|
if (!noReplace) {
|
||||||
replaceMap[var] = known.value;
|
replaceMap[var] = known.value;
|
||||||
@ -242,6 +241,10 @@ public class GlobalValueNumbering implements MethodOptimization {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean dominates(int a, int b) {
|
||||||
|
return a == b || domTree.dominates(a * 2 + 1, b * 2);
|
||||||
|
}
|
||||||
|
|
||||||
private InstructionVisitor constantPreprocessor = new AbstractInstructionVisitor() {
|
private InstructionVisitor constantPreprocessor = new AbstractInstructionVisitor() {
|
||||||
private void setConstant(int index, Number value) {
|
private void setConstant(int index, Number value) {
|
||||||
numericConstants[index] = value;
|
numericConstants[index] = value;
|
||||||
|
Loading…
Reference in New Issue
Block a user