FailedChanges

Summary

  1. [llvm-objcopy][MachO] Fix the calculation of the output size (details)
  2. [libc++] Allow running the tests in the experimental runtimes-only build (details)
  3. [clang][Frontend] Add missing error handling (details)
  4. [SourceManager] Avoid copying SLocEntry in computeMacroArgsCache (details)
  5. [libTooling] Add function to Transformer to create a no-op edit. (details)
  6. [AArch64][GlobalISel] Split post-legalizer combiner to allow for lowering at -O0 (details)
  7. [gn build] (semi-manually) port 147b9497e79 (details)
  8. [ELF] --warn-backrefs: save the referenced InputFile * (details)
  9. [AArch64][GlobalISel] Move imm adjustment for G_ICMP to post-legalizer lowering (details)
  10. DebugInfo: Use llc rather than %llc_dwarf when also hardcoding a target triple (details)
  11. [NFC][SampleFDO] Move some common stuff from SampleProfileReaderExtBinary/WriterExtBinary (details)
  12. [libc++abi] Fix the standalone build after the __config_site change (details)
  13. BitCodeFormat: update doc on new byref and mustprogress attrs; NFC (details)
  14. Fix constant evaluation of zero-initialization of a union whose first (details)
  15. Revert "[MBP] Add whole chain to BlockFilterSet instead of individual BB" (details)
  16. [OpenMP] Fixed a potential integer overflow (details)
  17. SourceManager: Factor out helpers for common SLocEntry lookup pattern, NFC (details)
  18. SourceManager: Change SourceManager::isMainFile to take a FileEntry, NFC (details)
  19. [Inliner] Run always-inliner in inliner-wrapper (details)
  20. DebugInfo: Tidy up test for more portability to MachO and Windows (details)
  21. [MC] Adjust StringTableBuilder for linked Mach-O binaries (details)
  22. SourceManager: getFileEntryRefForID => getNonBuiltinFilenameForID, NFC (details)
  23. SourceManager: Remove a redundant nullptr check in getNonBuiltinFilenameForID, NFC (details)
Commit 861429160ca74b1530ffa961b60b2b4fdb75eec2 by alexshap
[llvm-objcopy][MachO] Fix the calculation of the output size

Virtual sections do not contribute to the final output size.
This diff fixes the corresponding calculations in the method MachOWriter::totalSize.

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D89661
The file was addedllvm/test/tools/llvm-objcopy/MachO/virtual-section.test
The file was modifiedllvm/tools/llvm-objcopy/MachO/MachOWriter.cpp
Commit d098bb39aa615c3d3d97e3977dcc70b9de806a3f by Louis Dionne
[libc++] Allow running the tests in the experimental runtimes-only build
The file was modifiedlibcxx/utils/ci/runtimes/CMakeLists.txt
Commit fd14a1f6fff37ef62a35ca0f8bc630ac8b23516d by dblaikie
[clang][Frontend] Add missing error handling

Some early errors during the ASTUnit creation were not transferred to the `FailedParseDiagnostic` so when the code in `LoadFromCommandLine` swaps its content with the content of `StoredDiagnostics` they cannot be retrieved by the user in any way.

Reviewed By: andrewrk, dblaikie

Differential Revision: https://reviews.llvm.org/D78658
The file was modifiedclang/unittests/Frontend/ASTUnitTest.cpp
The file was modifiedclang/lib/Frontend/ASTUnit.cpp
Commit 8277a513c74b53e5ad7f482f76b27bc8609c66ae by Jan Korous
[SourceManager] Avoid copying SLocEntry in computeMacroArgsCache

Follow-up to e7870223d8b5

Differential Revision: https://reviews.llvm.org/D86230
The file was modifiedclang/lib/Basic/SourceManager.cpp
Commit 6f8f5cb77efd100e5d4916db871b18c88cf49ed0 by yitzhakm
[libTooling] Add function to Transformer to create a no-op edit.

This functionality is commonly needed in clang tidy checks (based on
transformer) that only print warnings, without suggesting any edits. The no-op
edit allows the user to associate a diagnostic message with a source location.

Differential Revision: https://reviews.llvm.org/D89961
The file was modifiedclang/lib/Tooling/Transformer/RewriteRule.cpp
The file was modifiedclang/include/clang/Tooling/Transformer/RewriteRule.h
The file was modifiedclang/unittests/Tooling/TransformerTest.cpp
Commit 147b9497e79a98a8614b2b5eb4ba653b44f6b6f0 by Jessica Paquette
[AArch64][GlobalISel] Split post-legalizer combiner to allow for lowering at -O0

There are a lot of combines in AArch64PostLegalizerCombiner which exist to
facilitate instruction matching in the selector. (E.g. matching for G_ZIP and
other shuffle vector pseudos)

It still makes sense to select these instructions at -O0.

Matching earlier in a combiner can reduce complexity in the selector
significantly. For example, a good portion of our selection code for compares
would be a lot easier to represent in a combine.

This patch moves matching combines into a "AArch64PostLegalizerLowering"
combiner which runs at all optimization levels.

Also, while we're here, improve the documentation for the
AArch64PostLegalizerCombiner, and fix up the filepath in its file comment.

And also add a 'r' which somehow got dropped from a bunch of function names.

https://reviews.llvm.org/D89820
The file was modifiedllvm/lib/Target/AArch64/AArch64Combine.td
The file was modifiedllvm/lib/Target/AArch64/GISel/AArch64PostLegalizerCombiner.cpp
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-lowering-ext.mir
The file was modifiedllvm/lib/Target/AArch64/GISel/AArch64PreLegalizerCombiner.cpp
The file was removedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-zip.mir
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-lowering-shuffle-splat.mir
The file was modifiedllvm/test/CodeGen/AArch64/O0-pipeline.ll
The file was modifiedllvm/lib/Target/AArch64/CMakeLists.txt
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-lowering-rev.mir
The file was removedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-shuffle-splat.mir
The file was removedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-trn.mir
The file was removedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-uzp.mir
The file was addedllvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
The file was removedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-ext.mir
The file was modifiedllvm/lib/Target/AArch64/AArch64.h
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-lowering-uzp.mir
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-lowering-zip.mir
The file was removedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-vashr-vlshr.mir
The file was removedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-rev.mir
The file was modifiedllvm/lib/Target/AArch64/AArch64TargetMachine.cpp
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-lowering-vashr-vlshr.mir
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-lowering-trn.mir
Commit 3fbf9d10fdf21abedfd68bf53ad7098c00c6850c by thakis
[gn build] (semi-manually) port 147b9497e79
The file was modifiedllvm/utils/gn/secondary/llvm/lib/Target/AArch64/BUILD.gn
Commit ce3c5dae06566eb3ae31e44a459cc8c9cb9e060d by i
[ELF] --warn-backrefs: save the referenced InputFile *

For a diagnostic `A refers to B` where B refers to a bitcode file, if the
symbol gets optimized out, the user may see `A refers to <internal>`; if the
symbol is retained, the user may see `A refers to lto.tmp`.

Save the reference InputFile * in the DenseMap so that the original filename is
available in reportBackrefs().
The file was modifiedlld/ELF/Symbols.cpp
The file was modifiedlld/ELF/Symbols.h
The file was addedlld/test/ELF/lto/warn-backrefs.ll
Commit 19dc9c97804fdb658b06f80b8f6e9115b7542bd5 by Jessica Paquette
[AArch64][GlobalISel] Move imm adjustment for G_ICMP to post-legalizer lowering

Move the code which adjusts the immediate/predicate on a G_ICMP to
AArch64PostLegalizerLowering.

This

- Reduces the number of places we need to test for optimized compares in the
selector. We know that the compare should have been simplified by the time it
hits the selector, so we can avoid testing this in selects, brconds, etc.

- Allows us to potentially fold more compares (previously, this optimization
was only done after calling `tryFoldCompare`, this may allow us to hit some more
TST cases)

- Simplifies the selection code in `emitIntegerCompare` significantly; we can
just use an emitSUBS function.

- Allows us to avoid checking that the predicate has been updated after
`emitIntegerCompare`.

Also add a utility header file for things that may be useful in the selector
and various combiners. No need for an implementation file at this point, since
it's just one constexpr function for now. I've run into a couple cases where
having one of these would be handy, so might as well add it here. There are
a couple functions in the selector that can probably be factored out into
here.

Differential Revision: https://reviews.llvm.org/D89823
The file was modifiedllvm/lib/Target/AArch64/AArch64Combine.td
The file was modifiedllvm/test/CodeGen/AArch64/GlobalISel/fold-select.mir
The file was modifiedllvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
The file was removedllvm/test/CodeGen/AArch64/GlobalISel/select-arith-immed-compare.mir
The file was modifiedllvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-lowering-adjust-icmp-imm.mir
The file was modifiedllvm/test/CodeGen/AArch64/GlobalISel/tbz-sgt.mir
The file was modifiedllvm/test/CodeGen/AArch64/GlobalISel/select-cbz.mir
The file was addedllvm/lib/Target/AArch64/GISel/AArch64GlobalISelUtils.h
Commit c2730e6b36a1806dcc4fa3e90674b974d5b8931e by dblaikie
DebugInfo: Use llc rather than %llc_dwarf when also hardcoding a target triple
The file was modifiedllvm/test/DebugInfo/X86/convert-debugloc.ll
Commit 93953d411a0fc240e10237fea34aaff43e8f0ff5 by wmi
[NFC][SampleFDO] Move some common stuff from SampleProfileReaderExtBinary/WriterExtBinary
to their parent classes.

