411248 Commits

Author SHA1 Message Date
Haojian Wu
64c108c9e4 [clangd] Better handling \n in the synthesized diagnostic message.
The newline-eof fix was rendered as "insert '...'", this patch
special-case it.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D117294
2022-01-17 09:27:58 +01:00
Nikita Popov
00b77d917c [DSE] Remove alloc function check in canSkipDef()
canSkipDef() currently skips inaccessiblememonly calls, but not
if they are allocation functions. This check was added in D103009,
but actually seems to be a leftover from a previous implementation
in D101440. canSkipDef() is not used on the storeIsNoop() path,
where the relevant transform ended up being implemented.

Differential Revision: https://reviews.llvm.org/D117005
2022-01-17 09:23:51 +01:00
Carl Ritson
4b22ffe0b9 CycleInfo: Fix trivial typo. NFC. 2022-01-17 17:06:45 +09:00
Fangrui Song
54fe70bfba [ELF] RelocationScanner::scanOne: replace rel.r_offset with offset. NFC 2022-01-17 00:05:27 -08:00
Cameron Mulhern
966f24e5a6 [clang-format] Add a BlockIndent option to AlignAfterOpenBracket
This style is similar to AlwaysBreak, but places closing brackets on new lines.

For example, if you have a multiline parameter list, clang-format currently only supports breaking per-parameter, but places the closing bracket on the line of the last parameter.

Function(
    param1,
    param2,
    param3);

A style supported by other code styling tools (e.g. rustfmt) is to allow the closing brackets to be placed on their own line, aiding the user in being able to quickly infer the bounds of the block of code.

Function(
    param1,
    param2,
    param3
);

For prior work on a similar feature, see: https://reviews.llvm.org/D33029.

Note: This currently only supports block indentation for closing parentheses.

Differential Revision: https://reviews.llvm.org/D109557
2022-01-17 09:03:23 +01:00
Fangrui Song
4c36567179 [ELF] Relocations: remove some cast<Undefined>. NFC 2022-01-17 00:02:47 -08:00
Fangrui Song
b8d4eb84d7 [ELF] De-template getAlternativeSpelling. NFC 2022-01-16 23:56:25 -08:00
Kito Cheng
cc35161dc7 [RISCV] Add initial support for getRegUsageForType and getNumberOfRegisters
Those two TTI hooks are used during vectorization for calculating
register pressure, the default implementation isn't consider for LMUL,
and that's also definitly wrong value for register number (all register class
are 8 registers).

So in this patch we tried to:

1. Calculate right register usage for vector type and scalar type.
2. Return right number of register for general purpose register and
   vector register.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D116890
2022-01-17 15:27:54 +08:00
Qiu Chaofan
d771cf2775 [PowerPC] Allow -mfloat128 option for VSX targets
Targets with VSX feature but without native float128 instructions can
also use that type with supplementary libcalls. We don't enable it by
default now because Glibc assumes long double and float128 can be
implicitly converted in between, which is not available under default
'ibmlongdouble' semantics in clang.

This commit partly relands cbd93ce.
2022-01-17 15:12:33 +08:00
Fangrui Song
9c4292a59d [ELF] Remove unneeded SyntheticSection memset(*, 0, *)
After the D33630 fallout was properly fixed by a4c5db30be4e216834b44e31b47304ea1b92635f.

Tested by D37462/D44986 tests, the new --no-rosegment test in build-id.s, and a few --rosegment/--no-rosegment programs.
2022-01-16 22:51:57 -08:00
Fangrui Song
a4c5db30be [ELF] Remove redundant fillTrap and memset(*, 0, *). NFC
The new tests in build-id.s would catch problems if we made a mistake here.
2022-01-16 22:37:31 -08:00
Fangrui Song
d46054d75d [ELF][test] Add --build-id tests for -z separate-loadable-segments and --no-rosegment 2022-01-16 22:36:22 -08:00
Fangrui Song
aad90763d9 [ELF] RelocationSection<ELFT>::writeTo: use unstable partition 2022-01-16 21:44:19 -08:00
esmeyi
61106ca752 Reland https://reviews.llvm.org/D113825 after fixing the test expectations. 2022-01-17 00:28:25 -05:00
Fangrui Song
769057a5d0 [ELF] Change some DenseMap<StringRef, *> to DenseMap<CachedHashStringRef, *>. NFC 2022-01-16 21:19:01 -08:00
Fangrui Song
e205445434 [ELF] StringTableSection: Use DenseMap<CachedHashStringRef> to avoid redundant hash computation
5~6% speedup when linking clang and chrome.
2022-01-16 21:02:05 -08:00
Fangrui Song
427d3b93ee [Driver][FreeBSD] -r: imply -nostdlib like GCC
Similar to D116843 for Gnu.cpp

