Skip to content
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

Enable llvm tests for symbolics #2430

Merged
merged 3 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -714,9 +714,9 @@ RUN(NAME symbolics_07 LABELS cpython_sym c_sym llvm_sym NOFAST)
RUN(NAME symbolics_08 LABELS cpython_sym c_sym llvm_sym)
RUN(NAME symbolics_09 LABELS cpython_sym c_sym llvm_sym NOFAST)
RUN(NAME symbolics_10 LABELS cpython_sym c_sym llvm_sym NOFAST)
RUN(NAME symbolics_11 LABELS cpython_sym c_sym NOFAST)
RUN(NAME symbolics_11 LABELS cpython_sym c_sym llvm_sym NOFAST)
RUN(NAME symbolics_12 LABELS cpython_sym c_sym llvm_sym NOFAST)
RUN(NAME symbolics_13 LABELS cpython_sym c_sym NOFAST)
RUN(NAME symbolics_13 LABELS cpython_sym c_sym llvm_sym NOFAST)

RUN(NAME sizeof_01 LABELS llvm c
EXTRAFILES sizeof_01b.c)
Expand Down
11 changes: 6 additions & 5 deletions src/libasr/codegen/asr_to_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7766,9 +7766,9 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
if (llvm_symtab.find(h) != llvm_symtab.end()) {
tmp = llvm_symtab[h];
if( !ASRUtils::is_array(arg->m_type) ) {

if (x_abi == ASR::abiType::Source && ASR::is_a<ASR::CPtr_t>(*arg->m_type)) {
if (arg->m_intent == intent_local) {
if ( orig_arg_intent != ASRUtils::intent_out &&
arg->m_intent == intent_local ) {
// Local variable of type
// CPtr is a void**, so we
// have to load it
Expand Down Expand Up @@ -7815,9 +7815,10 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
}
}
} else if (is_a<ASR::CPtr_t>(*arg_type)) {
if (arg->m_intent == intent_local) {
// Local variable of type
// CPtr is a void**, so we
if ( arg->m_intent == intent_local ||
arg->m_intent == ASRUtils::intent_out) {
// Local variable or Dummy out argument
// of type CPtr is a void**, so we
// have to load it
tmp = CreateLoad(tmp);
}
Expand Down
1 change: 1 addition & 0 deletions src/libasr/codegen/llvm_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,7 @@ namespace LCompilers {
break;
}
case (ASR::ttypeType::CPtr) : {
a_kind = 8;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Previously, we used a_kind = 4, but now I set 8 to be default, this is required for Symbolic as we use i64 pointer for CPtr.

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought CPtr doesn't have a kind?

Copy link
Collaborator Author

@Thirumalai-Shaktivel Thirumalai-Shaktivel Nov 25, 2023

Choose a reason for hiding this comment

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

It seems the list[CPtr] uses a_kind to decide malloc_size.
Is this a bug?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I went through the changes and the changes do work in the correct direction. If we could know whether a_kind would be required or not for list[CPtr], the PR can be finished accordingly .

Copy link
Collaborator

Choose a reason for hiding this comment

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

cc @certik
Could you clarify Thirumalai's comment here? I think this is close to completion once we have an idea for the same.

llvm_type = llvm::Type::getVoidTy(context)->getPointerTo();
break;
}
Expand Down
Loading