1. [CSSPGO] Overwrite branch weight annotated in previous pass. (details)
  2. Recommit "[GlobalISel] Simplify G_ICMP to true/false when the result is known" (details)
  3. [profile] Skip mmap() if there are no counters (details)
  4. [ScalarEvolution] Remove unused ExitLimit::hasOperand() method (NFC) (details)
  5. [x86] add test check lines to demonstrate FMF propagation failure; NFC (details)
  6. [x86] propagate FMF from x86-specific intrinsic nodes to others during lowering (details)
  7. Revert "Reapply "[clang][deps] Support inferred modules"" (details)
  8. Do actual DCE in LoopUnroll (try 4) (details)
  9. [MCA] llvm-mca MCTargetStreamer segfault fix (details)
  10. [NFCI][Local] removeUnreachableBlocks(): use DeleteDeadBlocks() (details)
  11. [NFCI][Local] MergeBlockIntoPredecessor(): use DeleteDeadBlocks() (details)
  12. [NFCI][Local] TryToSimplifyUncondBranchFromEmptyBlock(): use DeleteDeadBlocks() (details)
  13. [CoverageMapping] Handle gaps in counter IDs for source-based coverage (details)
  14. [MLIR] Update Vector To LLVM conversion to be aware of assume_alignment (details)
  15. [x86] update fma test with deprecated intrinsics; NFC (details)
  16. [libcxx][iterator][nfc] acquires lock for working on [range.iter.ops] (details)
  17. [MCA] Unbreak the buildbots by passing flag -mcpu=generic to the new test added by commit e5d59db469. (details)
  18. [libcxx][ranges] adds concept `sized_range` and cleans up `ranges::size` (details)
  19. [lld/mac] Remove dead declaration (details)
  20. [x86] propagate FMF from x86-specific intrinsic nodes to others during combining (details)
  21. [x86] add tests for fma folds with fast-math-flags; NFC (details)
Commit 4ca6e37b9825db6d27a0aa2311b6530ac3faf021 by hoy
[CSSPGO] Overwrite branch weight annotated in previous pass.

Sample profile loader can be run in both LTO prelink and postlink. Currently the counts annoation in postilnk doesn't fully overwrite what's done in prelink. I'm adding a switch (`-overwrite-existing-weights=1`) to enable a full overwrite, which includes:

1. Clear old metadata for calls when their parent block has a zero count. This could be caused by prelink code duplication.

2. Clear indirect call metadata if somehow all the rest targets have a sum of zero count.

3. Overwrite branch weight for basic blocks.

With a CS profile, I was seeing #1 and #2 help reduce code size by preventing post-sample ICP and CGSCC inliner working on obsolete metadata, which come from a partial global inlining in prelink.  It's not expected to work well for non-CS case with a less-accurate post-inline count quality.

It's worth calling out that some prelink optimizations can damage counts quality in an irreversible way. One example is the loop rotate optimization. Due to lack of exact loop entry count (profiling can only give loop iteration count and loop exit count), moving one iteration out of the loop body leaves the rest iteration count unknown. We had to turn off prelink loop rotate to achieve a better postlink counts quality. A even better postlink counts quality can be archived by turning off prelink CGSCC inlining which is not context-sensitive.

Reviewed By: wenlei, wmi

Differential Revision:
The file was modifiedllvm/lib/Transforms/IPO/SampleProfile.cpp
The file was modifiedllvm/test/Transforms/SampleProfile/branch.ll
The file was addedllvm/test/Transforms/SampleProfile/pseudo-probe-profile-metadata-2.ll
Commit 84ae1cf8edc00cbf02a7396fef256f39046c1e5b by Jessica Paquette
Recommit "[GlobalISel] Simplify G_ICMP to true/false when the result is known"

Add missing REQUIRES line to
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/sdiv.i64.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/cvt_f32_ubyte.ll
The file was modifiedllvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/fshl.ll
The file was modifiedllvm/include/llvm/Target/GlobalISel/
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/saddsat.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/udiv.i64.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/urem.i64.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/ssubsat.ll
The file was modifiedllvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/fshr.ll
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/prelegalizer-combiner-icmp-to-true-false-known-bits.mir
The file was modifiedllvm/lib/Target/AArch64/
The file was modifiedllvm/test/CodeGen/AArch64/fold-global-offsets.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/srem.i64.ll
Commit 7014a101614367e05cec1ba72a6be07eb173b304 by Vedant Kumar
[profile] Skip mmap() if there are no counters

