Skip to content

Шульпин Илья. Лабораторная работа 2: LLVM. Вариант 3. #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: course-spring-2025
Choose a base branch
from

Conversation

NeeMiyuki
Copy link

Описание будет добавленно после зеленого CI

Comment on lines +17 to +18
for (auto It = BB.begin(), End = BB.end(); It != End;) {
llvm::Instruction *I = &*It++;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use make_early_inc_range for this iterating.

llvm::Instruction *I = &*It++;
if (auto *BI = llvm::dyn_cast<llvm::BinaryOperator>(I)) {
if (BI->getOpcode() == llvm::Instruction::Add) {
if (addFunc && addFunc->arg_size() == 2) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check addFunc's arg_size once before all loops.

Comment on lines +23 to +26
auto argIt = addFunc->arg_begin();
llvm::Type *paramTy0 = argIt->getType();
++argIt;
llvm::Type *paramTy1 = argIt->getType();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same, add function arg types may be initialized before all loops. And if they are equal, one variable is enough.

; CHECK: %result = add i32 %a, %b
; CHECK: ret i32 %result
; CHECK-NOT: add i32

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add testing for the cases when add function is not present in LLVM IR module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants