Skip to content

Commit 33b37d6

Browse files
committed
LLVMLoopAnalyzer: Get write value type from a separate method
1 parent 9c43261 commit 33b37d6

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/engine/internal/llvm/llvmloopanalyzer.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,21 @@ Compiler::StaticType LLVMLoopAnalyzer::optimizeRegisterType(LLVMRegister *reg) c
122122
return ret;
123123
}
124124

125-
bool LLVMLoopAnalyzer::typesMatch(LLVMInstruction *ins, Compiler::StaticType expectedType) const
125+
Compiler::StaticType LLVMLoopAnalyzer::writeValueType(LLVMInstruction *ins) const
126126
{
127127
assert(ins);
128128
assert(!ins->args.empty());
129129
const auto arg = ins->args.back().second; // value is always the last argument in variable/list write instructions
130-
auto argIns = arg->instruction;
130+
return optimizeRegisterType(arg);
131+
}
132+
133+
bool LLVMLoopAnalyzer::typesMatch(LLVMInstruction *ins, Compiler::StaticType expectedType) const
134+
{
135+
// auto argIns = arg->instruction;
131136

132137
// TODO: Handle cross-variable dependencies
133138
/*if (argIns && (argIns->type == LLVMInstruction::Type::ReadVariable || argIns->type == LLVMInstruction::Type::GetListItem))
134139
return isVarOrListTypeSafe(argIns.get(), expectedType, log, c);*/
135140

136-
return (optimizeRegisterType(arg) == expectedType);
141+
return (writeValueType(ins) == expectedType);
137142
}

src/engine/internal/llvm/llvmloopanalyzer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class LLVMLoopAnalyzer
2323
bool isIfEnd(LLVMInstruction *ins) const;
2424

2525
Compiler::StaticType optimizeRegisterType(LLVMRegister *reg) const;
26+
Compiler::StaticType writeValueType(LLVMInstruction *ins) const;
2627
bool typesMatch(LLVMInstruction *ins, Compiler::StaticType expectedType) const;
2728
};
2829

0 commit comments

Comments
 (0)