8787import jdk .graal .compiler .graph .iterators .NodeIterable ;
8888import jdk .graal .compiler .lir .ConstantValue ;
8989import jdk .graal .compiler .lir .LIRFrameState ;
90+ import jdk .graal .compiler .lir .LIRValueUtil ;
9091import jdk .graal .compiler .lir .Variable ;
9192import jdk .graal .compiler .nodes .AbstractBeginNode ;
9293import jdk .graal .compiler .nodes .AbstractEndNode ;
@@ -224,7 +225,8 @@ public void doBlock(HIRBlock block, StructuredGraph graph, BlockMap<List<Node>>
224225 if (processedBlocks .contains (predecessor )) {
225226 ValueNode phiValue = phiNode .valueAt ((AbstractEndNode ) predecessor .getEndNode ());
226227 LLVMValueRef value ;
227- if (operand (phiValue ) instanceof LLVMPendingSpecialRegisterRead ) {
228+ Value operand = operand (phiValue );
229+ if (LIRValueUtil .isVariable (operand ) && LIRValueUtil .asVariable (operand ) instanceof LLVMPendingSpecialRegisterRead ) {
228230 /*
229231 * The pending read may need to perform instructions to load the
230232 * value, so we put them at the end of the predecessor block
@@ -508,7 +510,7 @@ public void emitInvoke(Invoke i) {
508510
509511 if (nextMemoryAccessNeedsDecompress ) {
510512 computedAddress = builder .buildAddrSpaceCast (computedAddress , builder .objectType (true ));
511- LLVMValueRef heapBase = ((LLVMVariable ) gen .emitReadRegister (ReservedRegisters .singleton ().getHeapBaseRegister (), null )).get ();
513+ LLVMValueRef heapBase = ((LLVMVariable ) LIRValueUtil . asVariable ( gen .emitReadRegister (ReservedRegisters .singleton ().getHeapBaseRegister (), null ) )).get ();
512514 computedAddress = builder .buildUncompress (computedAddress , heapBase , true , compressionShift );
513515 }
514516
@@ -777,14 +779,12 @@ public Value setResult(ValueNode node, Value operand) {
777779 assert kind == ValueKind .Illegal .getPlatformKind ();
778780 llvmOperand = new LLVMVariable (builder .getUndef ());
779781 }
780- } else if (operand instanceof LLVMAddressValue ) {
781- LLVMAddressValue addressValue = (LLVMAddressValue ) operand ;
782+ } else if (operand instanceof LLVMAddressValue addressValue ) {
782783 Value wrappedBase = addressValue .getBase ();
783784 Value index = addressValue .getIndex ();
784785
785- if (wrappedBase instanceof LLVMPendingSpecialRegisterRead ) {
786- LLVMPendingSpecialRegisterRead pendingRead = (LLVMPendingSpecialRegisterRead ) wrappedBase ;
787- if (index != null && index != Value .ILLEGAL ) {
786+ if (LIRValueUtil .isVariable (wrappedBase ) && LIRValueUtil .asVariable (wrappedBase ) instanceof LLVMPendingSpecialRegisterRead pendingRead ) {
787+ if (index != null && !index .equals (Value .ILLEGAL )) {
788788 pendingRead = new LLVMPendingSpecialRegisterRead (pendingRead , LLVMUtils .getVal (addressValue .getIndex ()));
789789 }
790790 llvmOperand = pendingRead ;
@@ -800,7 +800,7 @@ public Value setResult(ValueNode node, Value operand) {
800800 }
801801
802802 LLVMValueRef intermediate ;
803- if (index == null || index == Value .ILLEGAL ) {
803+ if (index == null || index . equals ( Value .ILLEGAL ) ) {
804804 intermediate = base ;
805805 } else {
806806 intermediate = builder .buildGEP (base , LLVMUtils .getVal (index ));
0 commit comments