Skip to content

Commit e42a586

Browse files
authored
Improve TODO docs in OptimizeCasts (#5732)
1 parent 8ec55f6 commit e42a586

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/passes/OptimizeCasts.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,23 @@
7272
// sense in new pass anyhow, and things should be simpler overall to keep such
7373
// casts all in one pass, here.
7474
//
75-
// TODO: Move casts earlier in a basic block as well, at least in traps-never-
76-
// happen mode where we can assume they never fail.
77-
// TODO: Look past individual basic blocks?
78-
// TODO: Look at LocalSet as well and not just Get. That would add some overlap
79-
// with the other passes mentioned above, but once we do things like
80-
// moving casts earlier as in the other TODO, we'd be doing uniquely
81-
// useful things with LocalSet here.
75+
// TODO: 1. Move casts earlier in a basic block as well, at least in
76+
// traps-never-happen mode where we can assume they never fail, and
77+
// perhaps in other situations too.
78+
// TODO: 2. Look past individual basic blocks? This may be worth considering
79+
// given the pattern of a cast appearing in an if condition that is
80+
// then used in an if arm, for example, where simple dominance shows
81+
// the cast can be reused.
82+
// TODO: 3. Look at LocalSet as well and not just Get. That would add some
83+
// overlap with the other passes mentioned above (SimplifyLocals and
84+
// RedundantSetElimination also track sets and can switch a get to use
85+
// a better set's index when that refines the type). But once we do the
86+
// first two TODOs above then we'd be adding some novel things here,
87+
// as we could optimize "backwards" as well (TODO 1) and past basic
88+
// blocks (TODO 2, though RedundantSetElimination does that as well).
89+
// However, we should consider whether improving those other passes
90+
// might make more sense (as it would help more than casts, if we could
91+
// make them operate "backwards" and/or past basic blocks).
8292
//
8393

8494
#include "ir/linear-execution.h"

0 commit comments

Comments
 (0)