[PATCH] D118652: Cleanup header dependencies in LLVMCore

2022-02-01 Thread serge via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe188aae406f3: Cleanup header dependencies in LLVMCore 
(authored by serge-sans-paille).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118652/new/

https://reviews.llvm.org/D118652

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  llvm/examples/IRTransforms/InitializePasses.h
  llvm/include/llvm-c/Core.h
  llvm/include/llvm-c/DebugInfo.h
  llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h
  llvm/include/llvm/Analysis/CycleAnalysis.h
  llvm/include/llvm/Analysis/MLInlineAdvisor.h
  llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h
  llvm/include/llvm/Analysis/SparsePropagation.h
  llvm/include/llvm/CodeGen/ReplaceWithVeclib.h
  llvm/include/llvm/IR/AbstractCallSite.h
  llvm/include/llvm/IR/Attributes.h
  llvm/include/llvm/IR/CFG.h
  llvm/include/llvm/IR/DIBuilder.h
  llvm/include/llvm/IR/DebugInfoMetadata.h
  llvm/include/llvm/IR/DiagnosticInfo.h
  llvm/include/llvm/IR/Dominators.h
  llvm/include/llvm/IR/IRBuilder.h
  llvm/include/llvm/IR/IRPrintingPasses.h
  llvm/include/llvm/IR/Instruction.h
  llvm/include/llvm/IR/Instructions.h
  llvm/include/llvm/IR/LLVMContext.h
  llvm/include/llvm/IR/LLVMRemarkStreamer.h
  llvm/include/llvm/IR/LegacyPassManager.h
  llvm/include/llvm/IR/MDBuilder.h
  llvm/include/llvm/IR/Metadata.h
  llvm/include/llvm/IR/ModuleSummaryIndex.h
  llvm/include/llvm/IR/PassManager.h
  llvm/include/llvm/IR/PassTimingInfo.h
  llvm/include/llvm/IR/ReplaceConstant.h
  llvm/include/llvm/IR/SSAContext.h
  llvm/include/llvm/IR/Statepoint.h
  llvm/include/llvm/IR/Type.h
  llvm/include/llvm/IR/Use.h
  llvm/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h
  llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
  llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h
  llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h
  llvm/include/llvm/Transforms/IPO/SampleProfile.h
  llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
  llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h
  llvm/include/llvm/Transforms/Scalar/Scalarizer.h
  llvm/include/llvm/Transforms/Scalar/WarnMissedTransforms.h
  llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h
  llvm/include/llvm/Transforms/Utils/Debugify.h
  llvm/include/llvm/Transforms/Utils/InjectTLIMappings.h
  llvm/include/llvm/Transforms/Vectorize/LoadStoreVectorizer.h
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/lib/IR/BasicBlock.cpp
  llvm/lib/IR/Comdat.cpp
  llvm/lib/IR/ConstantFold.cpp
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/DIBuilder.cpp
  llvm/lib/IR/DataLayout.cpp
  llvm/lib/IR/DebugInfo.cpp
  llvm/lib/IR/DebugInfoMetadata.cpp
  llvm/lib/IR/DebugLoc.cpp
  llvm/lib/IR/DiagnosticInfo.cpp
  llvm/lib/IR/Dominators.cpp
  llvm/lib/IR/Function.cpp
  llvm/lib/IR/Globals.cpp
  llvm/lib/IR/IRBuilder.cpp
  llvm/lib/IR/InlineAsm.cpp
  llvm/lib/IR/Instruction.cpp
  llvm/lib/IR/IntrinsicInst.cpp
  llvm/lib/IR/LLVMContext.cpp
  llvm/lib/IR/LLVMContextImpl.cpp
  llvm/lib/IR/LLVMContextImpl.h
  llvm/lib/IR/LLVMRemarkStreamer.cpp
  llvm/lib/IR/LegacyPassManager.cpp
  llvm/lib/IR/Metadata.cpp
  llvm/lib/IR/Module.cpp
  llvm/lib/IR/ModuleSummaryIndex.cpp
  llvm/lib/IR/Operator.cpp
  llvm/lib/IR/OptBisect.cpp
  llvm/lib/IR/PassManager.cpp
  llvm/lib/IR/ProfileSummary.cpp
  llvm/lib/IR/PseudoProbe.cpp
  llvm/lib/IR/ReplaceConstant.cpp
  llvm/lib/IR/SSAContext.cpp
  llvm/lib/IR/SafepointIRVerifier.cpp
  llvm/lib/IR/Statepoint.cpp
  llvm/lib/IR/Type.cpp
  llvm/lib/IR/Use.cpp
  llvm/lib/IR/Value.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/LTO/LTO.cpp
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/Target/AMDGPU/AMDGPU.h
  llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
  llvm/lib/Target/X86/X86LowerAMXType.cpp
  llvm/lib/Transforms/Coroutines/CoroFrame.cpp
  llvm/lib/Transforms/IPO/CalledValuePropagation.cpp
  llvm/lib/Transforms/IPO/LowerTypeTests.cpp
  llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/lib/Transforms/Utils/CodeExtractor.cpp
  llvm/lib/Transforms/Utils/InlineFunction.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/lib/Transforms/Utils/NameAnonGlobals.cpp
  llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
  llvm/lib/Transforms/Utils/Utils.cpp
  llvm/lib/Transforms/Utils/VNCoercion.cpp
  llvm/lib/Transforms/Vectorize/Vectorize.cpp
  llvm/tools/llvm-c-test/echo.cpp
  llvm/tools/llvm-extract/llvm-extract.cpp
  llvm/tools/llvm-stress/llvm-stress.cpp
  llvm/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h
  llvm/unittests/IR/TimePassesTest.cpp
  

[PATCH] D118652: Cleanup header dependencies in LLVMCore

2022-02-01 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118652/new/

https://reviews.llvm.org/D118652

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D118652: Cleanup header dependencies in LLVMCore

2022-02-01 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

In D118652#3286018 , @mehdi_amini 
wrote:

> I'm not sure how it'd help clients of the released version of LLVM to delay, 
> the development branch and the release seems fairly disconnected to me from 
> this point of view.
> (what can help are deprecating APIs with instructions about how to update so 
> that they can update to the new API while targeting the current release)

I second that opinion.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118652/new/

https://reviews.llvm.org/D118652

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D118652: Cleanup header dependencies in LLVMCore

2022-02-01 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

Hi and thanks for taking the time to go through the review.

In D118652#3285601 , @MaskRay wrote:

> Thanks for working on this. I spot checked some files. In general it looks 
> great.
>
> One file replaces a forward declaration with `#include 
> "llvm/IR/BasicBlock.h"`.

Yeah. What happens is that header was previously implicitly included (and 
needed), I just made the include explicit (and the forward declaration useless)

> Some files add `#include "llvm/Support/ToolOutputFile.h"`.

Yeah, that's a consequence of `llvm/IR/LLVMRemarkStreamer.h no longer includes 
llvm/Support/ToolOutputFile.h`

> One files adds `class FunctionPass;`

Yeah, that happens when the file was implicitly including `llvm/Pass.h` but was 
actually only needing a forward declaration.

> Would you mind landing these addition changes separately to make the include 
> removal part more targeted?

The three changes above are tied to individual header removal in specific 
header. I could split that in smaller grain (say each header change + its 
impact on the codebase in individual commits), but that would mean that every 
"component" cleanup would consist in potentially dozens of commits. I 
understand the value of such fine-grain commits, but it means more care (and 
work!) on my side to handle more reviews, craft more decent commit message etc. 
I chose to split the cleanup per component to make review easier, have a decent 
idea of the impact on preprocessed lines. I'm trying to reflect in the commit 
message the major changes to help downstream users update their codebase.

If you really think the split would help the review process, I can do it, but 
please take into account the amount of work it adds on an already not 
super-creative task ;-)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118652/new/

https://reviews.llvm.org/D118652

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D118652: Cleanup header dependencies in LLVMCore

2022-01-31 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

I'm not sure how it'd help clients of the released version of LLVM to delay, 
the development branch and the release seems fairly disconnected to me from 
this point of view.
(what can help are deprecating APIs with instructions about how to update so 
that they can update to the new API while targeting the current release)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118652/new/

https://reviews.llvm.org/D118652

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D118652: Cleanup header dependencies in LLVMCore

2022-01-31 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

> It is very likely to break downstream code unless they took a lot of care in 
> avoiding hidden ehader dependencies, something the LLVM codebase doesn't do 
> that well :-/

release/14.x will branch soon. Will it be useful to deliberately miss the 
branch point so that downstream code (with some folks testing trunk llvm) has 
more time to fix or will that cause headache when llvm-project developers back 
port fixes to release/14.x?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118652/new/

https://reviews.llvm.org/D118652

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D118652: Cleanup header dependencies in LLVMCore

2022-01-31 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Thanks for working on this. I spot checked some files. In general it looks 
great.

One file replaces a forward declaration with `#include "llvm/IR/BasicBlock.h"`.
Some files add `#include "llvm/Support/ToolOutputFile.h"`.
One files adds `class FunctionPass;`

Would you mind landing these addition changes separately to make the include 
removal part more targeted?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118652/new/

https://reviews.llvm.org/D118652

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D118652: Cleanup header dependencies in LLVMCore

2022-01-31 Thread serge via Phabricator via cfe-commits
serge-sans-paille created this revision.
serge-sans-paille added reviewers: RKSimon, lenary, mehdi_amini, MaskRay.
Herald added subscribers: jeroen.dobbelaere, ormris, foad, dexonsmith, wenlei, 
jdoerfert, kerbowa, pengfei, arphaman, steven_wu, hiraditya, nhaehnle, jvesely, 
arsenm.
Herald added a reviewer: deadalnix.
Herald added a reviewer: bollu.
serge-sans-paille requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Based on the output of include-what-you-use.

This is a big chunk of changes. It is very likely to break downstream code
unless they took a lot of care in avoiding hidden ehader dependencies, something
the LLVM codebase doesn't do that well :-/

I've tried to summarize the biggest change below:

- llvm/include/llvm-c/Core.h: no longer includes llvm-c/ErrorHandling.h
- llvm/IR/DIBuilder.h no longer includes llvm/IR/DebugInfo.h
- llvm/IR/IRBuilder.h no longer includes llvm/IR/IntrinsicInst.h
- llvm/IR/LLVMRemarkStreamer.h no longer includes llvm/Support/ToolOutputFile.h
- llvm/IR/LegacyPassManager.h no longer include llvm/Pass.h
- llvm/IR/Type.h no longer includes llvm/ADT/SmallPtrSet.h
- llvm/IR/PassManager.h no longer includes llvm/Pass.h nor llvm/Support/Debug.h

And the usual count of preprocessed lines:
$ clang++ -E  -Iinclude -I../llvm/include ../llvm/lib/IR/*.cpp -std=c++14 
-fno-rtti -fno-exceptions | wc -l
before: 6400831
after:  6189948

200k lines less to process is no that bad ;-)

Discourse thread on the topic: 
https://llvm.discourse.group/t/include-what-you-use-include-cleanup


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118652

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  llvm/examples/IRTransforms/InitializePasses.h
  llvm/include/llvm-c/Core.h
  llvm/include/llvm-c/DebugInfo.h
  llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h
  llvm/include/llvm/Analysis/CycleAnalysis.h
  llvm/include/llvm/Analysis/MLInlineAdvisor.h
  llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h
  llvm/include/llvm/Analysis/SparsePropagation.h
  llvm/include/llvm/CodeGen/ReplaceWithVeclib.h
  llvm/include/llvm/IR/AbstractCallSite.h
  llvm/include/llvm/IR/Attributes.h
  llvm/include/llvm/IR/CFG.h
  llvm/include/llvm/IR/DIBuilder.h
  llvm/include/llvm/IR/DebugInfoMetadata.h
  llvm/include/llvm/IR/DiagnosticInfo.h
  llvm/include/llvm/IR/Dominators.h
  llvm/include/llvm/IR/IRBuilder.h
  llvm/include/llvm/IR/IRPrintingPasses.h
  llvm/include/llvm/IR/Instruction.h
  llvm/include/llvm/IR/Instructions.h
  llvm/include/llvm/IR/LLVMContext.h
  llvm/include/llvm/IR/LLVMRemarkStreamer.h
  llvm/include/llvm/IR/LegacyPassManager.h
  llvm/include/llvm/IR/MDBuilder.h
  llvm/include/llvm/IR/Metadata.h
  llvm/include/llvm/IR/ModuleSummaryIndex.h
  llvm/include/llvm/IR/PassManager.h
  llvm/include/llvm/IR/PassTimingInfo.h
  llvm/include/llvm/IR/ReplaceConstant.h
  llvm/include/llvm/IR/SSAContext.h
  llvm/include/llvm/IR/Statepoint.h
  llvm/include/llvm/IR/Type.h
  llvm/include/llvm/IR/Use.h
  llvm/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h
  llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
  llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h
  llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h
  llvm/include/llvm/Transforms/IPO/SampleProfile.h
  llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
  llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h
  llvm/include/llvm/Transforms/Scalar/Scalarizer.h
  llvm/include/llvm/Transforms/Scalar/WarnMissedTransforms.h
  llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h
  llvm/include/llvm/Transforms/Utils/Debugify.h
  llvm/include/llvm/Transforms/Utils/InjectTLIMappings.h
  llvm/include/llvm/Transforms/Vectorize/LoadStoreVectorizer.h
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/lib/IR/BasicBlock.cpp
  llvm/lib/IR/Comdat.cpp
  llvm/lib/IR/ConstantFold.cpp
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/DIBuilder.cpp
  llvm/lib/IR/DataLayout.cpp
  llvm/lib/IR/DebugInfo.cpp
  llvm/lib/IR/DebugInfoMetadata.cpp
  llvm/lib/IR/DebugLoc.cpp
  llvm/lib/IR/DiagnosticInfo.cpp
  llvm/lib/IR/Dominators.cpp
  llvm/lib/IR/Function.cpp
  llvm/lib/IR/Globals.cpp
  llvm/lib/IR/IRBuilder.cpp
  llvm/lib/IR/InlineAsm.cpp
  llvm/lib/IR/Instruction.cpp
  llvm/lib/IR/IntrinsicInst.cpp
  llvm/lib/IR/LLVMContext.cpp
  llvm/lib/IR/LLVMContextImpl.cpp
  llvm/lib/IR/LLVMContextImpl.h
  llvm/lib/IR/LLVMRemarkStreamer.cpp
  llvm/lib/IR/LegacyPassManager.cpp
  llvm/lib/IR/Metadata.cpp
  llvm/lib/IR/Module.cpp
  llvm/lib/IR/ModuleSummaryIndex.cpp
  llvm/lib/IR/Operator.cpp
  llvm/lib/IR/OptBisect.cpp
  llvm/lib/IR/PassManager.cpp
  llvm/lib/IR/ProfileSummary.cpp
  llvm/lib/IR/PseudoProbe.cpp
  llvm/lib/IR/ReplaceConstant.cpp
  llvm/lib/IR/SSAContext.cpp