SuccessChanges

Summary

  1. [NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline (details)
  2. Revert "[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline" (details)
  3. [AMDGPU][NewPM] Port amdgpu-promote-alloca(-to-vector) (details)
Commit 4646de5d75cfce3da4ddeffb6eb8e66e38238800 by Yuanfang Chen
[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline

Following up on D67687.
Please refer to the RFC here http://lists.llvm.org/pipermail/llvm-dev/2020-July/143309.html

`CodeGenPassBuilder` is the NPM counterpart of `TargetPassConfig` with below differences.
- Debugging features (MIR print/verify, disable pass, start/stop-before/after, etc.) living in `TargetPassConfig` are moved to use PassInstrument as much as possible. (Implementation also lives in `TargetPassConfig.cpp`)
- `TargetPassConfig` is a polymorphic base (virtual inheritance) to build the target-dependent pipeline whereas `CodeGenPassBuilder` is the CRTP base/helper to implement the target-dependent pipeline. The motivation is flexibility for targets to customize the pipeline, inlining opportunity, and fits the overall NPM value semantics design.
- `TargetPassConfig` is a legacy immutable pass to declare hooks for targets to customize some target-independent codegen layer behavior. This is partially ported to TargetMachine::options. The rest, such as `createMachineScheduler/createPostMachineScheduler`, are left out for now. They should be implemented in LLVMTargetMachine in the future.

Reviewed By: arsenm, aeubanks

Differential Revision: https://reviews.llvm.org/D83608
The file was addedllvm/include/llvm/CodeGen/MachinePassRegistry.def
The file was modifiedllvm/include/llvm/Target/TargetMachine.h
The file was modifiedllvm/include/llvm/CodeGen/TargetPassConfig.h
The file was modifiedllvm/lib/CodeGen/TargetPassConfig.cpp
The file was modifiedllvm/lib/CodeGen/LLVMTargetMachine.cpp
The file was modifiedllvm/lib/CodeGen/CMakeLists.txt
The file was addedllvm/include/llvm/Target/CGPassBuilderOption.h
The file was addedllvm/include/llvm/CodeGen/CodeGenPassBuilder.h
The file was addedllvm/lib/CodeGen/CodeGenPassBuilder.cpp
Commit 94427af60c66ffea655a3084825c6c3a9deec1ad by Yuanfang Chen
Revert "[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline"

This reverts commit 4646de5d75cfce3da4ddeffb6eb8e66e38238800.

Some bots have build failure.
The file was modifiedllvm/include/llvm/CodeGen/TargetPassConfig.h
The file was modifiedllvm/include/llvm/Target/TargetMachine.h
The file was removedllvm/lib/CodeGen/CodeGenPassBuilder.cpp
The file was removedllvm/include/llvm/Target/CGPassBuilderOption.h
The file was removedllvm/include/llvm/CodeGen/MachinePassRegistry.def
The file was removedllvm/include/llvm/CodeGen/CodeGenPassBuilder.h
The file was modifiedllvm/lib/CodeGen/TargetPassConfig.cpp
The file was modifiedllvm/lib/CodeGen/LLVMTargetMachine.cpp
The file was modifiedllvm/lib/CodeGen/CMakeLists.txt
Commit 0e9abcfc1920f25a959eaa08116427b795e10dd8 by aeubanks
[AMDGPU][NewPM] Port amdgpu-promote-alloca(-to-vector)

And add to AMDGPU opt pipeline.

Don't pin an opt run to the legacy PM when -enable-new-pm=1 if these
passes (or passes introduced in https://reviews.llvm.org/D93863) are in
the list of passes.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D93875
The file was modifiedllvm/test/CodeGen/AMDGPU/sroa-before-unroll.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/vector-alloca.ll
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPU.h
The file was modifiedllvm/tools/opt/opt.cpp
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp