< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/constopt/ConstantLoadOptimization.java

Print this page
rev 52509 : [mq]: graal

*** 63,74 **** import jdk.vm.ci.meta.Value; import jdk.vm.ci.meta.ValueKind; /** * This optimization tries to improve the handling of constants by replacing a single definition of ! * a constant, which is potentially scheduled into a block with high probability, with one or more ! * definitions in blocks with a lower probability. */ public final class ConstantLoadOptimization extends PreAllocationOptimizationPhase { public static class Options { // @formatter:off --- 63,74 ---- import jdk.vm.ci.meta.Value; import jdk.vm.ci.meta.ValueKind; /** * This optimization tries to improve the handling of constants by replacing a single definition of ! * a constant, which is potentially scheduled into a block with high frequency, with one or more ! * definitions in blocks with a lower frequency. */ public final class ConstantLoadOptimization extends PreAllocationOptimizationPhase { public static class Options { // @formatter:off
*** 269,285 **** NodeCost cost = ConstantTreeAnalyzer.analyze(debug, constTree, tree.getBlock()); int usageCount = cost.getUsages().size(); assert usageCount == tree.usageCount() : "Usage count differs: " + usageCount + " vs. " + tree.usageCount(); if (debug.isLogEnabled()) { ! try (Indent i = debug.logAndIndent("Variable: %s, Block: %s, prob.: %f", tree.getVariable(), tree.getBlock(), tree.getBlock().probability())) { debug.log("Usages result: %s", cost); } } ! if (cost.getNumMaterializations() > 1 || cost.getBestCost() < tree.getBlock().probability()) { try (DebugContext.Scope s = debug.scope("CLOmodify", constTree); Indent i = debug.logAndIndent("Replacing %s = %s", tree.getVariable(), tree.getConstant().toValueString())) { // mark original load for removal deleteInstruction(tree); constantsOptimized.increment(debug); --- 269,285 ---- NodeCost cost = ConstantTreeAnalyzer.analyze(debug, constTree, tree.getBlock()); int usageCount = cost.getUsages().size(); assert usageCount == tree.usageCount() : "Usage count differs: " + usageCount + " vs. " + tree.usageCount(); if (debug.isLogEnabled()) { ! try (Indent i = debug.logAndIndent("Variable: %s, Block: %s, freq.: %f", tree.getVariable(), tree.getBlock(), tree.getBlock().getRelativeFrequency())) { debug.log("Usages result: %s", cost); } } ! if (cost.getNumMaterializations() > 1 || cost.getBestCost() < tree.getBlock().getRelativeFrequency()) { try (DebugContext.Scope s = debug.scope("CLOmodify", constTree); Indent i = debug.logAndIndent("Replacing %s = %s", tree.getVariable(), tree.getConstant().toValueString())) { // mark original load for removal deleteInstruction(tree); constantsOptimized.increment(debug);
< prev index next >