@@ -190,24 +190,13 @@ function applyConstantPropagation(
190190 }
191191
192192 const testValue = read ( constants , branchBlock . terminal . test ) ;
193-
194193 if ( testValue !== null && testValue . kind === 'Primitive' ) {
195194 hasChanges = true ;
196195 const targetBlockId = testValue . value
197196 ? branchBlock . terminal . consequent
198197 : branchBlock . terminal . alternate ;
199198
200- // I think I can only set this if the block isn't
201- // used in a value position by its predecessor
202- // block.kind = 'block';
203-
204199 const chosenBlock = fn . body . blocks . get ( targetBlockId ) ;
205- const otherBlock = fn . body . blocks . get (
206- branchBlock . terminal . consequent === targetBlockId
207- ? branchBlock . terminal . alternate
208- : branchBlock . terminal . consequent ,
209- ) ;
210-
211200 if ( chosenBlock ?. terminal . kind === 'goto' ) {
212201 block . terminal = {
213202 kind : 'goto' ,
@@ -216,44 +205,7 @@ function applyConstantPropagation(
216205 id : terminal . id ,
217206 loc : terminal . loc ,
218207 } ;
219-
220- // debugger;
221- // console.log(chosenBlock.id, Array.from(chosenBlock.preds));
222- // const allPredsAreBlockBlocks = Array.from(chosenBlock.preds).every(
223- // predId => {
224- // const predBlock = fn.body.blocks.get(predId);
225- // return predBlock?.kind === 'block';
226- // },
227- // );
228-
229- // console.log('allPredsAreBlockBlocks', allPredsAreBlockBlocks);
230-
231- // chosenBlock.kind = 'block';
232- // if (allPredsAreBlockBlocks) {
233- // block.kind = 'block';
234- // }
235208 }
236-
237- // const fallthrough = fn.body.blocks.get(
238- // branchBlock.terminal.fallthrough,
239- // );
240-
241- // if (fallthrough?.terminal.kind == 'goto') {
242- // fallthrough.kind = 'block';
243- // }
244-
245- // const consequent = fn.body.blocks.get(
246- // branchBlock.terminal.consequent,
247- // )!;
248- // const alternate = fn.body.blocks.get(branchBlock.terminal.alternate)!;
249-
250- // if (consequent.terminal.kind === 'goto') {
251- // consequent.kind = 'block';
252- // }
253-
254- // if (alternate.terminal.kind === 'goto') {
255- // alternate.kind = 'block';
256- // }
257209 }
258210
259211 break ;
0 commit comments