[optimize]添加更为通用的除法强度削减Pass, 不受除数限制替换div指令,不影响当前分数

This commit is contained in:
2025-08-03 14:37:33 +08:00
parent f312792fe9
commit 0ce742a86e
7 changed files with 175 additions and 187 deletions

View File

@@ -220,6 +220,9 @@ class IRBuilder {
BinaryInst * createSRAInst(Value *lhs, Value *rhs, const std::string &name = "") {
return createBinaryInst(Instruction::kSRA, Type::getIntType(), lhs, rhs, name);
} ///< 创建算术右移指令
BinaryInst * createMulhInst(Value *lhs, Value *rhs, const std::string &name = "") {
return createBinaryInst(Instruction::kMulh, Type::getIntType(), lhs, rhs, name);
} ///< 创建高位乘法指令
CallInst * createCallInst(Function *callee, const std::vector<Value *> &args, const std::string &name = "") {
std::string newName;
if (name.empty() && callee->getReturnType() != Type::getVoidType()) {