Commit Graph

436922 Commits

Author SHA1 Message Date
Alvin Wong be5582981a [llvm-readobj][COFF] Print forwarder export symbols correctly
Reviewed By: mstorsjo

Differential Revision: https://reviews.llvm.org/D134528
2022-09-26 11:05:41 +03:00
Alvin Wong 37bd099daf [LLD][COFF] Fix absolute & synthetic symbols in COFF symbol table
Absolute symbol should contain its absolute value, but LLD had been
writing its RVA instead. Write its VA instead.

DefinedSynthetic were being skipped before with the reasoning "Relative
symbols are unrepresentable in a COFF symbol table", which is only true
if the RVA points to outside of a section. LLD does create synthetic
symbols which points to actual data chunks (typical for symbols embedded
into the load config directory). Write these symbols to the COFF symbol
table too.

Reviewed By: mstorsjo

Differential Revision: https://reviews.llvm.org/D134462
2022-09-26 11:05:41 +03:00
Adrian Kuegel a096164134 Revert "[mlir][Bazel] Port 730ae80d3e part 2."
This reverts commit b4cc363e86.

The change which needed this BUILD fix was reverted.
2022-09-26 10:04:56 +02:00
Lorenzo Chelini 941d122370 Revert "[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC)"
This reverts commit 730ae80d3e.

It fails with a linking errors: `undefined reference to
`mlir::getValueOrCreateConstantIndexOp` in `libMLIRDialectUtils`.
2022-09-26 10:01:23 +02:00
Michele Scuttari 939c5cf6a7
[MLIR] Migrate MemRef -> LLVM conversion pass to the auto-generated constructor
See #57475

Differential Revision: https://reviews.llvm.org/D134607
2022-09-26 09:54:53 +02:00
Adrian Kuegel b4cc363e86 [mlir][Bazel] Port 730ae80d3e part 2. 2022-09-26 09:51:22 +02:00
Adrian Kuegel ec8f08ce08 [mlir][Bazel] Port 730ae80d3e 2022-09-26 09:45:24 +02:00
Adrian Kuegel a3df255e9c [mlir][Bazel] Port afb0b21f24 2022-09-26 09:38:22 +02:00
Lorenzo Chelini 730ae80d3e [MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC)
The utility function should live in `StaticValueUtils.h` as it provides
a convenient way to convert a vector of OpFoldResults into a vector of
Values.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D134451
2022-09-26 09:37:03 +02:00
jacquesguan 9c8abbfa0a [mlir][Arithmetic] Support commutative canonicalization for continuous XOrIOp.
This patch adds commutative canonicalization support for D116383.

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D134258
2022-09-26 15:01:24 +08:00
Kazu Hirata e2398a4d7c [Analysis] Introduce getStaticBonusApplied (NFC)
InlineCostCallAnalyzer encourages inlining of the last call to the
static function by subtracting LastCallToStaticBonus from Cost.

This patch introduces getStaticBonusApplied to make available the
amount of LastCallToStaticBonus applied.

The intent is to allow the module inliner to determine whether
inlining a given call site is expected to reduce the caller size with
an expression like:

  IC.getCost() + IC.getStaticBonusApplied() < 0

This patch does not add a use of getStaticBonus yet.

Differential Revision: https://reviews.llvm.org/D134373
2022-09-25 23:21:40 -07:00
Kazu Hirata 06b1e5fdc3 [llvm] Use std::underlying_type_t (NFC) 2022-09-25 23:14:15 -07:00
Kazu Hirata 80c698d6b9 [ADT] Use std::conditional_t (NFC) 2022-09-25 23:14:13 -07:00
gonglingqin a6d699b55d [LoongArch] Add codegen support for strict_fsetccs and any_fsetcc
Differential Revision: https://reviews.llvm.org/D134274
2022-09-26 13:05:36 +08:00
Lang Hames a5f0054915 [ORC] Update LinkGraph unit tests for API change in 75404e9ef8. 2022-09-25 22:02:15 -07:00
Danil Sidoruk 258d7b86ee [clang-format] Handle constructor invocations after new operator in C# correct
Fixes #56549.

Differential Revision: https://reviews.llvm.org/D129926
2022-09-25 21:10:26 -07:00
Lang Hames 75404e9ef8 [JITLink] Introduce new weakly-referenced concept separate from linkage.
Introduces two new methods on Symbol: isWeaklyReferenced and
setWeaklyReferenced. These are now used to track/set whether an external symbol
is weakly referenced, rather than having the Symbol's linkage set to weak.

This change is a first step towards proper handling of weak defs used across
JITDylib boundaries: It frees up the Linkage field on external symbols so that
it can be used to represent the linkage of the definition that the symbol resolves
to. It is expected that Platform plugins will use this information to track
locations that need to be updated if the selected weak definition changes (e.g.
because JITDylibs were dlclosed and then dlopened again in a different order).
2022-09-25 20:34:45 -07:00
wanglei 75265c7f49 [LoongArch] Lower BlockAddress/JumpTable
This patch uses a unified interface for lower GlobalAddress ConstantPool
BlockAddress and JumpTable.

This patch allows lowering addresses by using PC-relative addressing
for DSO-local symbols, and accessing the address through the global
offset table for DSO-preemptable symbols.

Remove hardcoded `MininumJumpTableEntries` for test lower JumpTable.

Also updated some test cases using ConstantPool, due to the addition of
relocation information.

Differential Revision: https://reviews.llvm.org/D134431
2022-09-26 10:52:54 +08:00
Sam McCall 30b676ac5f Don't crash when code completing `using enum ^Foo`.
Fixes https://github.com/clangd/clangd/issues/1281

Differential Revision: https://reviews.llvm.org/D134243
2022-09-26 04:52:19 +02:00
Yeting Kuo 43c5fbdd3a [VP][RISCV] Add vp.sqrt intrinsic and RISC-V support.
The patch modeled vp.fabs patch D132793.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D133690
2022-09-26 10:47:40 +08:00
WANG Xuerui ad6fe32032 [LoongArch] Support 'generic' as a valid CPU name
As the LoongArch port is largely modeled after RISCV it has the same
behavior of not accepting `generic` as a CPU name. For better
compatibility with consumers of LLVM (e.g. mesa) follow D121149's suit
and treat `generic` the same as an empty CPU name.

Differential Revision: https://reviews.llvm.org/D134412
2022-09-26 10:20:13 +08:00
Ruiling Song bf25a48985 Add override for runOnFunction()
Fix build-bot failure.
2022-09-26 10:19:35 +08:00
Sam McCall 283b6dec8d [clangd] Make go-to-type work on member function calls 2022-09-26 04:18:43 +02:00
WANG Xuerui d2ac89b64e [LoongArch] Support fastcc and treat it as ccc
As explained in D68559 the `fastcc` calling convention may be requested
under certain conditions, hence the need for supporting it. But unlike
RISCV we actually treat it exactly like ccc, without actually inventing
any performance hack right here. And CSKY does the same thing.

This is going to fix a few more test cases with native LoongArch builds.

Differential Revision: https://reviews.llvm.org/D134443
2022-09-26 10:15:00 +08:00
LLVM GN Syncbot a225556d4d [gn build] Port cf14c7caac 2022-09-26 02:02:19 +00:00
WANG Xuerui f89f0990db [LoongArch] Support llvm.thread.pointer
For `__builtin_thread_pointer` to work, among other things.

Similar to D76828 for RISCV.

Differential Revision: https://reviews.llvm.org/D134368
2022-09-26 09:56:42 +08:00
Ruiling Song a5676a3a7e StructurizeCFG: Set Undef for non-predecessors in setPhiValues()
During structurization process, we may place non-predecessor blocks
between the predecessors of a block in the structurized CFG. Take
the typical while-break case as an example:
```
 /---A(v=...)
 |  / \
 ^ B   C
 |  \ /|
 \---L |
     \ /
      E (r = phi (v:C)...)
```
After structurization, the CFG would be look like:
```
 /---A
 |   |\
 |   | C
 |   |/
 |   F1
 ^   |\
 |   | B
 |   |/
 |   F2
 |   |\
 |   | L
 \   |/
  \--F3
     |
     E
```
We can see that block B is placed between the predecessors(C/L) of E.
During phi reconstruction, to achieve the same sematics as before, we
are reconstructing the PHIs as:
  F1: v1 = phi (v:C), (undef:A)
  F3: r = phi (v1:F2), ...
But this is also saying that `v1` would be live through B, which is not
quite necessary. The idea in the change is to say the incoming value
from B is Undef for the PHI in E. With this change, the reconstructed
PHI would be:
  F1: v1 = phi (v:C), (undef:A)
  F2: v2 = phi (v1:F1), (undef:B)
  F3: r  = phi (v2:F2), ...

Reviewed by: sameerds

Differential Revision: https://reviews.llvm.org/D132450
2022-09-26 09:54:47 +08:00
Ruiling Song 40e9284f3c StructurizeCFG: prefer reduced number of live values
The instruction simplification will try to simplify the affected phis.
In some cases, this might extend the liveness of values. For example:

  BB0:
   | \
   | BB1
   | /
  BB2:phi (BB0, v), (BB1, undef)

The phi in BB2 will be simplified to v as v dominates BB2, but this is
increasing the number of active values in BB1. By setting CanUseUndef
to false, we will not simplify the phi in this way, this would help
register pressure. This is mandatory for the later change to help
reducing VGPR pressure for AMDGPU.

Reviewed by: foad, sameerds

Differential Revision: https://reviews.llvm.org/D132449
2022-09-26 09:54:47 +08:00
Ruiling Song 66325d9ba1 AMDGPU: Add a test to show how later optimization works
Differential Revision: https://reviews.llvm.org/D132448
2022-09-26 09:54:47 +08:00
Ruiling Song cf14c7caac AMDGPU: Add a pass to rewrite certain undef in PHI
For the pattern of IR (%if terminates with a divergent branch.),
divergence analysis will report %phi as uniform to help optimal code
generation.
```
  %if
  | \
  | %then
  | /
  %endif: %phi = phi [ %uniform, %if ], [ %undef, %then ]
```
In the backend, %phi and %uniform will be assigned a scalar register.
But the %undef from %then will make the scalar register dead in %then.
This will likely cause the register being over-written in %then. To fix
the issue, we will rewrite %undef as %uniform. For details, please refer
the comment in AMDGPURewriteUndefForPHI.cpp. Currently there is no test
changes shown, but this is mandatory for later changes.

Reviewed by: sameerds

Differential Revision: https://reviews.llvm.org/D133840
2022-09-26 09:54:47 +08:00
Arthur Eubanks 7a8b9307ca [bazel] Always specify --strip=never 2022-09-25 18:49:49 -07:00
Arthur Eubanks 2698be0cc9 [bazel] Add some general build flags 2022-09-25 18:22:22 -07:00
Weining Lu 394f30919a [Clang][LoongArch] Add inline asm support for constraints f/l/I/K
This patch adds support for constraints `f`, `l`, `I`, `K` according
to [1]. The remain constraints (`k`, `m`, `ZB`, `ZC`) will be added
later as they are a little more complex than the others.
f: A floating-point register (if available).
l: A signed 16-bit constant.
I: A signed 12-bit constant (for arithmetic instructions).
K: An unsigned 12-bit constant (for logic instructions).

For now, no need to support register alias (e.g. `$a0`) in llvm as
clang will correctly decode the usage of register name aliases into
their official names. And AFAIK, the not yet upstreamed `rustc` for
LoongArch will always use official register names (e.g. `$r4`).

[1] https://gcc.gnu.org/onlinedocs/gccint/Machine-Constraints.html

Differential Revision: https://reviews.llvm.org/D134157
2022-09-26 08:49:58 +08:00
James Y Knight 4f188ef89c [AVR] Fix useDeprecatedPositionallyEncodedOperands errors.
This is a follow-on to https://reviews.llvm.org/D134073.

It renames a few fields to have consistent names, as well as renaming
operands to match the field names.

The encoder behavior is unchanged by this cleanup, but a few
instructions were previously being disassembled incorrectly, and have
been corrected by this change. All of the affected instructions were
missing disassembly tests, which are now added.

Differential Revision: https://reviews.llvm.org/D134185
2022-09-25 17:55:09 -04:00
James Y Knight a8c59bcc01 [AMDGPU] Fix useDeprecatedPositionallyEncodedOperands errors in R600.
This is a follow-on to https://reviews.llvm.org/D134073.

It renames a couple of fields to match their operands, as well as
introducing sub-operand names where required.

This change _only_ fixes the 'R600' half of the target, not the
'AMDGPU' half. Fixing the AMDGPU half will be a significantly more
difficult change (which I've not yet attempted.)

Differential Revision: https://reviews.llvm.org/D134078
2022-09-25 17:55:09 -04:00
James Y Knight 0f99958e79 [Lanai] Fix useDeprecatedPositionallyEncodedOperands errors.
This is a follow-on to https://reviews.llvm.org/D134073.

Lanai was almost clean: the only issue is that 'bit' behaves
differently than 'bits<1>', because only the 'bits' type preserves
unresolved references via 'keepUnsetBits()' in
TableGen/Record.h. Thus, use bits instead.

This issue _would_ have caused invalid instruction emission/decoding,
except that the PQ bits were being overriden after the fact by code in
'adjustPqBits' in MCTargetDesc/LanaiMCCodeEmitter.cpp, and
'PostOperandDecodeAdjust' in Disassembler/LanaiDisassembler.cpp.

Differential Revision: https://reviews.llvm.org/D134075
2022-09-25 17:55:09 -04:00
Danil Sidoruk 015ce15ea2 [clang-format][NFC] Rewrite prints in python3 compatible way
Closes #55996.

Differential Revision: https://reviews.llvm.org/D131789
2022-09-25 13:27:42 -07:00
Simon Pilgrim 2315ae35cf [Coroutines] Regenerate coro-retcon-resume-values.ll 2022-09-25 19:58:18 +01:00
Nico Weber ea8371247f [clang-cl] Implement /ZH: flag
Based on a patch by Arlo Siemsen (D98438)!

Differential Revision: https://reviews.llvm.org/D134544
2022-09-25 14:43:14 -04:00
Emilia Dreamer 39e6077d97
[clang-format] Look ahead before consuming `bool` in requires clause.
The comment handling the bool case says:
"bool is only allowed if it is directly followed by a paren for a cast"

This change more closely follows this directive by looking ahead for
the paren before consuming the bool keyword itself. Without a following
paren, the bool would be part of something else, such as a return type
for a function declaration

Fixes https://github.com/llvm/llvm-project/issues/57538

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D134325
2022-09-25 20:30:21 +03:00
Emilia Dreamer 7847225576
[clang-format] Correctly annotate static and consteval lambdas
`P1169` "static operator()" (https://wg21.link/P1169) is accepted to
C++23 and while clang itself doesn't exactly support it yet,
clang-format could quite easily.

This simply allows the keyword `static` to be a part of lambdas as
specified by the addition to [expr.prim.lambda.general]

While adding this, I noticed `consteval` lambdas also aren't handled,
so that keyword is now allowed to be a part of lambdas as well

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D134587
2022-09-25 20:29:55 +03:00
Simon Pilgrim bcb1397bda [PhaseOrdering][X86] Add missing triple from fast-basictest.ll test 2022-09-25 16:23:35 +01:00
Simon Pilgrim 200fe18c5c [SLP][X86] Add missing triple from pr49081.ll test 2022-09-25 16:22:42 +01:00
Hui Xie 4851fbc3cf fix errors on passing input iterator to `std::views::take`
In the implementation of `std::views::take`, it uses `subrange<Iter>` as part of the return type. But in case of input iterator, `subrange<Iter>` can be ill-formed

Differential Revision: https://reviews.llvm.org/D133220
2022-09-25 15:41:13 +01:00
Amaury Séchet dc947ba3f5 Autogenerate a couple of test in the AMDGPU backend. NFC 2022-09-25 14:12:49 +00:00
Simon Pilgrim 196f27bb56 [CostModel][X86] Add missing cost kinds for v2i64 icmp on SLM 2022-09-25 15:12:21 +01:00
Simon Pilgrim faff990e9b [X86] Fix Icelake VPMULLQ zmm pipes and adjust AVX512DQ v8i64 mul costs to match worse case
Icelake PMULLQ throughput regressed cf SkylakeServer as its Pipe0 only

Confirmed with Intel SOM, Agner and instlatx64
2022-09-25 14:18:08 +01:00
Mark de Wever ddb6c2b301 [libc++] Rewrites graph_header_deps.py.
The new version is a lot simpler and has less option which were not
used. This uses the CSV files as generated by D133127 as input data.

The current Python script has more features but uses a simple "grep"
making the output less accurate:
- Conditionally included header are always included. This is an issue
  since part of our includes are unneeded transitive includes. Based on
  the language version they may be omitted. The script however always
  includes them.
- Includes in comments are processed as-if they are includes. This is an
  issue when comments explain how certain data is generated; of course
  there are digraphs which the script omits.

This implementation uses Clang's --trace-includes to generate the includes
per header. This means the input of the generation script always has the
real list of includes.

Libc++ is moving from large monolithic Standard headers to more fine
grained headers. For example, algorithm includes every header in
`__algorithm`. Adding all these detail headers in the graph makes the
output unusable. Instead it only shows the Standard headers. The
transitive includes of the detail headers are parsed and "attributed" to
the Standard header including them. This gives an accurate include graph
without the unneeded clutter. Note that this graph is still big.

This changes fixes the cyclic dependency issue with the previous version
of the tool so the markers and its documentation is removed.

Since the input has no cycles the CI test is removed.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D134188
2022-09-25 15:06:21 +02:00
Petar Avramovic dcc756d03e [AMDGPU] Pattern for flat atomic fadd f64 intrinsic with local addr
Fix regression from clang opencl test in builtins-fp-atomics-gfx90a.cl
test_flat_add_local_f64 caused by D130579
Revert a3becb333d.

Differential Revision: https://reviews.llvm.org/D134568
2022-09-25 13:25:41 +02:00
Mark de Wever 34dfdd17af [libc++][test] Improves transitive includes.
This test generates the include graph of the Standard headers of libc++ in
a CSV file. This was originally used to generate graphviz dot files. During
review it was noticed these files have all information needed to replace
the current transitive includes. Therefore the output, with the same information as the .dot file is stored in a .csv file. This removes
all the existing transitive include files.

The .cvs can be converted by a .dot file by the script in D134188.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D133127
2022-09-25 13:20:27 +02:00