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

Revert three more Clang patches #13181

Merged
merged 4 commits into from
Jul 7, 2023

Conversation

hahnjo
Copy link
Member

@hahnjo hahnjo commented Jul 5, 2023

  • Revert changes to emitLLVMUsed: clearing the vectors LLVMUsed and LLVMCompilerUsed does not seem
    needed because CodeGenerator::StartModule will swap the entire CodeGenModule.
  • Revert changes to SourceManager::isBeforeInTranslationUnit: if assertions are enabled llvm_unreachable has the same effects as assert(0). As we don't see this assertion in recent times, this change is probably not relevant anymore.
  • Revert change in SourceLocation::isBeforeInTranslationUnitThan: I believe that all locations have a SourceManager nowadays, even from the command line.

@hahnjo hahnjo requested a review from vgvassilev as a code owner July 5, 2023 09:46
@hahnjo hahnjo self-assigned this Jul 5, 2023
@phsft-bot
Copy link
Collaborator

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac11/noimt, mac12arm/cxx20, windows10/cxx14
How to customize builds

@vgvassilev
Copy link
Member

  • Revert changes to emitLLVMUsed: clearing the vectors LLVMUsed and LLVMCompilerUsed does not seem
    needed because CodeGenerator::StartModule will swap the entire CodeGenModule.

Makes sense to me.

* Revert changes to `SourceManager::isBeforeInTranslationUnit`: if assertions are enabled `llvm_unreachable` has the same effects as `assert(0)`. As we don't see this assertion in recent times, this change is probably not relevant anymore.

The problem is generated (synthesized) code which have no source location information. Then when you have an error resulting in multiple overloads we will need to compare their source locations to order the diagnostics. This patch makes this codes to work while the llvm_unreachable makes it crash in production.

* Revert change in `SourceLocation::isBeforeInTranslationUnitThan`: I believe that all locations have a `SourceManager` nowadays, even from the command line.

That was probably relevant for the PCH and rootmaps?

@hahnjo
Copy link
Member Author

hahnjo commented Jul 5, 2023

  • Revert changes to SourceManager::isBeforeInTranslationUnit: if assertions are enabled llvm_unreachable has the same effects as assert(0). As we don't see this assertion in recent times, this change is probably not relevant anymore.

The problem is generated (synthesized) code which have no source location information.

Is that still true? In IncrementalParser::ParseInternal, I see that all code parsed gets written into a MemoryBuffer that has valid SourceLocations - see also the comment next to initializeVirtualFile.

Then when you have an error resulting in multiple overloads we will need to compare their source locations to order the diagnostics. This patch makes this codes to work while the llvm_unreachable makes it crash in production.

Maybe, but this sounds incredibly fragile. Also CMS has DBG builds, I guess they have assertions enabled in LLVM?

  • Revert change in SourceLocation::isBeforeInTranslationUnitThan: I believe that all locations have a SourceManager nowadays, even from the command line.

That was probably relevant for the PCH and rootmaps?

Commit b71b903 mentions the command line, but this should equally go through the virtual file I mentioned above and have valid locations these days, no?

@phsft-bot
Copy link
Collaborator

Build failed on mac11/noimt.
Running on macphsft20.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

//AXEL: llvm_unreachable("Unsortable locations found");
assert(0 && "Unsortable locations found");
return LOffs.first < ROffs.first;
llvm_unreachable("Unsortable locations found");
Copy link
Member

Choose a reason for hiding this comment

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

Thiw would corrupt the stack if it reaches here. That's the problem can be triggered by generated code.

Copy link
Member Author

@hahnjo hahnjo Jul 5, 2023

Choose a reason for hiding this comment

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

Yes, I see... So you prefer to keep this patch for now? (edit: see also my argument above about initializeVirtualFile)

Copy link
Member

Choose a reason for hiding this comment

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

I am not sure. I believe that the initializeVirtualFile is not sufficient in the cases where we generate code (via the ast synthesizers) where we pass invalid source locations. However, it might be worth to try. Let's ask cmssw.

@vgvassilev
Copy link
Member

@smuzaffar, can you test this PR within cmssw?

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-debian10-i386/soversion.
Running on pcepsft11.dyndns.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@smuzaffar
Copy link
Contributor

@smuzaffar, can you test this PR within cmssw?

@iarspider , @aandvalenzuela can you please test this? You need to open a PR using hahnjo:revert-clang-patches branch agaisnt the cms-sw/root root master latest branch usd by ROOT6 IBs and then start the tests for ROOT6 IBs from that PR

@github-actions
Copy link

github-actions bot commented Jul 5, 2023

Test Results

         9 files           9 suites   1d 21h 10m 16s ⏱️
  2 472 tests   2 472 ✔️ 0 💤 0
21 147 runs  21 147 ✔️ 0 💤 0

Results for commit a86f7d7.

@vgvassilev
Copy link
Member

@aandvalenzuela can you interpret the results we got from your tests for us? Is this PR good to go from cmssw standpoint?

@aandvalenzuela
Copy link

Yes @vgvassilev, it is. The three tests that failed are also failing in our integration builds. See cms-sw/cmssw#41964 (DataFormatsScouting are actually obsolete tests) and cms-sw/cmssw#42206

@vgvassilev
Copy link
Member

@aandvalenzuela, thanks a lot for the confirmation!

Copy link
Member

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

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

I still hesitate if we shouldn't keep the patch in SourceLocation::isBeforeInTranslationUnitThan but given the fact we tested it in the context of cmssw, it is probably fine to move forward as is. We could re-introduce it if necessary...

hahnjo added 4 commits July 7, 2023 09:55
These were part of commit 2abc4e8 ("Mark implicit members coming
from a PCH as used."). The other change to forgetDecl has already
been removed in commit 853b622 ("Import LLVM r302975."), and
clearing the vectors LLVMUsed and LLVMCompilerUsed does not seem
needed because CodeGenerator::StartModule will swap the entire
CodeGenModule.
For an optimized build, llvm_unreachable will print a warning, but
if assertions are enabled it has the same effects as assert(0). As
we don't see this assertion in recent times, this change is probably
not relevant anymore.
I believe that all locations have a SourceManager nowadays, even from
the command line.
@hahnjo hahnjo force-pushed the revert-clang-patches branch from a86f7d7 to 12cf7d2 Compare July 7, 2023 08:26
@phsft-bot
Copy link
Collaborator

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac11/noimt, mac12arm/cxx20, windows10/cxx14
How to customize builds

@hahnjo hahnjo merged commit f83a409 into root-project:master Jul 7, 2023
@hahnjo hahnjo deleted the revert-clang-patches branch July 7, 2023 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants