aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-05-15 22:14:20 +0100
committergingerBill <bill@gingerbill.org>2021-05-15 22:14:20 +0100
commitb1cfeb6c95066e0f50d43bcd44f846e1f28f61ce (patch)
treed499c2697c8c767e77a296ec19745b01b93dcf22 /src
parentfffb83282b4e725152476ceb54a19d770e93a83e (diff)
Add missing instruction to pass
Diffstat (limited to 'src')
-rw-r--r--src/llvm_backend_opt.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/llvm_backend_opt.cpp b/src/llvm_backend_opt.cpp
index c4eecdb5d..213005f8f 100644
--- a/src/llvm_backend_opt.cpp
+++ b/src/llvm_backend_opt.cpp
@@ -253,6 +253,7 @@ void lb_run_remove_dead_instruction_pass(lbProcedure *p) {
isize removal_count = 0;
isize pass_count = 0;
isize const max_pass_count = 10;
+ isize original_instruction_count = 0;
// Custom remove dead instruction pass
for (; pass_count < max_pass_count; pass_count++) {
bool was_dead_instructions = false;
@@ -267,6 +268,10 @@ void lb_run_remove_dead_instruction_pass(lbProcedure *p) {
for (LLVMValueRef instr = LLVMGetLastInstruction(block);
instr != nullptr;
/**/) {
+ if (pass_count == 0) {
+ original_instruction_count += 1;
+ }
+
LLVMValueRef curr_instr = 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
switch (LLVMGetInstructionOpcode(curr_instr)) {
+ case LLVMFNeg:
case LLVMAdd:
case LLVMFAdd:
case LLVMSub: