Kazu Hirata [Mon, 31 Jan 2022 00:05:00 +0000 (16:05 -0800)]
[clang-tools-extra] Remove unused forward declarations (NFC)
Kazu Hirata [Mon, 31 Jan 2022 00:04:58 +0000 (16:04 -0800)]
[Analysis] Drop an unnecessary const from a return type (NFC)
Identified with readability-const-return-type.
Kazu Hirata [Mon, 31 Jan 2022 00:04:56 +0000 (16:04 -0800)]
[llvm] Use = default (NFC)
Fangrui Song [Sun, 30 Jan 2022 23:18:30 +0000 (15:18 -0800)]
[mlgo][regalloc] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after
a8a7bf922cea8af01168f7a4adf4ed0365bcc2b4
Fangrui Song [Sun, 30 Jan 2022 23:12:09 +0000 (15:12 -0800)]
[ELF] Simplify SectionBase::partition handling and make it live by default. NFC
Previously an InputSectionBase is dead (`partition==0`) by default.
SyntheticSection calls markLive and BssSection overrides that with markDead.
It is more natural to make InputSectionBase live by default and let
--gc-sections mark InputSectionBase dead.
When linking a Release build of clang:
* --no-gc-sections:, the removed `inputSections` loop decreases markLive time from 4ms to 1ms.
* --gc-sections: the extra `inputSections` loop increases markLive time from 0.181296s to 0.188526s.
This is as of we lose the removing one `inputSections` loop optimization (
4374824ccf6e7ae68264d996a9ae5bb5e3be7fc5).
I believe the loss can be mitigated if we refactor markLive.
Mircea Trofin [Sun, 30 Jan 2022 22:56:38 +0000 (14:56 -0800)]
[mlgo][regalloc] Fix register masking
If AllocationOrder has less than 32 elements, we were treating the extra
positions as if they were valid. This was detected by a subsequent
assert. The fix also tightens the asserts.
Alexandre Ganea [Sun, 30 Jan 2022 22:31:26 +0000 (17:31 -0500)]
[mlir] Silence warnings when building with MSVC
Differential Revision: https://reviews.llvm.org/D118536
Sanjoy Das [Sun, 30 Jan 2022 02:41:10 +0000 (18:41 -0800)]
Replace OwningModuleRef with OwningOpRef<ModuleOp>
This addresses a TODO in BuiltinOps.h.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D118574
Fangrui Song [Sun, 30 Jan 2022 21:34:27 +0000 (13:34 -0800)]
[ELF] Change splitSections to objectFiles based parallelForEach. NFC
The work is more balanced.
Craig Topper [Sun, 30 Jan 2022 21:18:43 +0000 (13:18 -0800)]
[RISCV] Lower riscv_zip/unzip intrinsic to RISCVISD::SHFL/UNSHFL.
These are special versions of the more general shfli/unshfli
instructions. We can use the general ISD opcodes with the correct
immediates.
Markus Böck [Sun, 30 Jan 2022 21:08:53 +0000 (22:08 +0100)]
[Support][NFC] Fix generic `ChildrenGetterTy` of `IDFCalculatorBase`
Both IDFCalculatorBase and its accompanying DominatorTreeBase only supports pointer nodes. The template argument is the block type itself and any uses of GraphTraits is therefore done via a pointer to the node type.
However, the ChildrenGetterTy type of IDFCalculatorBase has a use on just the node type instead of a pointer to the node type. Various parts of the monorepo has worked around this issue by providing specializations of GraphTraits for the node type directly, or not been affected by using specializations instead of the generic case. These are unnecessary however and instead the generic code should be fixed instead.
An example from within Tree is eg. A use of IDFCalculatorBase in InstrRefBasedImpl.cpp. It basically instantiates a IDFCalculatorBase<MachineBasicBlock, false> but due to the bug above then goes on to specialize GraphTraits<MachineBasicBlock> although GraphTraits<MachineBasicBlock*> exists (and should be used instead).
Similar dead code exists in clang which defines redundant GraphTraits to work around this bug.
This patch fixes both the original issue and removes the dead code that was used to work around the issue.
Differential Revision: https://reviews.llvm.org/D118386
Craig Topper [Sun, 30 Jan 2022 20:36:15 +0000 (12:36 -0800)]
[RISCV] Custom lower brev8 intrinsic to RISCVISD::GREV.
We can use the RISCVISD::GREV encoding that swaps the bits in
each byte. This allows it to use the existing computeKnownBits
support for RISCVISD::GREV.
Kazu Hirata [Sun, 30 Jan 2022 20:32:59 +0000 (12:32 -0800)]
[OpenMP] Use nullptr instead of NULL (NFC)
Identified with modernize-use-nullptr.
Kazu Hirata [Sun, 30 Jan 2022 20:32:57 +0000 (12:32 -0800)]
[Analysis] Use != to compare strings (NFC)
Identified with readability-string-compare.
Kazu Hirata [Sun, 30 Jan 2022 20:32:55 +0000 (12:32 -0800)]
[clang] Remove redundant string initialization (NFC)
Identified with readability-redundant-string-init.
Kazu Hirata [Sun, 30 Jan 2022 20:32:53 +0000 (12:32 -0800)]
[lldb] Forward-declare ClangExpressionParser (NFC)
ClangUserExpression.h is relying on the forward declaration of
ClangExpressionParser in ClangFunctionCaller.h. This patch moves the
forward declaration to ClangUserExpression.h.
Kazu Hirata [Sun, 30 Jan 2022 20:32:51 +0000 (12:32 -0800)]
[CodeGen] Use default member initialization (NFC)
Identified with modernize-use-default-member-init.
Simon Pilgrim [Sun, 30 Jan 2022 20:06:59 +0000 (20:06 +0000)]
[X86] combineVectorTruncation - use PACKUSDW(BLENDW(X,0),BLENDW(Y,0)) for v8i32->v8i16 truncation
Limit this to SSE41 - AVX1 targets to avoid UNPCKL(PSHUFB,PSHUFB), pre-SSE41 we don't have PACKUSDW/BLENDW and with AVX2 we can perform this as PERMQ(PSHUFB()).
Anatoly Trosinenko [Sun, 30 Jan 2022 18:23:00 +0000 (21:23 +0300)]
[compiler-rt][builtins] Use c[tl]zsi macro instead of __builtin_c[tl]z
`__builtin_c[tl]z` accepts `unsigned int` argument that is not always the
same as uint32_t. For example, `unsigned int` is uint16_t on MSP430.
Reviewed By: aykevl
Differential Revision: https://reviews.llvm.org/D86547
Matthias Springer [Sun, 30 Jan 2022 20:01:24 +0000 (05:01 +0900)]
[mlir][bufferize] Clean up remaining references to `tensor-constant-bufferize`
Philip Sigillito [Sun, 30 Jan 2022 19:45:32 +0000 (20:45 +0100)]
[clang-format] Handle C variables with name that matches c++ access specifier
Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D117416
Mehdi Amini [Sun, 30 Jan 2022 11:24:36 +0000 (11:24 +0000)]
Apply clang-tidy fixes for llvm-include-order in AttrOrTypeFormatGen.cpp (NFC)
Mehdi Amini [Sun, 30 Jan 2022 10:59:42 +0000 (10:59 +0000)]
Apply clang-tidy fixes for performance-move-const-arg in TestLinalgCodegenStrategy.cpp (NFC)
Mehdi Amini [Sun, 30 Jan 2022 10:17:41 +0000 (10:17 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in TosaOps.cpp (NFC)
Mehdi Amini [Sun, 30 Jan 2022 09:56:28 +0000 (09:56 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in PolynomialApproximation.cpp (NFC)
Mehdi Amini [Sun, 30 Jan 2022 09:41:27 +0000 (09:41 +0000)]
Apply clang-tidy fixes for performance-for-range-copy in SCFInterfaceImpl.cpp (NFC)
Mehdi Amini [Sun, 30 Jan 2022 09:34:39 +0000 (09:34 +0000)]
Apply clang-tidy fixes for modernize-use-equals-default in BufferizableOpInterface.cpp (NFC)
Mehdi Amini [Sun, 30 Jan 2022 09:03:19 +0000 (09:03 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in AsyncToLLVM.cpp (NFC)
Anatoly Trosinenko [Sun, 30 Jan 2022 16:28:08 +0000 (19:28 +0300)]
[compiler-rt][builtins] Use explicitly-sized integer types for LibCalls
Use s[iu]_int instead of `(unsigned) int` and d[ui]_int instead of
`(unsigned) long long` for LibCall arguments.
Note: the `*vfp` LibCall versions were NOT touched.
Reviewed By: aykevl
Differential Revision: https://reviews.llvm.org/D86546
Keith Smiley [Sat, 29 Jan 2022 02:46:51 +0000 (18:46 -0800)]
[lld-macho] Add support for -add_empty_section
This is a ld64 option equivalent to `-sectcreate seg sect /dev/null`
that's useful for creating sections like the RESTRICT section.
Differential Revision: https://reviews.llvm.org/D117749
Simon Pilgrim [Sun, 30 Jan 2022 17:59:05 +0000 (17:59 +0000)]
[X86][AVX] matchUnaryShuffle - avoid creation of on-the-fly nodes (PR45974)
Don't extract the ANY/ZERO_EXTEND_VECTOR_INREG subvector source until we're definitely combining to a new node.
Keith Smiley [Sat, 29 Jan 2022 01:03:02 +0000 (17:03 -0800)]
[test][lld-macho] Improve LC_FUNCTION_STARTS test coverage
Previously functions that aren't included in the symtab were also
excluded from the function starts. Symbols missing from function starts
degrades the debugger experience in the case you don't have debug info
for them.
Differential Revision: https://reviews.llvm.org/D114275
Simon Pilgrim [Sun, 30 Jan 2022 15:53:21 +0000 (15:53 +0000)]
[X86] Attempt to fold MOVMSK(CMPEQ(AND(X,C1),0)) -> MOVMSK(NOT(SHL(X,C2)))
Allows pow2 mask tests to avoid an unnecessary constant load.
Noticed while investigating how to extend MatchVectorAllZeroTest to support more allof/anyof patterns.
Simon Pilgrim [Sun, 30 Jan 2022 15:25:07 +0000 (15:25 +0000)]
[X86] Add tests showing failure to fold MOVMSK(CMPEQ(AND(X,C1),0)) -> MOVMSK(NOT(SHL(X,C2)))
This would allow pow2 mask tests to avoid an unnecessary constant load.
Noticed while investigating how to extend MatchVectorAllZeroTest to support more allof/anyof patterns.
Ricky Zhou [Sun, 30 Jan 2022 15:05:11 +0000 (10:05 -0500)]
[InstCombine] Do not combine atomic and non-atomic loads
Before this change, InstCombine was willing to fold atomic and
non-atomic loads through a PHI node as long as the first PHI argument
is not an atomic load. The combined load would be non-atomic, which is
incorrect.
Fix this by only combining the loads in a PHI node when all of the
arguments are non-atomic loads.
Thanks to Eli Friedman for pointing out the bug at
https://github.com/llvm/llvm-project/issues/50777#issuecomment-
981045342!
Fixes #50777
Differential Revision: https://reviews.llvm.org/D115113
Ricky Zhou [Sun, 30 Jan 2022 15:03:49 +0000 (10:03 -0500)]
[InstCombine] Add test reproducing PR51435 (NFC)
Baseline test for D115113
Differential Revision: https://reviews.llvm.org/D118554
Sanjay Patel [Sun, 30 Jan 2022 15:02:20 +0000 (10:02 -0500)]
Revert "[InstCombine] Do not combine atomic and non-atomic loads"
This reverts commit
a2bb7313e62daa8aaa9b06fe57386ed7221a990a.
The baseline test was not pre-committed as expected.
Ricky Zhou [Sun, 30 Jan 2022 14:28:56 +0000 (09:28 -0500)]
[InstCombine] Do not combine atomic and non-atomic loads
Before this change, InstCombine was willing to fold atomic and
non-atomic loads through a PHI node as long as the first PHI argument
is not an atomic load. The combined load would be non-atomic, which is
incorrect.
Fix this by only combining the loads in a PHI node when all of the
arguments are non-atomic loads.
Thanks to Eli Friedman for pointing out the bug at
https://github.com/llvm/llvm-project/issues/50777#issuecomment-
981045342!
Fixes #50777
Differential Revision: https://reviews.llvm.org/D115113
Ricky Zhou [Sun, 30 Jan 2022 14:08:42 +0000 (09:08 -0500)]
[InstCombine] Use range for loops (NFC)
Preliminary clean-up for D115113
Differential Revision: https://reviews.llvm.org/D116086
Ricky Zhou [Sun, 30 Jan 2022 13:57:48 +0000 (08:57 -0500)]
[InstCombine] Uppercase some variable names (NFC)
Uppercase some variable names, per LLVM coding standards. This change
intentionally does not rename every miscased variable, as a follow-up
change ( D116086 ) intends to eliminate many of those by switching
loops to range for loops.
Differential Revision: https://reviews.llvm.org/D118553
Matthias Springer [Sun, 30 Jan 2022 13:19:06 +0000 (22:19 +0900)]
[mlir][linalg][bufferize] Fix insertion point InitTensorElimination
There was a bug where some of the OpOperands needed in the replacement op were not in scope.
It does not matter where the replacement op is inserted. Any insertion point is OK as long as there are no dominance errors. In the worst case, the newly inserted op will bufferize out-of-place. This is no worse than not eliminating the InitTensorOp at all.
Differential Revision: https://reviews.llvm.org/D117685
Mark de Wever [Sun, 30 Jan 2022 13:21:13 +0000 (14:21 +0100)]
[libc++][format][nfc] Move tests.
The formatter specialization tests were placed in the wrong
subdirectory. This moves them to the proper place.
Mark de Wever [Sat, 22 Jan 2022 11:34:44 +0000 (12:34 +0100)]
[libc++][doc] Update the release notes.
I had a look at the changes since the last release and updated the
release notes with interesting changes.
It seems this time the release notes were already rather up to date :-)
If there are more interesting changes, please let me know and I'll
update the patch. I'd like to commit these changes latest next weekend
so they land before branching the 14.0 release.
I've added most active libc++ contributors. If I forgot anybody please add them.
Reviewed By: Quuxplusone, ldionne, philnik, #libc
Differential Revision: https://reviews.llvm.org/D117948
Matthias Springer [Sun, 30 Jan 2022 13:02:22 +0000 (22:02 +0900)]
[mlir][bufferize][NFC] Move std BufferizableOpInterfaceImpl to std dialect
Also reimplement `std-bufferize` in terms of BufferizableOpInterface-based bufferization. The old `std.select` bufferization pattern is no longer needed and deleted.
Differential Revision: https://reviews.llvm.org/D118559
Florian Hahn [Sun, 30 Jan 2022 13:07:29 +0000 (13:07 +0000)]
[VPlan] Use VPlan to check if only the first lane is used.
This removes the remaining dependence on LoopVectorizationCostModel from
buildScalarSteps and is required so it can be moved out of ILV.
It also improves allows us to remove a few unneeded instructions.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D116554
Matthias Springer [Sun, 30 Jan 2022 12:53:02 +0000 (21:53 +0900)]
[mlir][bufferize][NFC] Move scf BufferizableOpInterface impl to scf dialect
Differential Revision: https://reviews.llvm.org/D118557
Matthias Springer [Sun, 30 Jan 2022 12:48:37 +0000 (21:48 +0900)]
Update BUILD.bazel.
This should have been done as part of D118483.
Matthias Springer [Sun, 30 Jan 2022 12:23:28 +0000 (21:23 +0900)]
[mlir][bufferize] Merge tensor-constant-bufferize into arith-bufferize
The bufferization of arith.constant ops is also switched over to BufferizableOpInterface-based bufferization. The old implementation is deleted. Both implementations utilize GlobalCreator, now renamed to just `getGlobalFor`.
GlobalCreator no longer maintains a set of all created allocations to avoid duplicate allocations of the same constant. Instead, `getGlobalFor` scans the module to see if there is already a global allocation with the same constant value.
For compatibility reasons, it is still possible to create a pass that bufferizes only `arith.constant`. This pass (createConstantBufferizePass) could be deleted once all users were switched over to One-Shot bufferization.
Differential Revision: https://reviews.llvm.org/D118483
Nuno Lopes [Sun, 30 Jan 2022 11:34:32 +0000 (11:34 +0000)]
[InstCombine] remove incorrect gep(x, undef) -> undef optimization
gep(x, undef) carries the provenance of x, so we can't replace it with any
pointer like undef.
This leaves room for improvement for the poison case, but that's currently
not possible as the demanded bits API doesn't distinguish between undef &
poison bits.
Fixes #44790
Nuno Lopes [Sun, 30 Jan 2022 10:46:54 +0000 (10:46 +0000)]
[InstSimplify] fold 'xor X, poison' and 'div/rem X, poison' to poison
Nuno Lopes [Sun, 30 Jan 2022 10:04:00 +0000 (10:04 +0000)]
[NewGVN][NFC] add poison tests
Fangrui Song [Sun, 30 Jan 2022 09:18:41 +0000 (01:18 -0800)]
[ELF] copyShtGroup: replace unordered_set<uint32_t> with DenseSet<uint32_t>. NFC
We don't need to support the empty/tombstone key section index.
Fangrui Song [Sun, 30 Jan 2022 09:11:19 +0000 (01:11 -0800)]
[ELF] crtbegin/crtend test: replace std::regex with hand-written matcher. NFC
My x86-64 lld executable is 18KiB smaller.
Fangrui Song [Sun, 30 Jan 2022 09:08:09 +0000 (01:08 -0800)]
[ELF][test] Test {crtbegin,crtend}{S,T}.o
Fangrui Song [Sun, 30 Jan 2022 08:44:19 +0000 (00:44 -0800)]
[ELF] Simplify maybeCompress with lld::split. NFC
Fangrui Song [Sun, 30 Jan 2022 08:10:52 +0000 (00:10 -0800)]
[ELF] Optimize MergeInputSection::splitNonStrings with resize_for_overwrite. NFC
Fangrui Song [Sun, 30 Jan 2022 07:55:29 +0000 (23:55 -0800)]
[ELF] Add some Mips*Section to InStruct and change make<Mips*Section> to std::make_unique
Similar to D116143. My x86-64 lld executable is 20+KiB smaller.
Fangrui Song [Sun, 30 Jan 2022 07:35:15 +0000 (23:35 -0800)]
[ELF] Remove make<std::unique_ptr<MemoryBuffer>>. NFC
Fangrui Song [Sun, 30 Jan 2022 07:05:54 +0000 (23:05 -0800)]
[ELF] De-template getErrorPlace. NFC
Craig Topper [Sun, 30 Jan 2022 06:19:15 +0000 (22:19 -0800)]
[RISCV] Remove RISCVISD::BREV8 and use RISCVISD::GREV instead.
We already have an ISD opcode for the more general GREV/GREVI
instructon. We can just use it with the encoding that corresponds
to the behavior of brev8. This is similar to what we do for orc.b
where we use the GORC ISD opcode.
Craig Topper [Sun, 30 Jan 2022 05:15:11 +0000 (21:15 -0800)]
[RISCV] Rerrange RISCVInstrInfoZB.td to better group related wthings. NFC
Especially placing W instructions/patterns near their non-W versions.
Fangrui Song [Sun, 30 Jan 2022 04:11:59 +0000 (20:11 -0800)]
[ELF] De-template getAndFeatures. NFC
Richard [Sat, 29 Jan 2022 01:14:33 +0000 (18:14 -0700)]
[clang-tidy] Organize the release notes a little better
- Sort new checks by check name
- Sort changes to existing checks by check name
- Add docs for changes to readability-simplify-boolean-expr
- Move check changes from "Improvements to clang-tidy" to
"Changes in existing checks" section
Differential Revision: https://reviews.llvm.org/D118519
Fangrui Song [Sun, 30 Jan 2022 03:31:09 +0000 (19:31 -0800)]
[ELF] Make errorOrWarn opaque to decrease code size. NFC
In my x86-64 lld, .text is -3.08Ki smaller.
Craig Topper [Sun, 30 Jan 2022 02:26:20 +0000 (18:26 -0800)]
[RISCV] Use RVBUnary to simplify ZEXT_H_RV32/ZEXT_H_RV64 definitions. NFC
Ben Shi [Fri, 28 Jan 2022 10:09:12 +0000 (10:09 +0000)]
[clang][AVR] Set '-fno-use-cxa-atexit' to default
AVR is baremetal environment, so the avr-libc does not support
'__cxa_atexit()'.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D118445
Ben Shi [Sat, 29 Jan 2022 12:42:06 +0000 (12:42 +0000)]
[Clang] Move XCore specific options from Clang.cpp to XCore.cpp
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D118535
Fangrui Song [Sun, 30 Jan 2022 02:01:58 +0000 (18:01 -0800)]
[ELF] Optimize obj.getSectionIndex. NFC
Fangrui Song [Sun, 30 Jan 2022 01:00:38 +0000 (17:00 -0800)]
[ELF] Simplify eSyms. NFC
Fangrui Song [Sun, 30 Jan 2022 00:52:32 +0000 (16:52 -0800)]
[ELF] createInputSection: remove unneeded argument. NFC
Fangrui Song [Sun, 30 Jan 2022 00:51:00 +0000 (16:51 -0800)]
[ELF] Avoid repeated getObj construction in getSectionIndex. NFC
Fangrui Song [Sun, 30 Jan 2022 00:20:40 +0000 (16:20 -0800)]
[ELF] Reorder InputSectionBase::parent. NFC
Move it before others.
Fangrui Song [Sun, 30 Jan 2022 00:10:52 +0000 (16:10 -0800)]
[ELF] Reorder InputFile members. NFC
`symbols` is used frequently. Moving it before others can decrease offsets.
John Ericson [Fri, 28 Jan 2022 18:21:21 +0000 (18:21 +0000)]
[openmp][cmake] `CMAKE_INSTALL_BINDIR` usage should not be quoted
As @mstorsjo wrote in https://reviews.llvm.org/D117945#inline-1132920 :
> This change seems to have broken one aspect: When doing `ninja
install` I now get a warning saying `Error copying file "libomp.dll" to
"libiomp5md.dll".`, and `libiomp5md.dll` isn't installed.
>
> I believe the reason is that the inline cmake snippet is written to
`runtime/src/cmake_install.cmake` and then executed on install, but on
install, `${CMAKE_INSTALL_BINDIR}` isn't set (as `GNUInstallDirs` isn't
included there). Should this maybe expand `${CMAKE_INSTALL_BINDIR}`
right here instead of deferring it to the install cmake, or what's the
right course of action?
I agree that is the right course of action. We also agreed to restore the `CMAKE_INSTALL_PREFIX` that was there before, too.
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D118528
Jeff Bailey [Sat, 29 Jan 2022 15:54:23 +0000 (15:54 +0000)]
Remove reference to LLVMLibC as the doc has moved.
https://reviews.llvm.org/D117436 caused a build failure
due to this error.
Tested:
ninja docs-llvm-libc builds
Reviewed By: abrachet
Differential Revision: https://reviews.llvm.org/D118537
Fangrui Song [Sat, 29 Jan 2022 23:24:56 +0000 (15:24 -0800)]
[ELF] --gdb-index: switch to SmallVector. NFC
Joe Loser [Fri, 28 Jan 2022 19:38:10 +0000 (14:38 -0500)]
[libc++][test] Clean up libcxx/test/support/MoveOnly.h
Remove copy and copy assignment rather than have them as private declarations.
They are superfluous given the move and move assignment.
As a drive-by, also specialize `std::hash` without reopening `namespace std`.
Differential Revision: https://reviews.llvm.org/D118502
Fangrui Song [Sat, 29 Jan 2022 22:45:58 +0000 (14:45 -0800)]
[ELF] Refactor -z combreloc
* `RelocationBaseSection::addReloc` increases `numRelativeRelocs`, which
duplicates the work done by RelocationSection<ELFT>::writeTo.
* --pack-dyn-relocs=android has inappropropriate DT_RELACOUNT.
AndroidPackedRelocationSection does not necessarily place relative relocations
in the front and DT_RELACOUNT might cause semantics error (though our
implementation doesn't and Android bionic doesn't use DT_RELACOUNT anyway.)
Move `llvm::partition` to a new function `partitionRels` and compute
`numRelativeRelocs` there. Now `RelocationBaseSection::addReloc` is trivial and
can be moved to the header to enable inlining.
The rest of DynamicReloc and `-z combreloc` handling is moved to the
non-template `RelocationBaseSection::computeRels` to decrease code size. My
x86-64 lld executable is 44+KiB smaller.
While here, rename `sort` to `combreloc`.
Mateusz Mikuła [Sat, 29 Jan 2022 21:36:50 +0000 (23:36 +0200)]
[LLD][MinGW] Add --heap argument support
Noticed in https://github.com/msys2/MINGW-packages/pull/10567.
Differential Revision: https://reviews.llvm.org/D118405
Rainer Orth [Sat, 29 Jan 2022 21:52:55 +0000 (22:52 +0100)]
[sanitizer_common] Use atomic builtin in sanitizer_atomic_clang.h
As discussed in D118021 <https://reviews.llvm.org/D118021>, `clang -m32` on
Solaris/sparcv9 currently incorrectly doesn't inline atomics on 8-byte
operands, unlike `gcc`. With the workaround in that patch in place, we're
left with may undefined references to `__sync_val_compare_and_swap_8`,
which isn't provided by `libatomic`. This reference is due to the use of
`__sync_val_compare_and_swap` in `sanitizer_atomic_clang.h`'s
`atomic_compare_exchange_strong`. As is already done in
`scudo/standalone/atomic_helpers.h`, using `__atomic_compare_exchange`
instead avoids this problem.
Tested on `sparcv9-sun-solaris2.11`, `amd64-pc-solaris2.11`, and
`x86_64-pc-linux-gnu`.
Differential Revision: https://reviews.llvm.org/D118024
Nuno Lopes [Wed, 26 Jan 2022 10:34:20 +0000 (10:34 +0000)]
[NewGVN] do phi(undef, x) -> x only if x is not poison
phi([undef, A], [x, B]) -> x is only correct x is guaranteed to be
a non-poison value.
Otherwise we would be changing an undef to poison in the branch A.
Differential Revision: https://reviews.llvm.org/D117907
Nico Weber [Sat, 29 Jan 2022 21:06:24 +0000 (16:06 -0500)]
[gn build] (manually) port
36892727e4f1
Jameson Nash [Mon, 4 Oct 2021 22:37:57 +0000 (18:37 -0400)]
enable plugins for clang-tidy
Fixes #32739
Differential Revision: https://reviews.llvm.org/D111100
Fangrui Song [Sat, 29 Jan 2022 19:03:42 +0000 (11:03 -0800)]
[SmallVector] Optimize move assignment operator for N==0 case
Due to the SmallVector hierarchy, N==0 cannot be leveraged by functions defined
in base classes. This patch special cases N==0 for SmallVector to save code size
and be slightly more efficient.
In a Release build of x86 only clang, .text is -3.34KiB smaller. In lld .text is
7.17KiB smaller.
Reviewed By: lichray
Differential Revision: https://reviews.llvm.org/D117976
Sanjay Patel [Fri, 28 Jan 2022 22:10:39 +0000 (17:10 -0500)]
[InstCombine] add tests for demanded bit of mul; NFC
Mircea Trofin [Sat, 29 Jan 2022 16:59:31 +0000 (08:59 -0800)]
[MLGO] Regalloc: allow multiple occurences of -regalloc-enable-advisor
This allows scearios where some central config sets it one way and a
user wants to override it.
Stanislav Gatev [Fri, 28 Jan 2022 16:23:01 +0000 (16:23 +0000)]
[clang][dataflow] Merge distinct pointer values in Environment::join
This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.
Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D118480
Shilei Tian [Sat, 29 Jan 2022 16:29:19 +0000 (11:29 -0500)]
[OpenMP] Fix link error on Windows caused by `interop` functions
This patch fixes the link error on Windows caused by `interop`
functions.
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D118524
Florian Hahn [Sat, 29 Jan 2022 16:22:18 +0000 (16:22 +0000)]
[VPlan] Handle IV vector splat using VPWidenCanonicalIV.
This patch tries to use an existing VPWidenCanonicalIVRecipe
instead of creating another step-vector for canonical
induction recipes in widenIntOrFpInduction.
This has the following benefits:
1. First step to avoid setting both vector and scalar values for the
same induction def.
2. Reducing complexity of widenIntOrFpInduction through making things
more explicit in VPlan
3. Only need to splat the vector IV for block in masks.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D116123
Simon Pilgrim [Sat, 29 Jan 2022 16:20:36 +0000 (16:20 +0000)]
[X86] LowerFunnelShift - enable v8i16 lowering
Simon Pilgrim [Tue, 25 Jan 2022 22:52:09 +0000 (22:52 +0000)]
[X86] lowerShuffleAsBlend - pull out repeated getVectorNumElements() calls. NFC.
Arthur O'Dwyer [Sat, 29 Jan 2022 16:02:23 +0000 (11:02 -0500)]
[libc++] Fix the last instances of `namespace ranges::inline...`. NFC.
Make these look the same as everywhere else.
Simon Pilgrim [Sat, 29 Jan 2022 16:08:06 +0000 (16:08 +0000)]
[WebAssembly] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointers are dereferenced immediately, so assert the cast is correct instead of returning nullptr
Simon Pilgrim [Sat, 29 Jan 2022 15:34:26 +0000 (15:34 +0000)]
[lldb] TypeSystemClang - use castAs/cast<> instead of getAs/dyn_cast<> to avoid dereference of nullptr
The pointers are dereferenced immediately, so assert the cast is correct instead of returning nullptr
Arthur O'Dwyer [Sat, 29 Jan 2022 00:50:48 +0000 (19:50 -0500)]
[clang][NFC] Change some ->getType()->isPlaceholderType() to just ->hasPlaceholderType()
Differential Revision: https://reviews.llvm.org/D118518
Simon Pilgrim [Sat, 29 Jan 2022 15:16:47 +0000 (15:16 +0000)]
[X86] combinePredicateReduction - always use PMOVMSKB(PCMPEQB()) for allof(icmp_eq()) reductions
This greatly simplifies the codegen for recognising PTEST patterns and matches the codegen from the very similar LowerVectorAllZero
Arthur O'Dwyer [Sat, 29 Jan 2022 15:14:02 +0000 (10:14 -0500)]
[libc++] [test] Mark two ranges tests with libcpp-has-no-incomplete-ranges.
Should fix the Apple build CI, e.g.
https://buildkite.com/llvm-project/libcxx-ci/builds/8227
Aaron Ballman [Sat, 29 Jan 2022 14:38:57 +0000 (09:38 -0500)]
Speculatively fix the sphinx build for Clang's attribute reference
Simon Pilgrim [Sat, 29 Jan 2022 14:26:41 +0000 (14:26 +0000)]
[X86] SimplifyDemandedBits - add X86ISD::BLENDV SimplifyMultipleUseDemandedBits handling
Lets us see through multiple use operands
Simon Pilgrim [Sat, 29 Jan 2022 13:58:25 +0000 (13:58 +0000)]
[X86] LowerFunnelShift - allow non-constant vXi8 unpack(y,x) << zext(z) lowering pre-AVX512
Without AVX512 (which can efficiently extend/truncate to vXi16/vXi32), unpacking/packing to vXi16 is more efficient that relying on the (uops-heavy) PBLENDV shift expansion