Skip to content

Commit

Permalink
[GR-61469] Fixes for LLVM backend.
Browse files Browse the repository at this point in the history
PullRequest: graal/19844
  • Loading branch information
davleopo committed Jan 22, 2025
2 parents 9bd367e + 1cec7e2 commit b7ce3fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
import jdk.graal.compiler.replacements.nodes.CStringConstant;
import jdk.graal.compiler.replacements.nodes.ExplodeLoopNode;
import jdk.graal.compiler.replacements.nodes.FallbackInvokeWithExceptionNode;
import jdk.graal.compiler.replacements.nodes.LateLoweredNode;
import jdk.graal.compiler.replacements.nodes.LoadSnippetVarargParameterNode;
import jdk.graal.compiler.replacements.nodes.MacroWithExceptionNode;
import jdk.graal.compiler.util.CollectionsUtil;
Expand Down Expand Up @@ -2863,9 +2864,11 @@ private void rewireFrameStatesAfterFSA(ValueNode replacee, UnmodifiableEconomicM
} else if (stateAfter != null) {
deoptDupDuring.computeStateDuring(stateAfter);
} else if (stateBefore != null) {
boolean guarantee = ((DeoptBefore) replaceeDeopt).canUseAsStateDuring() || !deoptDupDuring.hasSideEffect();
GraalError.guarantee(guarantee, "Can't use stateBefore as stateDuring for state split %s",
deoptDupDuring);
// late lowered nodes are before,during and after deopts to allow maximum
// versatility, verification is disabled for them
boolean guarantee = ((DeoptBefore) replaceeDeopt).canUseAsStateDuring() || !deoptDupDuring.hasSideEffect() || deoptDup instanceof LateLoweredNode;
GraalError.guarantee(guarantee, "Can't use stateBefore as stateDuring for state split %s. Replacee is %s",
deoptDupDuring, replacee);
deoptDupDuring.setStateDuring(stateBefore);
} else {
throw GraalError.shouldNotReachHere("No stateDuring assigned."); // ExcludeFromJacocoGeneratedReport
Expand All @@ -2876,7 +2879,9 @@ private void rewireFrameStatesAfterFSA(ValueNode replacee, UnmodifiableEconomicM
if (stateAfter != null) {
deoptDupAfter.setStateAfter(stateAfter);
} else {
boolean guarantee = stateBefore != null && !deoptDupAfter.hasSideEffect();
// late lowered nodes are before,during and after deopts to allow maximum
// versatility, verification is disabled for them
boolean guarantee = stateBefore != null && !deoptDupAfter.hasSideEffect() || deoptDup instanceof LateLoweredNode;
GraalError.guarantee(guarantee, "Can't use stateBefore as stateAfter for state split %s", deoptDupAfter);
deoptDupAfter.setStateAfter(stateBefore);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void run() {

private static void registerIntegerLongPlugins(InvocationPlugins plugins, JavaKind kind, Replacements replacements) {
Class<?> declaringClass = kind.toBoxedJavaClass();
Registration r = new Registration(plugins, declaringClass, replacements);
Registration r = new Registration(plugins, declaringClass, replacements).setAllowOverwrite(true);
registerUnaryLLVMIntrinsic(r, "numberOfLeadingZeros", LLVMIntrinsicOperation.CTLZ, JavaKind.Int, kind.toJavaClass());
registerUnaryLLVMIntrinsic(r, "numberOfTrailingZeros", LLVMIntrinsicOperation.CTTZ, JavaKind.Int, kind.toJavaClass());
r.register(new InvocationPlugin("bitCount", kind.toJavaClass()) {
Expand Down

0 comments on commit b7ce3fe

Please sign in to comment.