@@ -183,7 +183,7 @@ cached private module Cached {
183183 result instanceof UnmodeledDefinitionInstruction and
184184 instruction .getFunction ( ) = result .getFunction ( )
185185 or
186- result = getChiInstructionTotalOperand ( instruction . ( ChiInstruction ) , tag . ( ChiTotalOperandTag ) )
186+ result = getChiInstructionTotalOperand ( instruction )
187187 }
188188
189189 cached Instruction getPhiInstructionOperandDefinition ( PhiInstruction instr ,
@@ -203,7 +203,7 @@ cached private module Cached {
203203 )
204204 }
205205
206- cached Instruction getChiInstructionTotalOperand ( ChiInstruction chiInstr , ChiTotalOperandTag tag ) {
206+ cached Instruction getChiInstructionTotalOperand ( ChiInstruction chiInstr ) {
207207 exists ( Alias:: VirtualVariable vvar , OldIR:: Instruction oldInstr , OldIR:: IRBlock defBlock ,
208208 int defRank , int defIndex , OldIR:: IRBlock useBlock , int useRank |
209209 ChiTag ( oldInstr ) = chiInstr .getTag ( ) and
@@ -233,6 +233,11 @@ cached private module Cached {
233233 result = getOldInstruction ( instruction ) .getUnconvertedResultExpression ( )
234234 }
235235
236+ /*
237+ * This adds Chi nodes to the instruction successor relation; if an instruction has a Chi node,
238+ * that node is its successor in the new successor relation, and the Chi node's successors are
239+ * the new instructions generated from the successors of the old instruction
240+ */
236241 cached Instruction getInstructionSuccessor ( Instruction instruction , EdgeKind kind ) {
237242 if ( hasChiNode ( _, getOldInstruction ( instruction ) ) )
238243 then
@@ -331,6 +336,10 @@ cached private module Cached {
331336 (
332337 access = Alias:: getOperandMemoryAccess ( use .getAnOperand ( ) )
333338 or
339+ /*
340+ * a partial write to a virtual variable is going to generate a use of that variable when
341+ * Chi nodes are inserted, so we need to mark it as a use in the old IR
342+ */
334343 access = Alias:: getResultMemoryAccess ( use ) and
335344 access .isPartialMemoryAccess ( )
336345 ) and
@@ -471,8 +480,7 @@ cached private module Cached {
471480 ma = Alias:: getResultMemoryAccess ( def ) and
472481 ma .isPartialMemoryAccess ( ) and
473482 ma .getVirtualVariable ( ) = vvar
474- ) and
475- not def instanceof OldIR:: UnmodeledDefinitionInstruction
483+ )
476484 }
477485}
478486
0 commit comments