Commit Graph

431463 Commits

Author SHA1 Message Date
Simon Pilgrim 63bdff3eb8 VirtualFileSystem.h - don't use \param in general description - use \p instead to fix Wdocumentation warnings. 2022-07-29 12:21:44 +01:00
Simon Pilgrim 9f68bb1da5 Fix unknown parameter Wdocumentation warning. NFC. 2022-07-29 12:17:30 +01:00
Simon Pilgrim 641dba9e28 [DAG] Move a few hasOneUse() tests later to reduce unnecessary computations. NFC.
Many of these cases, an early-out on the much cheaper getOpcode() check will avoid us needing to call hasOneUse() entirely.
2022-07-29 11:34:39 +01:00
Guillaume Chatelet 0c3037dfc5 [libc] Fix prototype_test_gen 2022-07-29 10:18:54 +00:00
Guillaume Chatelet e5e0e7963c [libc] Fix prototype_test_gen 2022-07-29 10:07:34 +00:00
Simon Pilgrim 9082c13106 [Support] Add KnownBits::concat method
Add a method for the various cases where we need to concatenate 2 KnownBits together (BUILD_PAIR and SHIFT_PARTS in particular) - uses the existing APInt::concat 'HiBits.concat(LoBits)' convention

Differential Revision: https://reviews.llvm.org/D130557
2022-07-29 11:06:39 +01:00
Guillaume Chatelet 039fb3e5a1 Fix typo in FPUtil/aarch64/FMA.h 2022-07-29 10:04:11 +00:00
Guillaume Chatelet f72261508a [libc][NFC] Use STL case for type_traits
Migrating all private STL code to the standard STL case but keeping it under the CPP namespace to avoid confusion. Starting with the type_traits header.

Differential Revision: https://reviews.llvm.org/D130727
2022-07-29 09:57:03 +00:00
Jay Foad d03110155b [IR] Simplify Intrinsic::getDeclaration. NFC. 2022-07-29 10:45:22 +01:00
wanglei 56ab2f4ccd [LoongArch] Offset folding for frameindex
This patch is for frameindex calculations.

Differential Revision: https://reviews.llvm.org/D130248
2022-07-29 17:27:34 +08:00
wanglei fd6545322c [LoongArch] Refactor insertDivByZeroTrap
Ensure non-terminators don't follow terminators.
This patch fixes the `sdiv-udiv-srem-urem.ll` test failure with
expensive check.

Differential Revision: https://reviews.llvm.org/D130247
2022-07-29 17:06:49 +08:00
David Sherwood 487fa6f8c3 [AArch64][DAGCombine] Add performBuildVectorCombine 'extract_elt ~> anyext'
A build vector of two extracted elements is equivalent to an extract
subvector where the inner vector is any-extended to the
extract_vector_elt VT, because extract_vector_elt has the effect of an
any-extend.

  (build_vector (extract_elt_i16_to_i32 vec Idx+0) (extract_elt_i16_to_i32 vec Idx+1))
  => (extract_subvector (anyext_i16_to_i32 vec) Idx)

Depends on D130697

Differential Revision: https://reviews.llvm.org/D130698
2022-07-29 09:51:09 +01:00
Nuno Lopes 210769f773 fix test function attribute [NFC] 2022-07-29 09:42:44 +01:00
David Sherwood 6953e754c7 [NFC][AArch64] Precommit vector-fcvt tests
Add tests which show code quality of uitofp and sitofp.

Differential Revision: https://reviews.llvm.org/D130697
2022-07-29 09:29:15 +01:00
Fangrui Song 999514bb9a [bolt] Replace Optional::getValue with value or operator*. NFC 2022-07-29 01:15:24 -07:00
Florian Hahn 214e2d8fe5
[SCEV] Avoid repeated proveNoSignedWrapViaInduction calls.
At the moment, proveNoSignedWrapViaInduction may be called for the
same AddRec a large number of times via getSignExtendExpr. This can have
a severe compile-time impact for very loop-heavy code.

If proveNoSignedWrapViaInduction failed to prove NSW the first time,
it is unlikely to succeed on subsequent tries and the cost doesn't seem
to be justified.

This is the signed version of 8daa338297 / D130648.

This can drastically improve compile-time in some excessive cases and
also has a slightly positive compile-time impact on CTMark:

NewPM-O3: -0.06%
NewPM-ReleaseThinLTO: -0.04%
NewPM-ReleaseLTO-g: -0.04%

