@@ -290,7 +290,7 @@ function lift_leaves(compact::IncrementalCompact, @nospecialize(stmt),
290
290
else
291
291
def = compact[leaf]
292
292
end
293
- if is_tuple_call (compact, def) && isa (field, Int) && 1 <= field < length (def. args)
293
+ if is_tuple_call (compact, def) && 1 <= field < length (def. args)
294
294
lifted = def. args[1 + field]
295
295
if is_old (compact, leaf) && isa (lifted, SSAValue)
296
296
lifted = OldSSAValue (lifted. id)
@@ -309,8 +309,6 @@ function lift_leaves(compact::IncrementalCompact, @nospecialize(stmt),
309
309
end
310
310
(isa (typ, DataType) && (! typ. abstract)) || return nothing
311
311
@assert ! typ. mutable
312
- field = try_compute_fieldidx_expr (typ, stmt)
313
- field === nothing && return nothing
314
312
if length (def. args) < 1 + field
315
313
ftyp = fieldtype (typ, field)
316
314
if ! isbitstype (ftyp)
@@ -325,7 +323,7 @@ function lift_leaves(compact::IncrementalCompact, @nospecialize(stmt),
325
323
compact[leaf] = nothing
326
324
for i = (length (def. args) + 1 ): (1 + field)
327
325
ftyp = fieldtype (typ, i - 1 )
328
- isbits (ftyp) || return nothing
326
+ isbitstype (ftyp) || return nothing
329
327
push! (def. args, insert_node! (compact, leaf, result_t, Expr (:new , ftyp)))
330
328
end
331
329
compact[leaf] = def
@@ -344,22 +342,22 @@ function lift_leaves(compact::IncrementalCompact, @nospecialize(stmt),
344
342
else
345
343
typ = compact_exprtype (compact, leaf)
346
344
if ! isa (typ, Const)
345
+ # Disabled since #27126
346
+ return nothing
347
347
# If the leaf is an old ssa value, insert a getfield here
348
348
# We will revisit this getfield later when compaction gets
349
349
# to the appropriate point.
350
350
# N.B.: This can be a bit dangerous because it can lead to
351
351
# infinite loops if we accidentally insert a node just ahead
352
352
# of where we are
353
- if is_old (compact, leaf) && ( isa (field, Int) || isa (field, Symbol))
353
+ if is_old (compact, leaf)
354
354
(isa (typ, DataType) && (! typ. abstract)) || return nothing
355
355
@assert ! typ. mutable
356
356
# If there's the potential for an undefref error on access, we cannot insert a getfield
357
- if field > typ. ninitialized && ! isbits (fieldtype (typ, field))
358
- return nothing
357
+ if field > typ. ninitialized && ! isbitstype (fieldtype (typ, field))
359
358
lifted_leaves[leaf] = RefValue {Any} (insert_node! (compact, leaf, make_MaybeUndef (result_t), Expr (:call , :unchecked_getfield , SSAValue (leaf. id), field), true ))
360
359
maybe_undef = true
361
360
else
362
- return nothing
363
361
lifted_leaves[leaf] = RefValue {Any} (insert_node! (compact, leaf, result_t, Expr (:call , getfield, SSAValue (leaf. id), field), true ))
364
362
end
365
363
continue
@@ -517,8 +515,7 @@ function perform_lifting!(compact::IncrementalCompact,
517
515
518
516
if stmt_val in keys (lifted_leaves)
519
517
stmt_val = lifted_leaves[stmt_val]
520
- else
521
- isa (stmt_val, Union{SSAValue, OldSSAValue}) && stmt_val in keys (reverse_mapping)
518
+ elseif isa (stmt_val, Union{NewSSAValue, SSAValue, OldSSAValue}) && stmt_val in keys (reverse_mapping)
522
519
stmt_val = RefValue {Any} (lifted_phis[reverse_mapping[stmt_val]]. ssa)
523
520
end
524
521
@@ -673,7 +670,7 @@ function getfield_elim_pass!(ir::IRCode)
673
670
674
671
isempty (leaves) && continue
675
672
676
- field = try_compute_fieldidx_expr (struct_typ, stmt )
673
+ field = try_compute_fieldidx (struct_typ, field )
677
674
field === nothing && continue
678
675
679
676
r = lift_leaves (compact, stmt, result_t, field, leaves)
@@ -808,7 +805,7 @@ function getfield_elim_pass!(ir::IRCode)
808
805
for stmt in du. uses
809
806
ir[SSAValue (stmt)] = compute_value_for_use (ir, domtree, allblocks, du, phinodes, fidx, stmt)
810
807
end
811
- if ! isbitstype (fieldtype (typ, fidx) )
808
+ if ! isbitstype (ftyp )
812
809
for (use, list) in preserve_uses
813
810
push! (list, compute_value_for_use (ir, domtree, allblocks, du, phinodes, fidx, use))
814
811
end
0 commit comments