Commit Graph

49 Commits

Author SHA1 Message Date
Dmitry Stogov
eaaf487600 Avoid check for PHI in BB started by a node with a single use-def edge (control edge) 2023-06-07 11:47:42 +03:00
Dmitry Stogov
23bbdd7ceb Avoid loop nesting forest consruction if we didn't detect loops in ir_build_dominators_tree() 2023-04-27 18:00:30 +03:00
Dmitry Stogov
367d2e3246 Avoid CFG reachability check after SCCP
SCCP eliminates unreachable BBs before the CFG constraction.
So ir_build_cfg() doesn't need to perforem reachability chececk if it
runs after SCCP, otherwise it starts call ir_remove_unreachable_blocks() if necessary.
User code dont have to call ir_remove_unreachable_blocks() anymore.
2023-04-27 14:18:39 +03:00
Dmitry Stogov
b15d9d213f Use a faster dominator tree construction algorithm that relays on required IR BB order 2023-04-27 11:49:21 +03:00
Dmitry Stogov
e01c43a967 Simplify access to nodes with variable inputs count 2023-04-21 12:40:17 +03:00
Dmitry Stogov
d71cbd47d5 Disable LICM across an OSR ENTRY if the value can't be restored at OSR ENTRY point 2023-04-07 16:36:27 +03:00
Dmitry Stogov
ba0fa44447 Add "const" modifiers 2023-03-28 13:18:12 +03:00
Dmitry Stogov
b1f2167ea5 Calculate number of ENTRY blocks during CFG construction to avoid an eaxtra loop for ctx->entries[] gathering at ir_match() 2023-03-22 10:21:56 +03:00
Dmitry Stogov
87dbdcea0d Add necessary compensation loads for bounded nodes when enter into function through OSR entry-point 2023-03-21 13:45:37 +03:00
Dmitry Stogov
f5b7065b10 Refactor the ENTRY nodes
Now all ENTRY nodes have a "fake" input control edge.
Through this edge all of them are dominated by START node.
2023-03-17 09:02:37 +03:00
Dmitry Stogov
2b4586fa0b Fixed support for irreducible (incomplete) and merged loops 2023-03-14 19:54:46 +03:00
Dmitry Stogov
36553fdf14 Fix merging of empty ENTRY block with its successor 2023-02-14 14:07:54 +03:00
Dmitry Stogov
01c4b95c18 Fix test for empty ENTRY block 2023-01-24 11:59:41 +03:00
Dmitry Stogov
771da56d07 Fix incorrect tests for empty basic blocks 2023-01-24 11:48:21 +03:00
Dmitry Stogov
6a4e239773 Create a sparate pass to remove unreachableble CFG blocks.
SCCP pass removes unreachable blocks before CFG construction.
In case of -O0 or -O1 pipeline (without SCCP) it's simpler and faster
to unlink unreachable CFG blocks once, then check for reachability
in almost any compilation pass.
-O2 pipeline (with SCCP) don't need this pass.
2022-11-29 20:02:07 +03:00
Dmitry Stogov
dde8309108 Use reference to previous instruction instead of its length 2022-11-18 13:59:49 +03:00
Dmitry Stogov
b56f1f5298 Refactor CFG construction algorithm to mark all BB starts in two passes.
First we perform a backwad DFS search from "stop" nodes. This pass may
leak some CFG paths ended by infinite loops. To support these paths we
record their possible roots and perform forward DFS search starting from
them.
2022-11-11 10:25:59 +03:00
Dmitry Stogov
47ddea00ac Use better conditions 2022-11-11 02:56:16 +03:00
Dmitry Stogov
a4b09dd3ce Improve CFG builder 2022-11-11 00:19:17 +03:00
Dmitry Stogov
27fe71c344 Improve CFG builder and reuse ctx->cfg_map for GCM 2022-11-10 22:45:12 +03:00
Dmitry Stogov
17c603eeed CFG construction optimization 2022-11-09 21:56:31 +03:00
Dmitry Stogov
3535fd2fc4 Fix compilation warnings and signed/unsigned mess 2022-11-08 23:09:35 +03:00
Dmitry Stogov
cc56f12f13 Add LICENSE and copyright notices 2022-11-08 11:32:46 +03:00
Dmitry Stogov
d2a0347b21 Merge basic blocks by removing connected END to BEGIN nodes 2022-10-05 16:29:49 +03:00
Dmitry Stogov
dce017f0ed Replace calloc() by malloc() 2022-09-15 11:57:01 +03:00
Dmitry Stogov
b344d2ee0f Remove useless memset() 2022-09-15 11:24:50 +03:00
Dmitry Stogov
96234f5257 Take into account ENTRY nodes, but prefer paths from START 2022-09-14 23:59:54 +03:00
Dmitry Stogov
8fd8913fcc Use loop only for MERGE and LOOP_BEGIN 2022-09-05 19:21:07 +03:00
Dmitry Stogov
6c7889ebd1 Simplify IF->IF_TRUE/IF_FALSE search 2022-09-02 11:00:40 +03:00
Dmitry Stogov
3a20a8130c JMP optimization. Better ENETR block placement. 2022-08-31 14:29:34 +03:00
Dmitry Stogov
5e4503b624 Fix JMP optimization for MERGE/N and last basic block 2022-08-31 00:01:15 +03:00
Dmitry Stogov
32198c00b7 Reimplement JMP optimization 2022-08-30 23:15:20 +03:00
Dmitry Stogov
d55154d998 Introduce ir_bitqueue API 2022-08-12 19:25:10 +03:00
Dmitry Stogov
9ff5d74778 Introduce ir_bitset_pop_first_ex() and ir_bitset_incl_ex() to avoid repatable checks of the first bitset elements. 2022-08-12 18:01:15 +03:00
Dmitry Stogov
253b99ae74 Eliminate useless ir_bitset_empty() checks 2022-08-11 20:42:03 +03:00
Dmitry Stogov
7552732d65 ws 2022-07-20 11:39:05 +03:00
Dmitry Stogov
0ed7f7b41e Fix CFG construction 2022-06-20 23:31:32 +03:00
Dmitry Stogov
5ef1e97261 Better support for unreachable basic blocks 2022-06-20 16:34:44 +03:00
Dmitry Stogov
1c78c3a2c2 Fix CFG consruction when some BB cannot be find using backward serach
(e.g. function with an infinity loop and without return)
2022-06-17 12:20:15 +03:00
Dmitry Stogov
68477b7d7c Add assertion 2022-06-17 09:41:06 +03:00
Dmitry Stogov
3f6c1ee0f5 cleanup 2022-06-15 22:48:19 +03:00
Dmitry Stogov
5cafe50d36 Initial support for PHP 2022-06-10 00:16:29 +03:00
Dmitry Stogov
ad052c59ab cleanup 2022-06-06 22:36:11 +03:00
Dmitry Stogov
41f3e43cf7 cleanup 2022-05-27 13:18:04 +03:00
Dmitry Stogov
9215162833 Ger rid of ir_ctx.bb_num and double neaning of ir_ctx.prev_insn_len 2022-05-25 11:58:35 +03:00
Dmitry Stogov
ddd5b739db Update tasks 2022-05-24 12:59:57 +03:00
Dmitry Stogov
04667faf22 Reorder blocks according to branch probability 2022-05-24 12:47:39 +03:00
Dmitry Stogov
d3c1e4a02f Reorder basic blocks to reduce number of jumps and improve code locality 2022-05-24 00:43:35 +03:00
Dmitry Stogov
2937993190 Initial import 2022-04-06 00:19:23 +03:00