Skip to content

[Clang] fix for heterogeneous chip's host side's MaybeODRUseExprs clear #121085

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: main
Choose a base branch
from

Conversation

fuaq
Copy link

@fuaq fuaq commented Dec 25, 2024

For heterogeneous ai chip, if we choose host-side compilation there maybe missing for MaybeODRUseExprs's clear.

Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Dec 25, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 25, 2024

@llvm/pr-subscribers-clang

Author: None (fuaq)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/121085.diff

1 Files Affected:

  • (modified) clang/lib/Sema/SemaStmtAsm.cpp (+6)
diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp
index a0b203fbdfec21..5ff11fac9ca5f7 100644
--- a/clang/lib/Sema/SemaStmtAsm.cpp
+++ b/clang/lib/Sema/SemaStmtAsm.cpp
@@ -240,6 +240,12 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
                                  Expr *asmString, MultiExprArg clobbers,
                                  unsigned NumLabels,
                                  SourceLocation RParenLoc) {
+  struct _Cleaner {
+    Sema &S;
+    ~_Cleaner() {
+      S.DiscardCleanupsInEvaluationContext();
+    }
+  } _C{*this};
   unsigned NumClobbers = clobbers.size();
   StringLiteral **Constraints =
     reinterpret_cast<StringLiteral**>(constraints.data());

@fuaq
Copy link
Author

fuaq commented Dec 27, 2024

@MaskRay
Can you help review it

@fuaq
Copy link
Author

fuaq commented Dec 27, 2024

@ahatanak
Thank you for your commit 8fc33d71.
For heterogeneous ai chip, if we choose host-side compilation there maybe missing for MaybeODRUseExprs's clear.
Can you help review it.

Copy link
Collaborator

@shafik shafik left a comment

Choose a reason for hiding this comment

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

I don't think I understand this change. There at least needs to be a more detailed summary and tests. I imagine test would help clarify the intent better.

@fuaq
Copy link
Author

fuaq commented Aug 10, 2025

I don't think I understand this change. There at least needs to be a more detailed summary and tests. I imagine test would help clarify the intent better.

hi, It will lead to a crash for this test without this pr.just like this
image

@fuaq
Copy link
Author

fuaq commented Aug 10, 2025

@shafik Added test for this bug. For heterogeneous chip's host side compilation, just like
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants