mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-31 11:50:07 +00:00
Add missing instruction to pass
This commit is contained in:
@@ -253,6 +253,7 @@ void lb_run_remove_dead_instruction_pass(lbProcedure *p) {
|
|||||||
isize removal_count = 0;
|
isize removal_count = 0;
|
||||||
isize pass_count = 0;
|
isize pass_count = 0;
|
||||||
isize const max_pass_count = 10;
|
isize const max_pass_count = 10;
|
||||||
|
isize original_instruction_count = 0;
|
||||||
// Custom remove dead instruction pass
|
// Custom remove dead instruction pass
|
||||||
for (; pass_count < max_pass_count; pass_count++) {
|
for (; pass_count < max_pass_count; pass_count++) {
|
||||||
bool was_dead_instructions = false;
|
bool was_dead_instructions = false;
|
||||||
@@ -267,6 +268,10 @@ void lb_run_remove_dead_instruction_pass(lbProcedure *p) {
|
|||||||
for (LLVMValueRef instr = LLVMGetLastInstruction(block);
|
for (LLVMValueRef instr = LLVMGetLastInstruction(block);
|
||||||
instr != nullptr;
|
instr != nullptr;
|
||||||
/**/) {
|
/**/) {
|
||||||
|
if (pass_count == 0) {
|
||||||
|
original_instruction_count += 1;
|
||||||
|
}
|
||||||
|
|
||||||
LLVMValueRef curr_instr = instr;
|
LLVMValueRef curr_instr = instr;
|
||||||
instr = LLVMGetPreviousInstruction(instr);
|
instr = LLVMGetPreviousInstruction(instr);
|
||||||
|
|
||||||
@@ -280,6 +285,7 @@ void lb_run_remove_dead_instruction_pass(lbProcedure *p) {
|
|||||||
|
|
||||||
// NOTE(bill): Explicit instructions are set here because some instructions could have side effects
|
// NOTE(bill): Explicit instructions are set here because some instructions could have side effects
|
||||||
switch (LLVMGetInstructionOpcode(curr_instr)) {
|
switch (LLVMGetInstructionOpcode(curr_instr)) {
|
||||||
|
case LLVMFNeg:
|
||||||
case LLVMAdd:
|
case LLVMAdd:
|
||||||
case LLVMFAdd:
|
case LLVMFAdd:
|
||||||
case LLVMSub:
|
case LLVMSub:
|
||||||
|
|||||||
Reference in New Issue
Block a user