Reviewed By: dim

Differential Revision: https://reviews.llvm.org/D117388
2022-01-16 19:44:48 -08:00
John Ericson
09949c48cb [compiler-rt][cmake] Use GNUInstallDirs to support custom installation dirs
I am breaking apart D99484 so the cause of build failures is easier to
understand.

Differential Revision: https://reviews.llvm.org/D117420
2022-01-17 03:13:56 +00:00
eopXD
5a457782a2 [RISCV] Add patterns for vector widening integer multiply-add instructions
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D117404
2022-01-16 18:37:13 -08:00
Dominik Grewe
5f782d25a7 Preserve argument locations when cloning a region.
Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D117403
2022-01-16 21:17:23 +00:00
Nikita Popov
0d7fbb0737 [AttrBuilder] Remove unused removeAttributes() overload
The idiomatic way would be to call remove() with an AttributeMask
constructed from an AttributeSet.
2022-01-16 21:32:54 +01:00
Nikita Popov
7cbbef5bbc [AttrBuilder] Remove unused hasAttributes() overload
This is unused, and doesn't make a lot of sense as an API. The
usual pattern would be to combine the AttrBuilder(AttributeSet)
constructor with the overlaps() method.
2022-01-16 21:00:18 +01:00
Bjorn Pettersson
9f237c9e7d [DAGCombine] Refactor DAGCombiner::ReduceLoadWidth. NFCI
Update code comments in DAGCombiner::ReduceLoadWidth and refactor
the handling of SRL a bit. The refactoring is done with the intent
of adding support for folding away SRA by using SEXTLOAD in a
follow-up patch.

The function is also renamed as DAGCombiner::reduceLoadWidth.

Differential Revision: https://reviews.llvm.org/D117104
2022-01-16 20:24:52 +01:00
Stanislav Gatev
37e6496c80 [clang][dataflow] Add transfer functions for bind temporary and static cast
This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Differential Revision: https://reviews.llvm.org/D117339
2022-01-16 17:41:02 +00:00
Arjun P
79be1fe0d5 [MLIR] Simplex::getRationalSample: return an optional, empty if Simplex is empty 2022-01-16 22:02:27 +05:30
LLVM GN Syncbot
b50c10fe59 [gn build] Port e6b153947dfa 2022-01-16 16:03:49 +00:00
Alexandre Ganea
e6b153947d Revert [LLD] Remove global state in lldCommon
It seems to be causing issues on https://lab.llvm.org/buildbot/#/builders/123/builds/8383
2022-01-16 11:03:06 -05:00
Alexandre Ganea
30a4020a7d [LLD] Supplement with more comments. Clarify the intention in f860fe362282ed69b9d4503a20e5d20b9a041189. 2022-01-16 09:17:39 -05:00
hyeongyu kim
4608b1d726 Resolve lit failures in clang-aarch64* 2022-01-16 23:06:05 +09:00
LLVM GN Syncbot
9a0e6b2abd [gn build] Port f860fe362282 2022-01-16 13:58:27 +00:00
Alexandre Ganea
f860fe3622 [LLD] Remove global state in lldCommon
Move all variables at file-scope or function-static-scope into a hosting structure (lld::CommonLinkerContext) that lives at lldMain()-scope. Drivers will inherit from this structure and add their own global state, in the same way as for the existing COFFLinkerContext.

See discussion in https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html

Differential Revision: https://reviews.llvm.org/D108850
2022-01-16 08:57:57 -05:00
Florian Hahn
070d1034da
[LV] Restore metadata to disable runtime unrolling for epilogue loop.
After d4a8fc3a87a1 LV stopped adding metadata to disable runtime
unrolling to the vectorized epilogue loop. This was missed because
278aa65cc495 removed the relevant test coverage.

This patch fixes that by adding the relevant metadata after
vector loop generation.
2022-01-16 13:14:16 +00:00
hyeongyu kim
be9eafc710 [msan] reflect the changed flag to the tests.
1b1c8d changed `enable-noundef-analysis` flag to
`disable-noundef-analysis`.  noundef_analysis.cpp was using old
`enable-noundef-analysis` flag and this patch fixes it.
2022-01-16 20:48:05 +09:00
owenca
edbb8a843c [clang-format] Add return code to git-clang-format
https://github.com/llvm/llvm-project/issues/53220

