File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
optvm/src/main/java/com/compilerprogramming/ezlang/compiler Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -105,14 +105,14 @@ private void removePhis() {
105
105
var phis = block .phis ();
106
106
if (phis .isEmpty ())
107
107
continue ;
108
- // Insert copy in predecessor
108
+ // Insert copy in predecessor, since we are in CSSA, this is
109
+ // a simple assignment from phi input to phi var
109
110
for (var phi : phis ) {
110
111
for (int j = 0 ; j < phi .numInputs (); j ++) {
111
112
BasicBlock pred = block .predecessor (j );
112
- var pCopyBEnd = getParallelCopyAtEnd (pred );
113
113
var phiInput = phi .input (j );
114
114
var phiVar = phi .value ();
115
- pCopyBEnd . addCopy (phiInput ,new Operand .RegisterOperand (phiVar ));
115
+ insertAtEnd ( pred , new Instruction . Move (phiInput ,new Operand .RegisterOperand (phiVar ) ));
116
116
}
117
117
}
118
118
block .instructions .removeIf (instruction -> instruction instanceof Instruction .Phi );
You can’t perform that action at this time.
0 commit comments