mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
fold-mem-offsets: Clarify why do_analysis pre-marks the memory insn
The bitmap_set_bit call before fold_offsets in do_analysis is intentional: fold_offsets requires all uses of a definition to already be in can_fold_insns before it will mark the definition as foldable. Pre-marking the memory instruction (which is the root use) is necessary for its address definitions to pass this check during the DFS. Replace the generic comment with one that explains this dependency. gcc/ChangeLog: * fold-mem-offsets.cc (do_analysis): Revise comment.
This commit is contained in:
@@ -653,7 +653,10 @@ do_analysis (rtx_insn *insn)
|
||||
print_rtl_single (dump_file, insn);
|
||||
}
|
||||
|
||||
/* Analyse folding opportunities for this memory instruction. */
|
||||
/* Mark this memory instruction as foldable before the DFS so that its
|
||||
address definitions can see it in can_fold_insns during analysis.
|
||||
This is required because fold_offsets checks that all uses of a
|
||||
definition are in can_fold_insns before marking the definition. */
|
||||
bitmap_set_bit (&can_fold_insns, INSN_UID (insn));
|
||||
fold_offsets (insn, reg, true, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user