https://llvm-compile-time-tracker.com/compare.php?from=8daa338297d533db4d1ae8d3770613eb25c29688&to=aed126a196e7a5a9803543d9b4d6bdb233d0009c&stat=instructions

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D130694
2022-07-29 09:15:03 +01:00
Fangrui Song 0595edd80f [mlir][toy] Replace Optional::getValue with value. NFC 2022-07-29 01:10:51 -07:00
Sunho Kim e590f945c6 Revert "[JITLink][COFF] Implement include/alternatename linker directive."
This reverts commit f1fcd06a2a.

Faliures reported in
https://lab.llvm.org/buildbot/#/builders/193/builds/16143 and http://lab.llvm.org/buildbot/#/builders/91/builds/13010
2022-07-29 17:03:19 +09:00
Fangrui Song a041ce3eb1 [ELF] CallGraphSort: replace vector<int> with unique_ptr<int[]>. NFC
We can't use C++20 make_unique_for_overwrite yet.
2022-07-29 00:59:48 -07:00
Sunho Kim f1fcd06a2a [JITLink][COFF] Implement include/alternatename linker directive.
Implements include/alternatename linker directive. Alternatename is used by static msvc runtime library. Alias symbol is technically incorrect (we have to search for external definition) but we don't have a way to represent this in jitlink/orc yet, this is solved in the following up patch.

Inlcude linker directive is used in ucrt to forcelly lookup the static initializer symbols so that they will be emitted. It's implemented as extenral symbols with live flag on that cause the lookup of these symbols.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D130276
2022-07-29 16:48:29 +09:00
Fangrui Song 2e2d5304f0 [ELF] Move combineEhSections from Writer to SyntheticSections. NFC
This not only places the function in the right place, but also allows inlining addSection.
2022-07-29 00:47:30 -07:00
Fangrui Song c72973608d [ELF] Combine EhInputSection removal and MergeInputSection removal. NFC 2022-07-29 00:39:57 -07:00
Sunho Kim 049fd21b42 [JITLink][COFF][x86_64] Implement ADDR64 relocation.
Implements ADDR64 relocation using x86_64 edge kind.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D130178
2022-07-29 16:32:07 +09:00
Fangrui Song 8d4b11b4f1 [ELF] Remove redundant isa<InputSection>(sec). NFC
combineEhSections has been called to remove EhInputSection.
2022-07-29 00:30:52 -07:00
Sunho Kim 410e0aa759 [JITLink][COFF] Implement dllimport stubs.
Implements dllimport stubs using GOT table manager. Benefit of using GOT table manager is that we can just reuse jitlink-check architecture.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D130175
2022-07-29 16:29:53 +09:00
Hui Xie 72f57e3a30 [libc++][ranges] implement `std::ranges::unique{_copy}`
implement `std::ranges::unique` and `std::ranges::unique_copy`

Differential Revision: https://reviews.llvm.org/D130404
2022-07-29 08:28:17 +01:00
Rainer Orth bf3714884a [clang][Driver] Handle SPARC -mcpu=native etc.
To make use of SPARC support in `getHostCPUName` as implemented by D130272
<https://reviews.llvm.org/D130272>, this patch uses it to handle
`-mcpu=native` and `-mtune=native`.  To match GCC, this patch rejects
`-march` instead of silently treating it as a no-op.

Tested on `sparcv9-sun-solaris2.11` and checking that those options are
passed on as `-target-cpu` resp. `-tune-cpu` as expected.

Differential Revision: https://reviews.llvm.org/D130273
2022-07-29 09:27:09 +02:00
Sunho Kim 6b27890b2c [ORC][COFF] Handle COFF import files of static archive.
Handles COFF import files of static archive. Changes static library genrator to build up object file map keyed by symbol name that excludes the symbols from dllimported symbols so that static generator will not be responsible for them. It exposes the list of dynamic libraries that need to be imported. Client should properly load the libraries in this list beforehand. Object file map is also an improvment from the past in terms of performance. Archive.findSym does a slow O(n) linear serach of symbol list to find the symbol. (we call findSym O(n) times, thus full time complexity is O(n^2); we were the only user of findSym function in fact)

There is a room for improvements in how to load the libraries in the list. We currently just hand the responsibility over to the clinet. A better way would be let ORC read this list and hand them over to JITLink side that would also help validation (e.g. not trying to generate stub for non dllimported targets) Nevertheless, we will have to exclude the symbols from COFF import object file list and need a way to access this list, which this patch offers.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D129952
2022-07-29 16:25:08 +09:00
Rainer Orth 9b1897bbd0 [Driver] Use libatomic for 32-bit SPARC atomics support on Linux
This is the Linux/sparc64 equivalent to D118021
<https://reviews.llvm.org/D118021>, necessary to provide an external
implementation of atomics on 32-bit SPARC which LLVM cannot inline even
with `-mcpu=v9` or an equivalent default.

Tested on `sparc64-unknown-linux-gnu`.

Differential Revision: https://reviews.llvm.org/D130569
2022-07-29 09:19:38 +02:00
Fangrui Song 4db7c7dbb4 [ELF] Remove one inputSections loop. NFC 2022-07-29 00:03:50 -07:00
Huan Nguyen 52cd00cabf [BOLT] Ignore functions accessing false positive jump tables
Disassembly and branch target analysis are not decoupled, so any
analysis that depends on disassembly may not operate properly.

In specific, analyzeJumpTable uses instruction bounds check property.
A jump table was analyzed twice: (a) during disassembly, and (b) after
disassembly, so there are potentially some mismatched results.

In this update, functions that access JTs which fail the second check
will be marked as ignored.

Test Plan:
```
ninja check-bolt
```

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D130431
2022-07-28 23:22:17 -07:00
Huan Nguyen ccabbfff86 [BOLT] Remove --allow-stripped option
AllowStripped has not been used in BOLT.
This option is replaced by actively detecting stripped binary.

Test Plan:

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D130036
2022-07-28 23:15:53 -07:00
Huan Nguyen 986362d4a3 [BOLT] Add BinaryContext::IsStripped
Determine stripped status of a binary based on .symtab

Test Plan:
```
ninja check-bolt
```

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D130034
2022-07-28 23:11:03 -07:00
Weining Lu dc2557fe2b [LoongArch] Remove the temporary .mir tests as they have been rewrote by .s tests. NFC 2022-07-29 10:57:42 +08:00
Chuanqi Xu 4d9251bd78 [C++20] [Modules] Merge same concept decls in global module fragment
According to [basic.def.odr]p14, the same redeclarations in different TU
but not attached to a named module are allowed. But we didn't take care
of concept decl for this condition. This patch tries to fix this
problem.

Reviewed By: ilya-biryukov

Differention Revision: https://reviews.llvm.org/D130614
2022-07-29 10:50:27 +08:00
skc7 a35c64ce23 [Clang][Attribute] Introduce maybe_undef attribute for function arguments which accepts undef values
Add the ability to put __attribute__((maybe_undef)) on function arguments.
Clang codegen introduces a freeze instruction on the argument.

Differential Revision: https://reviews.llvm.org/D130224
2022-07-29 02:27:26 +00:00
Chris Bieneman cc47db6737 [HLSL] Add HLSLResource attribute
HLSL Resource objects will have restrictions on use and codegen
requirements. This patch is fairly minimal just adding the attribute
with no spellings since it will only be attached by the
HLSLExternalSemaSource.

Depends on D1300017.

Differential Revision: https://reviews.llvm.org/D130018
2022-07-28 20:54:51 -05:00
lewuathe bcd538ab92 [mlir][complex] Canonicalize consecutive complex.conj
We can canonicalize consecutive complex.conj just by removing all conjugate operations.

Reviewed By: pifon2a

Differential Revision: https://reviews.llvm.org/D130684
2022-07-29 09:41:09 +09:00
sstwcw 60e12068ff [clang-format] Handle Verilog attributes
Reviewed By: HazardyKnusperkeks, owenpan

Differential Revision: https://reviews.llvm.org/D128709
2022-07-29 00:38:30 +00:00
sstwcw c88719483c [clang-format] Handle Verilog case statements
These statements are like switch statements in C, but without the 'case'
keyword in labels.

How labels are parsed.  In UnwrappedLineParser, the program tries to
parse a statement every time it sees a colon.  In TokenAnnotator, a
colon that isn't part of an expression is annotated as a label.

The token type `TT_GotoLabelColon` is added.  We did not include Verilog
in the name because we thought we would eventually have to fix the
problem that case labels in C can't contain ternary conditional
expressions and we would use that token type.

The style is like below.  Labels are on separate lines and indented by
default.  The linked style guide also has examples where labels and the
corresponding statements are on the same lines.  They are not supported
for now.

https://github.com/lowRISC/style-guides/blob/master/VerilogCodingStyle.md

```
case (state_q)
  StIdle:
    state_d = StA;
  StA: begin
    state_d = StB;
  end
endcase
```

Differential Revision: https://reviews.llvm.org/D128714
2022-07-29 00:38:30 +00:00
sstwcw b67ee18e85 [clang-format] Handle Verilog user-defined primitives
Differential Revision: https://reviews.llvm.org/D128713
2022-07-29 00:38:30 +00:00
sstwcw 6db0c18b1a [clang-format] Handle Verilog modules
Now things inside hierarchies like modules and interfaces are
indented.  When the module header spans multiple lines, all except the
first line are indented as continuations.  We added the property
`IsContinuation` to mark lines that should be indented this way.

In order that the colons inside square brackets don't get labeled as
`TT_ObjCMethodExpr`, we added a check to only use this type when the
language is not Verilog.

Differential Revision: https://reviews.llvm.org/D128712
2022-07-29 00:38:30 +00:00
sstwcw 67480b360c [clang-format] Handle Verilog blocks
Now stuff inside begin-end blocks get indented.

Some tests are moved into FormatTestVerilog.Block from
FormatTestVerilog.If because they have nothing to do with if statements.

Reviewed By: HazardyKnusperkeks, owenpan

Differential Revision: https://reviews.llvm.org/D128711
2022-07-29 00:38:30 +00:00
sstwcw f93182a887 [clang-format] Handle Verilog numbers and operators
Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D126845
2022-07-29 00:38:29 +00:00
Nico Weber 241f0e8b76 [lld/mac] Add support for $ld$previous symbols with explicit symbol name
A symbol `$ld$previous$/Another$1.2.3$1$3.0$14.0$_xxx$` means
"pretend symbol `_xxx` is in dylib `/Another` with version `1.2.3`
if the deployment target is between `3.0` and `14.0` and we're
targeting platform `1` (ie macOS)".

This means dylibs can now inject synthetic dylibs into the link, so
DylibFile needs to grow a 3rd constructor.

The only other interesting thing is that such an injected dylib
counts as a use of the original dylib. This patch gets this mostly
right (if _only_ `$ld$previous` symbols are used from a dylib,
we don't add a dep on the dylib itself, matching ld64), but one case
where we don't match ld64 yet is that ld64 even omits the original
dylib when linking it with `-needed-l`. Lld currently still adds a load
command for the original dylib in that case. (That's for a future
patch.)

Fixes #56074.

Differential Revision: https://reviews.llvm.org/D130725
2022-07-28 20:35:48 -04:00
Changpeng Fang 2b731b30a7 AMDGPU: Take care of "tied" operand when removeOperand
Summary:
  Flat scratch load of D16 type by default has tied vdst_in operand (with vdst). This should be taken
care of at the time of "removeOperand" in eliminateFrameIndex. Otherwise we will hit an assert saying
"Cannot move tied operands". This patch unties vdst_in before the move, and retie it with vdst afterwards.

Reviewers:
  arsenm, foad

Differential Revision: https://reviews.llvm.org/D130537
2022-07-28 17:30:49 -07:00
Francis Visoiu Mistrih bfd3883e83 [Matrix] Refactor transpose distribution. NFC
Use a function to distribute transposes. Preparation for future patches.
2022-07-28 17:30:00 -07:00
Vincent Lee f030132c72 [lld-macho] Allow linking with ABI compatible architectures
Linking fails when targeting `x86_64-apple-darwin` for runtimes. The issue
is that LLD strictly assumes the target architecture be present in the tbd
files (which isn't always true). For example, when targeting `x86_64h`, it should
work with `x86_64` because they are ABI compatible. This is also inline with what
ld64 does.

An environment variable (which ld64 also supports) is also added to preserve the
existing behavior of strict architecture matching.

Reviewed By: #lld-macho, int3

Differential Revision: https://reviews.llvm.org/D130683
2022-07-28 17:16:32 -07:00
tlattner 520d29f381 Update references to mailing lists that have moved to Discourse. 2022-07-28 16:54:58 -07:00
V Donaldson 05b3c900c9 [flang] Fix build failure 2022-07-28 16:41:05 -07:00