If there are no counters, an mmap() of the counters section would fail
due to the size argument being too small (EINVAL).


Differential Revision:
The file was modifiedcompiler-rt/lib/profile/InstrProfilingFile.c
The file was addedcompiler-rt/test/profile/ContinuousSyncMode/image-with-no-counters.c
Commit b661a55a253f4a1cf5a0fbcb86e5ba7b9fb1387b by nikita.ppv
[ScalarEvolution] Remove unused ExitLimit::hasOperand() method (NFC)

We only use BackedgeTakenInfo::hasOperand().
The file was modifiedllvm/include/llvm/Analysis/ScalarEvolution.h
The file was modifiedllvm/lib/Analysis/ScalarEvolution.cpp
Commit 25207d5f81385e425f67283f7abd10d5f01b7f37 by spatel
[x86] add test check lines to demonstrate FMF propagation failure; NFC
The file was modifiedllvm/test/CodeGen/X86/fmf-propagation.ll
Commit f66ba4cfa7ca312caee5f8f32fcceff592a15acd by spatel
[x86] propagate FMF from x86-specific intrinsic nodes to others during lowering

This is another fast-math-flags failure exposed by D90901.
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.cpp
The file was modifiedllvm/test/CodeGen/X86/fmf-propagation.ll
Commit 76b8754d1bba6a8490c0f7e8a9e2fb3d181f0b03 by frgossen
Revert "Reapply "[clang][deps] Support inferred modules""

This reverts commit c98833cdaad01787ea70ecdfabb05a7e142a6671.
The test `ClangScanDeps/modules-inferred-explicit-build.m` creates files
in the current directory.
The file was removedclang/test/ClangScanDeps/Inputs/frameworks/System.framework/Modules/module.modulemap
The file was modifiedclang/test/ClangScanDeps/modules-full.cpp
The file was removedclang/test/ClangScanDeps/Inputs/frameworks/Inferred.framework/Frameworks/Sub.framework/Headers/Sub.h
The file was removedclang/test/ClangScanDeps/modules-inferred-explicit-build.m
The file was removedclang/test/ClangScanDeps/modules-inferred.m
The file was removedclang/test/ClangScanDeps/Inputs/frameworks/System.framework/Headers/System.h
The file was removedclang/test/ClangScanDeps/Inputs/frameworks/Inferred.framework/Headers/Inferred.h
The file was removedclang/utils/
The file was modifiedclang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
The file was removedclang/test/ClangScanDeps/Inputs/modules_inferred_cdb.json
The file was removedclang/test/ClangScanDeps/Inputs/frameworks/module.modulemap
Commit 449d14ebd23b80bbc8bb5a1ba7979b0e4092a2fc by listmail
Do actual DCE in LoopUnroll (try 4)

Turns out simplifyLoopIVs sometimes returns a non-dead instruction in it's DeadInsts out param.  I had done a bit of NFC cleanup which was only NFC if simplifyLoopIVs obeyed it's documentation.  I'm simplfy dropping that part of the change.

Commit message from try 3:

Recommitting after fixing a bug found post commit. Amusingly, try 1 had been correct, and by reverting to incorporate last minute review feedback, I introduce the bug. Oops. :)

Original commit message:

The problem was that recursively deleting an instruction can delete instructions beyond the current iterator (via a dead phi), thus invalidating iteration. Test case added in LoopUnroll/dce.ll to cover this case.

LoopUnroll does a limited DCE pass after unrolling, but if you have a chain of dead instructions, it only deletes the last one. Improve the code to recursively delete all trivially dead instructions.

Differential Revision:
The file was modifiedllvm/test/Transforms/LoopUnrollAndJam/unroll-and-jam.ll
The file was modifiedllvm/test/Transforms/LoopUnroll/full-unroll-invariant.ll
The file was modifiedllvm/lib/Transforms/Utils/LoopUnroll.cpp
The file was modifiedllvm/test/Transforms/LoopUnroll/AArch64/full-unroll-trip-count-upper-bound.ll
The file was modifiedllvm/test/Transforms/LoopUnroll/scevunroll.ll
The file was modifiedllvm/test/Transforms/LoopUnroll/nonlatchcondbr.ll
The file was modifiedllvm/test/Transforms/LoopUnroll/unroll-header-exiting-with-phis.ll
The file was modifiedllvm/test/Transforms/LoopUnroll/optsize-loop-size.ll
The file was addedllvm/test/Transforms/LoopUnroll/dce.ll
The file was modifiedllvm/test/Transforms/LoopUnroll/unroll-unconditional-latch.ll
The file was modifiedllvm/test/Transforms/LoopUnroll/pr45939-peel-count-and-complete-unroll.ll
Commit e5d59db46938caf0280f7347e89181f2a7b0749c by andrea.dibiagio
[MCA] llvm-mca MCTargetStreamer segfault fix

In order to create the code regions for llvm-mca to analyze, llvm-mca creates an
AsmCodeRegionGenerator and calls AsmCodeRegionGenerator::parseCodeRegions().
Within this function, both an MCAsmParser and MCTargetAsmParser are created so
that MCAsmParser::Run() can be used to create the code regions for us.

These parser classes were created for llvm-mc so they are designed to emit code
with an MCStreamer and MCTargetStreamer that are expected to be setup and passed
into the MCAsmParser constructor. Because llvm-mca doesn’t want to emit any
code, an MCStreamerWrapper class gets created instead and passed into the
MCAsmParser constructor. This wrapper inherits from MCStreamer and overrides
many of the emit methods to just do nothing. The exception is the
emitInstruction() method which calls Regions.addInstruction(Inst).

This works well and allows llvm-mca to utilize llvm-mc’s MCAsmParser to build
our code regions, however there are a few directives which rely on the
MCTargetStreamer. llvm-mc assumes that the MCStreamer that gets passed into the
MCAsmParser’s constructor has a valid pointer to an MCTargetStreamer. Because
llvm-mca doesn’t setup an MCTargetStreamer, when the parser encounters one of
those directives, a segfault will occur.

In x86, each one of these 7 directives will cause this segfault if they exist in
the input assembly to llvm-mca:

I haven’t looked at other targets, but I wouldn’t be surprised if some of the
other ones also have certain directives which could result in this same

My proposed solution is to simply initialize an MCTargetStreamer after we
initialize the MCStreamerWrapper. The MCTargetStreamer requires an ostream
object, but we don’t actually want any of these directives to be emitted
anywhere, so I use an ostream created with the nulls() function. Since this
needs to happen after the MCStreamerWrapper has been initialized, it needs to
happen within the AsmCodeRegionGenerator::parseCodeRegions() function. The
MCTargetStreamer also needs an MCInstPrinter which is easiest to initialize
within the main() function of llvm-mca. So this MCInstPrinter gets constructed
within main() then passed into the parseCodeRegions() function as a parameter.
(If you feel like it would be appropriate and possible to create the
MCInstPrinter within the parseCodeRegions() function, then feel free to modify
my solution. That would stop us from having to pass it into the function and
would limit its scope / lifetime.)

My solution stops the segfault from happening and still passes all of the
current (expected) llvm-mca tests. I also added a new test for x86 that checks
for this segfault on an input that includes one of the .cv_fpo directives (this
test fails without my solution, but passes with it).

As far as I can tell, all of the functions that I modified are only called from
within llvm-mca so there shouldn’t be any worries about breaking other tools.

Differential Revision:
The file was modifiedllvm/tools/llvm-mca/CodeRegionGenerator.cpp
The file was modifiedllvm/tools/llvm-mca/llvm-mca.cpp
The file was modifiedllvm/tools/llvm-mca/CodeRegionGenerator.h
The file was addedllvm/test/tools/llvm-mca/X86/cv_fpo_directive_no_segfault.s
Commit b0bb2149b3711d5d7c4fd3182a7eac3f8fc17341 by lebedev.ri
[NFCI][Local] removeUnreachableBlocks(): use DeleteDeadBlocks()
The file was modifiedllvm/lib/Transforms/Utils/Local.cpp
Commit c60ca9856c9da19794b0f7b83b3002847e3fc9d9 by lebedev.ri
[NFCI][Local] MergeBlockIntoPredecessor(): use DeleteDeadBlocks()
The file was modifiedllvm/lib/Transforms/Utils/BasicBlockUtils.cpp
Commit 40fb4eeff9ee59382f6bc37c622bde99c2a9a02a by lebedev.ri
[NFCI][Local] TryToSimplifyUncondBranchFromEmptyBlock(): use DeleteDeadBlocks()
The file was modifiedllvm/lib/Transforms/Utils/Local.cpp
Commit e4274cfe06fe48ed8f0c9f965c8b519e30433bf8 by pirama
[CoverageMapping] Handle gaps in counter IDs for source-based coverage

For source-based coverage, the frontend sets the counter IDs and the
constraints of counter IDs is not defined.  For e.g., the Rust frontend
until recently had a reserved counter #0
(  Rust coverage
instrumentation also creates counters on edges in addition to basic
blocks.  Some functions may have more counters than regions.

This breaks an assumption in CoverageMapping.cpp where the number of
counters in a function is assumed to be bounded by the number of
  Counts.assign(Record.MappingRegions.size(), 0);

This assumption causes CounterMappingContext::evaluate() to fail since
there are not enough counter values created in the above call to
`Counts.assign`.  Consequently, some uncovered functions are not
reported in coverage reports.

This change walks a Function's CoverageMappingRecord to find the maximum
counter ID, and uses it to initialize the counter array when instrprof
records are missing for a function in sparse profiles.

Differential Revision:
The file was modifiedllvm/lib/ProfileData/Coverage/CoverageMapping.cpp
The file was modifiedllvm/unittests/ProfileData/CoverageMappingTest.cpp
The file was modifiedllvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
Commit 29a50c5864ddab283c1ff38694fb5926ce37b39a by stephen.neuendorffer
[MLIR] Update Vector To LLVM conversion to be aware of assume_alignment

vector.transfer_read and vector.transfer_write operations are converted
to llvm intrinsics with specific alignment information, however there
doesn't seem to be a way in llvm to take information from llvm.assume
intrinsics and change this alignment information.  In any
event, due the to the structure of the llvm.assume instrinsic, applying
this information at the llvm level is more cumbersome.  Instead, let's
generate the masked vector load and store instrinsic with the right
alignment information from MLIR in the first place.  Since
we're bothering to do this, lets just emit the proper alignment for
loads, stores, scatter, and gather ops too.

Differential Revision:
The file was modifiedmlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
The file was modifiedmlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir
Commit 333c968d40039d261315efd3412d166672465a88 by spatel
[x86] update fma test with deprecated intrinsics; NFC

Similar to 8854b27 -

All of the CHECK lines should be identical to before,
but without any of the x86-specific calls that were
replaced with generic FMA long ago.

The file still has value because it shows a miscompile
as demonstrated in D90901, but we probably need to
add tests with FMF to make that explicit without
losing coverage.
The file was modifiedllvm/test/CodeGen/X86/fma-fneg-combine.ll
Commit 0f803657227d3a2086d7bb90d3119d3ed84f146c by cjdb
[libcxx][iterator][nfc] acquires lock for working on [range.iter.ops]

Differential Revision:
The file was modifiedlibcxx/docs/OneRangesProposalStatus.csv
Commit 9acabe8b6ff5abb9269bebac1da2d3c6ae2c99d2 by andrea.dibiagio
[MCA] Unbreak the buildbots by passing flag -mcpu=generic to the new test added by commit e5d59db469.

This should unbreak buildbot clang-ppc64le-linux-lnt.
The file was modifiedllvm/test/tools/llvm-mca/X86/cv_fpo_directive_no_segfault.s
Commit d8fad6614923eea684f736e7d22fe54d5393f13f by cjdb
[libcxx][ranges] adds concept `sized_range` and cleans up `ranges::size`

* adds `sized_range` and conformance tests
* moves `disable_sized_range` into namespace `std::ranges`
* removes explicit type parameter

Implements part of P0896 'The One Ranges Proposal'.

Differential Revision:
The file was modifiedlibcxx/test/std/containers/associative/multiset/range_concept_conformance.compile.pass.cpp
The file was removedlibcxx/test/std/ranges/range.range/sentinel_t.compile.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.view/view.compile.pass.cpp
The file was removedlibcxx/test/std/ranges/range.refinements/forward_range.compile.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.refinements/random_access_range.compile.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.view/view.subsumption.compile.pass.cpp
The file was removedlibcxx/test/std/ranges/range.range/iterator_t.compile.pass.cpp
The file was removedlibcxx/test/std/ranges/range.refinements/common_range.compile.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.refinements/common_range.compile.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.view/enable_view.compile.pass.cpp
The file was removedlibcxx/test/std/ranges/range.refinements/random_access_range.compile.pass.cpp
The file was modifiedlibcxx/include/__ranges/concepts.h
The file was modifiedlibcxx/test/std/input.output/filesystems/class.path/range_concept_conformance.compile.pass.cpp
The file was removedlibcxx/test/std/ranges/range.range/range.compile.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.range/iterator_t.compile.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.refinements/input_range.compile.pass.cpp
The file was modifiedlibcxx/test/std/ranges/range.access/range.prim/empty.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.range/enable_borrowed_range.compile.pass.cpp
The file was modifiedlibcxx/test/std/containers/sequences/vector/range_concept_conformance.compile.pass.cpp
The file was modifiedlibcxx/test/std/containers/unord/unord.multimap/range_concept_conformance.compile.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.sized/subsumption.compile.pass.cpp
The file was modifiedlibcxx/test/std/containers/associative/set/range_concept_conformance.compile.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.refinements/forward_range.compile.pass.cpp
The file was modifiedlibcxx/test/std/input.output/filesystems/class.directory_iterator/range_concept_conformance.compile.pass.cpp
The file was modifiedlibcxx/test/std/ranges/range.access/range.prim/size.pass.cpp
The file was modifiedlibcxx/test/std/containers/sequences/deque/range_concept_conformance.compile.pass.cpp
The file was modifiedlibcxx/test/std/containers/views/range_concept_conformance.compile.pass.cpp
The file was removedlibcxx/test/std/ranges/range.view/view_base.compile.pass.cpp
The file was removedlibcxx/test/std/ranges/range.view/enable_view.compile.pass.cpp
The file was modifiedlibcxx/test/std/containers/associative/map/range_concept_conformance.compile.pass.cpp
The file was modifiedlibcxx/test/std/strings/string.view/range_concept_conformance.compile.pass.cpp
The file was modifiedlibcxx/test/std/containers/sequences/array/range_concept_conformance.compile.pass.cpp
The file was modifiedlibcxx/include/ranges
The file was addedlibcxx/test/std/ranges/range.req/range.sized/sized_range.compile.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.view/view_base.compile.pass.cpp
The file was removedlibcxx/test/std/ranges/range.view/view.subsumption.compile.pass.cpp
The file was modifiedlibcxx/test/std/strings/basic.string/range_concept_conformance.compile.pass.cpp
The file was modifiedlibcxx/test/std/re/re.results/range_concept_conformance.compile.pass.cpp
The file was removedlibcxx/test/std/ranges/range.view/view.compile.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.range/helper_aliases.compile.pass.cpp
The file was modifiedlibcxx/test/std/containers/associative/multimap/range_concept_conformance.compile.pass.cpp
The file was modifiedlibcxx/test/std/containers/unord/
The file was removedlibcxx/test/std/ranges/range.refinements/input_range.compile.pass.cpp
The file was modifiedlibcxx/test/std/containers/sequences/forwardlist/range_concept_conformance.compile.pass.cpp
The file was modifiedlibcxx/include/__ranges/size.h
The file was removedlibcxx/test/std/ranges/range.range/helper_aliases.compile.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.refinements/bidirectional_range.compile.pass.cpp
The file was modifiedlibcxx/docs/OneRangesProposalStatus.csv
The file was modifiedlibcxx/test/std/containers/unord/unord.set/range_concept_conformance.compile.pass.cpp
The file was removedlibcxx/test/std/ranges/range.refinements/bidirectional_range.compile.pass.cpp
The file was modifiedlibcxx/test/std/containers/sequences/vector.bool/range_concept_conformance.compile.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.range/range.compile.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.range/sentinel_t.compile.pass.cpp
The file was addedlibcxx/test/std/ranges/range.req/range.refinements/subsumption.compile.pass.cpp
The file was modifiedlibcxx/test/std/containers/unord/unord.multiset/range_concept_conformance.compile.pass.cpp
The file was removedlibcxx/test/std/ranges/range.range/enable_borrowed_range.compile.pass.cpp
The file was modifiedlibcxx/test/std/containers/sequences/list/range_concept_conformance.compile.pass.cpp
The file was removedlibcxx/test/std/ranges/range.refinements/subsumption.compile.pass.cpp
Commit fd09a764ebc4dfd013292226480edcf0a604c4c4 by thakis
[lld/mac] Remove dead declaration
The file was modifiedlld/MachO/UnwindInfoSection.h
Commit f12f9beb04289f3ea1c1e9112609172e0b1b749b by spatel
[x86] propagate FMF from x86-specific intrinsic nodes to others during combining

This is another FMF gap exposed by D90901, but I don't see a way
to show the difference in a regression test as with:

We will see an asm difference if we add a test as part of D90901.
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.cpp
Commit 9b59a61cfc4eb033446da7dcdd6eb18714742ce8 by spatel
[x86] add tests for fma folds with fast-math-flags; NFC

Part of prep work for D90901
The file was modifiedllvm/test/CodeGen/X86/fma-fneg-combine.ll