Differential Revision: https://reviews.llvm.org/D117414
2022-01-16 02:41:10 -08:00
Florian Hahn
62739204d4
[LV] Move AddRuntimeUnrollDisableMetaData so it can be used earlier (NFC)
Move up the definition of AddRuntimeUnrollDisableMetaData, so it can be
re-used earlier in the file in a follow-up patch.
2022-01-16 10:30:24 +00:00
hyeongyu kim
1b1c8d83d3 [Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default
Turning on `enable_noundef_analysis` flag allows better codegen by removing freeze instructions.
I modified clang by renaming `enable_noundef_analysis` flag to `disable-noundef-analysis` and turning it off by default.

Test updates are made as a separate patch: D108453

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D105169
2022-01-16 18:54:17 +09:00
Fangrui Song
e7c8cd4a93 [ELF] Remove forEachRelSec. NFC 2022-01-16 00:28:47 -08:00
Fangrui Song
9e885eac54 [ELF] Remove !isLazy() condition from computeBinding
Seems applicable since we demote lazy symbols to Undefined (D111365).
2022-01-15 23:58:15 -08:00
Fangrui Song
c0fc09ab91 [ELF] Remove config->relocatable condition from Symbol::computeBinding 2022-01-15 23:49:48 -08:00
Fangrui Song
b3cc47006b [ELF] Speed up Symbol::computeBinding. NFC
When computeBinding is inlined into includeInDynsym and computeIsPreemptible,
the optimizer can remove the config->gnuUnique load.
2022-01-15 23:40:44 -08:00
Fangrui Song
01a51629c2 [ELF] Slightly speed up Symbol::includeInDynsym. NFC 2022-01-15 23:32:48 -08:00
Fangrui Song
7330fd236e [ELF] Simplify Symbol::includeInDynsym 2022-01-15 23:27:45 -08:00
Fangrui Song
3736d0854a [ELF] Optimize -z combreloc
Sorting dynamic relocations is a bottleneck. Simplifying the comparator improves
performance. Linking clang is 4~5% faster with --threads=8.

This change may shuffle R_MIPS_REL32 for Mips and is a NFC for non-Mips.
2022-01-15 22:33:51 -08:00
Luo, Yuanke
89e968fe8e [X86] Pre-checkin test case for combining const operand to VNNI
instruction.
2022-01-16 14:06:49 +08:00
John Ericson
da77db58d7 Revert "[cmake] Use GNUInstallDirs to support custom installation dirs."
https://lab.llvm.org/buildbot/#/builders/46/builds/21146 Still have
this odd error, not sure how to reproduce, so I will just try breaking
up my patch.

This reverts commit 4a678f8072004eff9214c1a4e1836a14abb69535.
2022-01-16 05:48:30 +00:00
John Ericson
4a678f8072 [cmake] Use GNUInstallDirs to support custom installation dirs.
This is the original patch in my GNUInstallDirs series, now last to merge as the final piece!

It arose as a new draft of D28234. I initially did the unorthodox thing of pushing to that when I wasn't the original author, but since I ended up

 - Using `GNUInstallDirs`, rather than mimicking it, as the original author was hesitant to do but others requested.

 - Converting all the packages, not just LLVM, effecting many more projects than LLVM itself.

I figured it was time to make a new revision.

I have used this patch series (and many back-ports) as the basis of https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS), which was merged last spring (2021). It looked like people were generally on board in D28234, but I make note of this here in case extra motivation is useful.

---

As pointed out in the original issue, a central tension is that LLVM already has some partial support for these sorts of things. Variables like `COMPILER_RT_INSTALL_PATH` have already been dealt with. Variables like `LLVM_LIBDIR_SUFFIX` however, will require further work, so that we may use `CMAKE_INSTALL_LIBDIR`.

These remaining items will be addressed in further patches. What is here is now rote and so we should get it out of the way before dealing more intricately with the remainder.

Reviewed By: #libunwind, #libc, #libc_abi, compnerd

Differential Revision: https://reviews.llvm.org/D99484
2022-01-16 05:33:07 +00:00
Lang Hames
1088c78c3b [ORC-RT] Remove some stale comments.
We switched to SPS serialization for these functions in 089acf25223d2.
2022-01-16 14:03:15 +11:00
Lang Hames
0ede1b906d [ORC-RT] Update WrapperFunctionCall for 089acf25223.
089acf25223 updated WrapperFunctionCall to carry arbitrary argument payloads
(rather than plain address ranges). This commit implements the corresponding
update for the ORC runtime.
2022-01-16 13:48:11 +11:00
Fangrui Song
102d0a2baf [ELF] Simplify elf::link exit. NFC 2022-01-15 17:59:05 -08:00
Fangrui Song
5456249736 [SelectionDAG] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D117235 2022-01-15 17:13:09 -08:00