SampleProfileReaderExtBinary/SampleProfileWriterExtBinary specify the typical
section layout currently used by SampleFDO. Currently a lot of section
reader/writer stay in the two classes. However, as we expect to have more
types of SampleFDO profiles, we hope those new types of profiles can share
the common sections while configuring their own sections easily with minimal
change. That is why I move some common stuff from
SampleProfileReaderExtBinary/SampleProfileWriterExtBinary to
SampleProfileReaderExtBinaryBase/SampleProfileWriterExtBinaryBase so new
profiles class inheriting from the base class can reuse them.

Differential Revision: https://reviews.llvm.org/D89524
The file was modifiedllvm/lib/ProfileData/SampleProfReader.cpp
The file was modifiedllvm/include/llvm/ProfileData/SampleProfReader.h
The file was modifiedllvm/lib/ProfileData/SampleProfWriter.cpp
The file was modifiedllvm/include/llvm/ProfileData/SampleProfWriter.h
Commit 529ac33197f6408952ae995075ac5e2dc5287e81 by Louis Dionne
[libc++abi] Fix the standalone build after the __config_site change

In 5d796645, we stopped looking at the LIBCXXABI_LIBCXX_INCLUDES variable,
which broke users of the Standalone build. This patch reinstates that
variable, however it must point to the *installed* path of the libc++
headers, not the libc++ headers in the source tree (which has always
been the case, but wasn't enforced before).

If LIBCXXABI_LIBCXX_INCLUDES points to the libc++ headers in the source
tree, the `__config_site` header will fail to be found.
The file was modifiedlibcxxabi/CMakeLists.txt
The file was modifiedlibcxxabi/test/lit.site.cfg.in
The file was modifiedlibcxxabi/test/libcxxabi/test/config.py
Commit 4abaf0ec0a3c5862f4074d126c4b44ef46bc6186 by ndesaulniers
BitCodeFormat: update doc on new byref and mustprogress attrs; NFC

Forked from review of:
https://reviews.llvm.org/D87956
The file was modifiedllvm/docs/BitCodeFormat.rst
Commit af189c8ab113668434eae5c71f174613a9e64625 by richard
Fix constant evaluation of zero-initialization of a union whose first
FieldDecl is an unamed bitfield.

Unnamed bitfields aren't non-static data member, so such a bitfield
isn't actually the first non-static data member.
The file was modifiedclang/test/SemaCXX/constant-expression-cxx11.cpp
The file was modifiedclang/lib/AST/ExprConstant.cpp
Commit e42f6c0ac05bae37be8e2a5fd8861773646eae1b by shenhan
Revert "[MBP] Add whole chain to BlockFilterSet instead of individual BB"

This reverts commit adfb5415010fbbc009a4a6298cfda7a6ed4fa6d4.

This is reverted because it caused an chrome error: https://crbug.com/1140168
The file was modifiedllvm/lib/CodeGen/MachineBlockPlacement.cpp
The file was removedllvm/test/CodeGen/X86/block_set.ll
Commit 3091ed099f2f6a3d16dbdae7d0406f54dfc3031f by tianshilei1992
[OpenMP] Fixed a potential integer overflow

`size_t` has different width on 32- and 64-bit architecture, but the
computation to floor to power of two assumed it is 64-bit, which can cause an
integer overflow. In this patch, architecture detection is added so that the
operation for 64-bit `size_t`. Thank Luke for reporting the issue.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D89878
The file was modifiedopenmp/libomptarget/src/MemoryManager.cpp
Commit b6c6daa95d3aa2206d5a42b46793226f181c3e44 by Duncan P. N. Exon Smith
SourceManager: Factor out helpers for common SLocEntry lookup pattern, NFC

Add helpers `getSLocEntryOrNull`, which handles the `Invalid` logic
around `getSLocEntry`, and `getSLocEntryForFile`, which also checks for
`SLocEntry::isFile`, and use them to reduce repeated code.

Differential Revision: https://reviews.llvm.org/D89503
The file was modifiedclang/lib/Basic/SourceManager.cpp
The file was modifiedclang/include/clang/Basic/SourceManager.h
Commit 168db92465c504974274302a6a1a5d4a1580ccfe by Duncan P. N. Exon Smith
SourceManager: Change SourceManager::isMainFile to take a FileEntry, NFC

`SourceManager::isMainFile` does not use the filename, so it doesn't
need the full `FileEntryRef`; in fact, it's misleading to take the name
because that makes it look relevant. Simplify the API, and in the
process remove some calls to `FileEntryRef::FileEntryRef` in the unit
tests (which were blocking making that private to `SourceManager`).

Differential Revision: https://reviews.llvm.org/D89507
The file was modifiedclang/include/clang/Basic/SourceManager.h
The file was modifiedclang/lib/Lex/PPDirectives.cpp
The file was modifiedclang/lib/Basic/SourceManager.cpp
The file was modifiedclang/unittests/Basic/SourceManagerTest.cpp
Commit 0291e2c9330930bd74bfb8206cf6447a84bf492c by aeubanks
[Inliner] Run always-inliner in inliner-wrapper

An alwaysinline function may not get inlined in inliner-wrapper due to
the inlining order.

Previously for the following, the inliner would first inline @a() into @b(),

```
define void @a() {
entry:
  call void @b()
  ret void
}

define void @b() alwaysinline {
entry:
  br label %for.cond

for.cond:
  call void @a()
  br label %for.cond
}
```

making @b() recursive and unable to be inlined into @a(), ending at

```
define void @a() {
entry:
  call void @b()
  ret void
}

define void @b() alwaysinline {
entry:
  br label %for.cond

for.cond:
  call void @b()
  br label %for.cond
}
```

Running always-inliner first makes sure that we respect alwaysinline in more cases.

Fixes https://bugs.llvm.org/show_bug.cgi?id=46945.

Reviewed By: davidxl, rnk

Differential Revision: https://reviews.llvm.org/D86988
The file was modifiedllvm/test/Other/new-pm-defaults.ll
The file was modifiedllvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
The file was modifiedllvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
The file was modifiedllvm/test/Other/scc-deleted-printer.ll
The file was modifiedllvm/test/Other/new-pm-thinlto-defaults.ll
The file was modifiedllvm/test/Transforms/Inline/inline_stats.ll
The file was modifiedllvm/test/Other/new-pm-lto-defaults.ll
The file was modifiedllvm/lib/Transforms/IPO/Inliner.cpp
The file was modifiedllvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
The file was addedllvm/test/Transforms/Inline/pr46945.ll
The file was addedllvm/test/Other/new-pm-module-inliner-wrapper.ll
The file was modifiedllvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
Commit a89297feb5770c5cd8253fcb976035b0a76deb83 by dblaikie
DebugInfo: Tidy up test for more portability to MachO and Windows

*fingers crossed*
The file was modifiedllvm/test/DebugInfo/X86/convert-debugloc.ll
Commit 27e11d7120c0caa20a167b44ba29828446a525c0 by alexshap
[MC] Adjust StringTableBuilder for linked Mach-O binaries

LD64 emits string tables which start with a space and a zero byte.
This diff adjusts StringTableBuilder for linked Mach-O binaries to match LD64's behavior.

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D89561
The file was modifiedllvm/include/llvm/MC/StringTableBuilder.h
The file was modifiedllvm/unittests/MC/StringTableBuilderTest.cpp
The file was modifiedllvm/test/tools/llvm-objcopy/MachO/segments-vmsize.test
The file was modifiedllvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp
The file was modifiedllvm/lib/MC/StringTableBuilder.cpp
The file was modifiedllvm/test/tools/llvm-objcopy/MachO/basic-little-endian-64-copy.test
The file was modifiedllvm/test/tools/llvm-objcopy/MachO/symbol-table.test
The file was modifiedllvm/include/llvm/MC/MCMachObjectWriter.h
The file was modifiedllvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.h
The file was modifiedllvm/test/tools/llvm-objcopy/MachO/code_signature_lc.test
The file was modifiedllvm/test/tools/llvm-objcopy/MachO/basic-big-endian-64-copy.test
The file was modifiedllvm/test/tools/llvm-objcopy/MachO/remove-swift-symbols.test
Commit cf593d224c9c3fc2cf93827cb66fd9e550a6a486 by Duncan P. N. Exon Smith
SourceManager: getFileEntryRefForID => getNonBuiltinFilenameForID, NFC

`SourceManager::getFileEntryRefForID`'s remaining callers just want the
filename component, which is coming from the `FileInfo`. Replace the API
with `getNonBuiltinFilenameForID`, which also removes another use of
`FileEntryRef::FileEntryRef` outside of `FileManager`.

Both callers are collecting file dependencies, and one of them relied on
this API to filter out built-ins (as exposed by
clang/test/ClangScanDeps/modules-full.cpp). It seems nice to continue
providing that service.

Differential Revision: https://reviews.llvm.org/D89508
The file was modifiedclang/lib/Frontend/DependencyFile.cpp
The file was modifiedclang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
The file was modifiedclang/lib/Basic/SourceManager.cpp
The file was modifiedclang/include/clang/Basic/SourceManager.h
Commit 3b8d8954bf2c192502d757019b9fe434864068e9 by Duncan P. N. Exon Smith
SourceManager: Remove a redundant nullptr check in getNonBuiltinFilenameForID, NFC
The file was modifiedclang/lib/Basic/SourceManager.cpp