Skip to content

Commit 43e6192

Browse files
committed
[GR-61766] IV: add intact API.
PullRequest: graal/19971
2 parents 9421c15 + b6727b6 commit 43e6192

7 files changed

+39
-0
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/loop/BasicInductionVariable.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,10 @@ public String toString(IVToStringVerbosity verbosity) {
222222
public ValueNode entryTripValue() {
223223
return init;
224224
}
225+
226+
@Override
227+
public boolean structuralIntegrityValid() {
228+
return phi.isAlive() && init.isAlive() && rawStride.isAlive() && op.isAlive();
229+
}
230+
225231
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/loop/CountedLoopInfo.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ protected CountedLoopInfo(Loop loop, InductionVariable limitCheckedIV, IfNode if
150150
this.unsigned = unsigned;
151151
}
152152

153+
/**
154+
* See {@link InductionVariable#structuralIntegrityValid()}.
155+
*/
156+
public boolean countedIntegrityValid() {
157+
return limitCheckedIV.structuralIntegrityValid() && limit.isAlive() && body.isAlive() && ifNode.isAlive();
158+
}
159+
153160
/**
154161
* Returns the induction variable compared against the limit node. For a loop like
155162
*

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/loop/DerivedConvertedInductionVariable.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public DerivedConvertedInductionVariable(Loop loop, InductionVariable base, Stam
4141
this.value = value;
4242
}
4343

44+
@Override
45+
public boolean structuralIntegrityValid() {
46+
return super.structuralIntegrityValid() && value.isAlive();
47+
}
48+
4449
@Override
4550
public ValueNode valueNode() {
4651
return value;

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/loop/DerivedInductionVariable.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ public InductionVariable duplicateWithNewInit(ValueNode newInit) {
6262
return copy(newBase, copyValue(newBase, false/* no gvn */));
6363
}
6464

65+
@Override
66+
public boolean structuralIntegrityValid() {
67+
return base.structuralIntegrityValid();
68+
}
69+
6570
public abstract ValueNode copyValue(InductionVariable newBase);
6671

6772
public abstract ValueNode copyValue(InductionVariable newBase, boolean gvn);

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/loop/DerivedOffsetInductionVariable.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ public DerivedOffsetInductionVariable(Loop loop, InductionVariable base, ValueNo
4949
this.value = value;
5050
}
5151

52+
@Override
53+
public boolean structuralIntegrityValid() {
54+
return super.structuralIntegrityValid() && offset.isAlive() && value.isAlive();
55+
}
56+
5257
public ValueNode getOffset() {
5358
return offset;
5459
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/loop/DerivedScaledInductionVariable.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ public DerivedScaledInductionVariable(Loop loop, InductionVariable base, NegateN
5353
this.value = value;
5454
}
5555

56+
@Override
57+
public boolean structuralIntegrityValid() {
58+
return super.structuralIntegrityValid() && scale.isAlive() && value.isAlive();
59+
}
60+
5661
public ValueNode getScale() {
5762
return scale;
5863
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/loop/InductionVariable.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ public enum IVToStringVerbosity {
192192
NUMERIC
193193
}
194194

195+
/**
196+
* Determines if the components of this IV are structurally intact, i.e., part of a graph, not
197+
* deleted etc.
198+
*/
199+
public abstract boolean structuralIntegrityValid();
200+
195201
public abstract String toString(IVToStringVerbosity verbosity);
196202

197203
@Override

0 commit comments

Comments
 (0)