clean up vector phi node analysis
@@ -816,16 +816,24 @@ public class OCLNodeLIRBuilder extends NodeLIRBuilder {
}
}
- public Value operandForPhi(ValuePhiNode phi) {
- Value result = operand(phi);
- if (result == null) {
+ private static class MetaPhiVectorType {
+ boolean vectorPhiNode = true;
+ LIRKind valuePhi = null;
+ public MetaPhiVectorType(boolean vectorPhiNode, LIRKind valuePhi) {
+ super();
+ this.vectorPhiNode = vectorPhiNode;
+ this.valuePhi = valuePhi;
+ }
+
+ }
+
+ private MetaPhiVectorType obtainVectorTypePhiNode(ValuePhiNode phi) {
// Check first for vector types
NodeInputList<ValueNode> values = phi.values();
boolean vectorPhiNode = true;
LIRKind valuePhi = null;
-
Set<ValueNode> visited = new HashSet<>();
ArrayDeque<ValueNode> queue = new ArrayDeque<>();
for (ValueNode value: values) {
@@ -854,14 +862,22 @@ public class OCLNodeLIRBuilder extends NodeLIRBuilder {
vectorPhiNode &= false;
}
}
+ return new MetaPhiVectorType(vectorPhiNode, valuePhi);
+ }
+
+ public Value operandForPhi(ValuePhiNode phi) {
+ Value result = operand(phi);
+ if (result == null) {
+
+ MetaPhiVectorType meta = obtainVectorTypePhiNode(phi);
/* Allocate a variable for a PHI node. If the variable is a phi
* node for VectorType, then the KIND is set to the vector type,
* otherwise it inspects the stamp (JavaKind).
*/
Variable newOperand = null;
- if (vectorPhiNode) {
- newOperand = gen.newVariable(valuePhi);
+ if (meta.vectorPhiNode) {
+ newOperand = gen.newVariable(meta.valuePhi);
} else {
newOperand = gen.newVariable(getPhiKind(phi));
}
