Fixed a bug, which allowed only usage of phi notes with exactly 2 uses.
(There may be more than 2 uses in a phi note.)
This commit is contained in:
parent
7d7e236fd6
commit
381cf2d2f1
|
@ -43,7 +43,7 @@ import com.ibm.wala.analysis.arraybounds.hypergraph.weight.edgeweights.EdgeWeigh
|
|||
* <ul>
|
||||
* <li>handling of constants (see
|
||||
* {@link ArrayBoundsGraph#addConstant(Integer, Integer)})
|
||||
* <li>pi nodes (see {@link ArrayBoundsGraph#addPhi(Integer, Integer, Integer)})
|
||||
* <li>pi nodes (see {@link ArrayBoundsGraph#addPhi(Integer)})
|
||||
* <li>array length nodes (see {@link ArrayBoundsGraph#arrayLength})
|
||||
* </ul>
|
||||
*
|
||||
|
@ -172,10 +172,8 @@ public class ArrayBoundsGraph extends DirectedHyperGraph<Integer> {
|
|||
return result;
|
||||
}
|
||||
|
||||
public void addPhi(Integer dst, Integer src1, Integer src2) {
|
||||
public void addPhi(Integer dst) {
|
||||
this.phis.add(dst);
|
||||
this.addEdge(src1, dst);
|
||||
this.addEdge(src2, dst);
|
||||
}
|
||||
|
||||
public void addPi(Integer dst, Integer src1, Integer src2) {
|
||||
|
|
|
@ -269,17 +269,19 @@ public class ArrayBoundsGraphBuilder {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void visitPhi(SSAPhiInstruction instruction) {
|
||||
assert instruction.getNumberOfUses() == 2;
|
||||
todo.push(instruction.getUse(0));
|
||||
todo.push(instruction.getUse(1));
|
||||
public void visitPhi(SSAPhiInstruction instruction) {
|
||||
int phi = instruction.getDef();
|
||||
ArrayBoundsGraphBuilder.this.lowerBoundGraph.addPhi(phi);
|
||||
ArrayBoundsGraphBuilder.this.upperBoundGraph.addPhi(phi);
|
||||
|
||||
for (int i = 0; i < instruction.getNumberOfUses(); i++) {
|
||||
int use = instruction.getUse(i);
|
||||
todo.push(use);
|
||||
|
||||
ArrayBoundsGraphBuilder.this.lowerBoundGraph.addEdge(use, phi);
|
||||
ArrayBoundsGraphBuilder.this.upperBoundGraph.addEdge(use, phi);
|
||||
}
|
||||
|
||||
ArrayBoundsGraphBuilder.this.lowerBoundGraph.addPhi(
|
||||
instruction.getDef(), instruction.getUse(0),
|
||||
instruction.getUse(1));
|
||||
ArrayBoundsGraphBuilder.this.upperBoundGraph.addPhi(
|
||||
instruction.getDef(), instruction.getUse(0),
|
||||
instruction.getUse(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue