Skip to content

Commit 0b5f426

Browse files
committed
add comment
1 parent a2742c9 commit 0b5f426

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

base/compiler/ssair/passes.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,12 @@ function sroa_pass!(ir::IRCode)
823823
allblocks = sort(vcat(phiblocks, ldu.def_bbs))
824824
blocks[fidx] = phiblocks, allblocks
825825
if fidx + 1 > length(defexpr.args)
826+
# even if the allocation contains uninitialized field,
827+
# we try extra effort to check if all use has "solid" definitions:
828+
# we give up the cases below:
829+
# `def == idx`: this field can only defined at the allocation site (thus this case will throw)
830+
# `def == 0`: this field comes from `PhiNode`
831+
# we may traverse control flows of PhiNode values, but it sounds more complicated than beneficial
826832
for use in du.uses
827833
def = find_def_for_use(ir, domtree, allblocks, du, use)[1]
828834
(def == 0 || def == idx) && @goto skip

0 commit comments

Comments
 (0)