You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement a new structure for def-use chain called "use_chain_t".
"use_chain_t" is stored within "struct var", includes "insn" element
that records the instruction using the variable which the use chain
belongs to.
Simplify CSE procedure with use chain information. We build the def-use
chain information by "build_users" function before the optimizing phase.
In addtion, When the instructions are eliminated by CSE, we delete its
use chain nodes from both variables("rs1", "rs2") at the same time.
The CSE method has been modified. When the first pair of instructions is
found, the use chain is utilized to search for identical ADD
instructions. Subsequently, the next instruction is verified to ensure
it match our target. After removing the instruction, utilize the use
chain to find the next target instruction.
Use the following code as an example. Note that it should be compiled
with option "--no-libc" and the DCE should be disabled.
```
int main()
{
char arr[1];
int i, t, pos = 0;
for (i = 0; i < 10000000; i++)
t = arr[pos] + arr[pos];
return 0;
}
```
The difference between before and after CSE:
```
ldr r0, [sp, #4]
ldr r1, [sp, #9]
add r2, r0, r1
ldrb r3, [r2]
-add r2, r0, r1
-ldrb r4, [r2]
+mov r2, r3
```
0 commit comments