Commit Graph

426866 Commits

Author SHA1 Message Date
Kazu Hirata 34ff78c5cf [CodeGen] Remove restrictRef (NFC)
The last use was removed on Apr 14, 2017 in commit
4fe9d6c640.
2022-06-13 23:08:48 -07:00
zhongyunde 0cb33551ec [AArch64][NFC] Fix a comment error
Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D127708
2022-06-14 13:57:41 +08:00
Thomas Raoux 087aba4f0f [mlir][vector] Add pattern to distribute vector reduction to GPU shuffles
Add a pattern to do ad hoc lowering of vector.reduction to a sequence of
warp shuffles. This allow distributing reduction on a warp for GPU targets.
Also add an execution test for warp reduction.

co-authored with @springerm

Differential Revision: https://reviews.llvm.org/D127176
2022-06-14 05:49:16 +00:00
Thomas Raoux 76cf33dab2 [mlir][vector] Add patterns to ppropagate vector distribution
Add patterns to propagate vector distribution and remove dead
arguments. This handles propagation for several vector operations.

recommit after minor bug fix.

Differential Revision: https://reviews.llvm.org/D127167
2022-06-14 05:26:10 +00:00
Mogball baca1c1ac4 [mlir][ods] Make Attr/Type def accessors match the dialect
The generated attribute and type def accessors are changed to match the setting on the dialect. Most importantly, "prefixed" will now correctly convert snake case to camel case (e.g. `weight_zp` -> `getWeightZp`)

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D127688
2022-06-14 05:13:24 +00:00
Sunho Kim 3d8061a3be [JITLink][ELF][AArch64] Implement R_AARCH64_MOVW_UABS_G*_NC.
Implements  R_AARCH64_MOVW_UABS_G*_NC fixup edges. These relocation entries can be generated when code is compiled without a PIC flag. With this patch, clang-repl can printf Hello World with ObjectLinkerLayer on aarch64 linux.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D127585
2022-06-14 14:06:59 +09:00
Serguei Katkov 095bf6be28 [Greedy RegAlloc] Fix the handling of split register in last chance re-coloring.
This is a fix for https://github.com/llvm/llvm-project/issues/55827.

When register we are trying to re-color is split the original register (we tried to recover)
has no uses after the split. However in rollback actions we assign back physical register to it.
Later it causes different assertions. One of them is in attached test.

This CL fixes this by avoiding assigning physical register back to register which has no usage
or its live interval now is empty.

Reviewed By: arsenm, qcolombet
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D127281
2022-06-14 12:04:17 +07:00
Sunho Kim 398df667d6 [JITLink][AArch64] Implement MoveWide16 generic edge.
Implements MoveWide16 generic edge kind that can be used to patch MOVZ/MOVK (imm16) instructions.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D127584
2022-06-14 13:51:47 +09:00
Nikolas Klauser ac251726f8 [libc++][NFC] clang-format <__config>
It's not perfect, but it's a lot better than the status quo.

Reviewed By: ldionne, #libc

Spies: EricWF, aheejin, libcxx-commits, dschuff, krytarowski, fedor.sergeev, mstorsjo, phosek, abrachet

Differential Revision: https://reviews.llvm.org/D127644
2022-06-14 06:47:38 +02:00
Argyrios Kyrtzidis f7e19a5928 [Lex] Keep track of skipped preprocessor blocks and advance the lexer directly if they are revisited
This speeds up preprocessing, specifically for preprocessing the clang sources time is reduced by about -36%,
using measurements on M1Pro with a release+thinLTO build.

Differential Revision: https://reviews.llvm.org/D127379
2022-06-13 21:46:46 -07:00
Kai Luo 7735653e16 [PowerPC] Update cfence tests to avoid using undef. NFC. 2022-06-14 12:45:46 +08:00
Mogball f8ec4dfa94 [mlir][sparse_tensor] fix windows build 2022-06-14 04:37:27 +00:00
Jacques Pienaar 743791d6d5 [mlir] Include attributes in ML program dialect ops def
I considered adding a new dialect top-level file with all ops,
attributes & types included, but didn't see practical benefit to it.
2022-06-13 21:35:34 -07:00
Sunho Kim 6cc3450a52 [JITLink][AArch64] Lift fixup functions from aarch64.cpp to aarch64.h. (NFC)
Lift fixup functions from aarch64.cpp to aarch64.h so that they have better chance of getting inlined. Also, adds some comments documenting the purpose of functions.

Reviewed By: sgraenitz

Differential Revision: https://reviews.llvm.org/D127559
2022-06-14 13:34:00 +09:00
Sunho Kim db37225803 [JITLink][AArch64] Unify table managers of ELF and MachO.
Unifies GOT/PLT table managers of ELF and MachO on aarch64 architecture. Additionally, it migrates table managers from PerGraphGOTAndPLTStubsBuilder to generic crtp TableManager.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D127558
2022-06-14 13:16:03 +09:00
Jacques Pienaar 3c68d58841 [mlir][doc] Move pass to passes list and remove redundant doc
The types are already included in the dialect doc (the attributes is not
properly yet, so retaining).
2022-06-13 21:01:31 -07:00
jacquesguan 5179f885d1 [mlir][Arithmetic] Fold NegF in MulF and DivF.
This patch adds the following combination:

mulf(negf(x), negf(y)) -> mulf(x, y)
divf(negf(x), negf(y)) -> divf(x, y)

Differential Revision: https://reviews.llvm.org/D126044
2022-06-14 03:15:19 +00:00
jacquesguan 059ee5d937 [mlir][Vector] Support vectorize to vector.reduction or/and.
This patch supports to vectorize affine.for of ori/andi to vector.reduction or/and.

Differential Revision: https://reviews.llvm.org/D127090
2022-06-14 03:11:45 +00:00
chenglin.bi 286198ff04 [InstCombine] Optimize lshr+shl+and conversion pattern
if `C1` and `C3` are pow2 and `Log2(C3) >= C2`:
    ((C1 >> X) << C2) & C3 -> X == (Log2(C1)+C2-Log2(C3)) ? C3 : 0
https://alive2.llvm.org/ce/z/zvrkKF

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D127469
2022-06-14 11:06:10 +08:00
Chenbing Zheng e99c07a30e [InstCombine] add tests for compare-signs 2022-06-14 11:02:18 +08:00
Fangrui Song bf0bac43ff [CodeGen] Initialize ISD after 800d222e53
In the Intrinsic::fptosi_sat branch, ISD was uninitialized when Tys.empty().
2022-06-13 19:52:21 -07:00
Fangrui Song 11cf75f602 [Driver][test] Make ananas.c and solaris-ld.c robust
`{{.*}}crt{{[^.]+}}.o` may match `"-r" "/tmp/lit-tmp-9ur5crtx/solaris-ld-4fa504.o"`
in a lit invocation.
2022-06-13 19:44:24 -07:00
Peixin-Qiao dafd3cf8b1 [flang] Complement one-to-one association check of bind name and entity name
As Fortran 2018 C802 and C873, if bind name is specified, there can only
be only one entity. The check for common block is missed before. As
Fortran 2018 8.5.5 point 2, the bind name is one identifier, which is
unique. That is, one entity can not have multiple bind names. Also add
this check.

Reviewed By: klausler, Jean Perier

Differential Revision: https://reviews.llvm.org/D126961
2022-06-14 10:34:38 +08:00
Peixin-Qiao c6d8aa27c5 [flang] Add semantic check for multiple part-ref with nonzero rank for TBP
As Fortran 2018 C919, there shall not be more than one part-ref with
nonzero rank. Support this semantic check for type-bound procedure to
address the issue https://github.com/llvm/llvm-project/issues/55811.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D127602
2022-06-14 10:17:44 +08:00
Fangrui Song 0ba43f4c2b [sanitizer] Add -lresolv only for non-Android non-musl Linux
Refine the D127145 logic with my original suggestion.
It turns out that many OSes don't have libresolv.
2022-06-13 19:12:13 -07:00
Jake Egan 1cf4113952 [libcxx][AIX] Switch build compiler to clang
This patch switches the build compiler for AIX from ibm-clang to clang. ibm-clang++_r has `-pthread` by default, but clang for AIX doesn't, so `-pthread` had to be added to the test config. A bunch of tests now pass, so the `XFAIL` was removed. This patch also switch the build to use the visibility support available in clang-15 to control symbols exported by the shared library (AIX traditionally uses explicit export lists for this purpose).

Reviewed By: #libc, #libc_abi, daltenty, #libunwind, ldionne

Differential Revision: https://reviews.llvm.org/D127470
2022-06-13 21:45:18 -04:00
Heejin Ahn ac4006b0d6 [InstCombine] Don't slice up PHIs when pred BB has catchswitch
If an integer PHI has an illegal type (according to the data layout) and
it is only used by `trunc` or `trunc(lshr)` operations, we split the PHI
into various instructions in its predecessors:
6d1543a167/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp (L1536-L1543)

So this can produce code like the following:
Before:
```
pred:
  ...

bb:
  %p = phi i8 [ %somevalue, %pred ], ...
  ...
  %tobool = trunc i8 %p to i1
  use %tobool
  ...
```
In this code, `%p` has an illegal integer type, `i8`, and its only used
in a `trunc` instruction later. In this case this pass puts extraction
code in its predecessors:

After:
```
pred:
  ...
  %t = and i8 %somevalue, 1
  %extract = icmp ne i8 %t, 0

bb:
  %p.new = phi i1 [ %extract, %pred ], ...
  use %p.new instead of %tobool
```

But this doesn't work if `pred` is a `catchswitch` BB because it cannot
have any non-PHI instructions. This CL ensures we bail out in that case.

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

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D127699
2022-06-13 18:32:09 -07:00
Ben Shi 3b6e166999 [Driver] Improve linking options for target AVR
1. Support user specified linker (-fuse-ld)
2. Support user specified linker script (-T)

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D126192
2022-06-14 01:30:49 +00:00
Philip Reames 800d222e53 [BasicTTI] Remove unused support for multiple opcodes in getTypeBasedIntrinsicInstrCost [nfc]
ISDs only ever contains a single ISD opcode.  We can simplify the code under this assumption. The code being removed was added back in 2016 in 0f26b0aeb4 to support FMAXNAN/FMINNAN, but at some point since then the motivating case was rewritten not to use the ISDs mechanism.  No reason to keep the false generality around now.
2022-06-13 18:23:39 -07:00
Ben Shi 520d17bfa0 Revert "[Driver] Improve linking options for target AVR"
This reverts commit d7599be9e8.
2022-06-14 09:12:21 +08:00
Lang Hames 14b7c108a2 [C-API][ORC] Add C API to suspend lookups during definition generation.
Slow definition generators may suspend lookups to temporarily release the
session lock, allowing unrelated lookups to proceed.

Using this functionality is discouraged: it is best to make definition
generation fast, rather than suspending the lookup. As a last resort where
this is not possible, suspension may be used.
2022-06-13 17:20:07 -07:00
Kazu Hirata 145cc9db2b [CodeGen] Remove futureWeight (NFC)
The last use was removed on Jun 5, 2022 in
commit 5c06f7168f, which itself was
a patch to remove unused code.
2022-06-13 17:10:23 -07:00
Ben Shi d7599be9e8 [Driver] Improve linking options for target AVR
1. Support linking with lld
2. Support user specifed linker script

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D126192
2022-06-13 23:38:59 +00:00
Lang Hames 803c770ee0 [C-API][ORC] Add LLVMOrcExecutionSessionLookup -- generic async symbol lookup.
An API to wrap ExecutionSession::lookup, this allows C API clients to use async
lookup.

The immediate motivation for adding this is to simplify upcoming
definition-generator unit tests.

As we're adding more tests that need to convert between C and C++ flag values
this commit adds helper functions to support this. This patch also updates the
CAPIDefinitionGenerator to use these new utilities.
2022-06-13 16:37:35 -07:00
Peter Klausler 6ce0fba0e8 [flang][runtime] Skip remainder of bad input record even with ADVANCE='NO'
After a recoverable error condition in a READ statement with ADVANCE='NO',
skip the remainder of the current record.

Differential Revision: https://reviews.llvm.org/D127433
2022-06-13 16:36:19 -07:00
V Donaldson d4980803b6 [flang] Intrinsic module procedure pure prefixes
Per 7.11.1p1 - All [ieee_arithmetic and ieee_exceptions] functions are
pure and all the subroutines are impure unless otherwise stated.  Most of
these functions are elemental (and not impure), which implies pure.
Several of the remaining non-elemental functions are missing pure prefixes;
add them.
2022-06-13 16:36:07 -07:00
Peter Klausler 850097d6dc [flang][runtime] Don't loop in runtime if blank appears in BOZ input
The code for scanning BOZ input allows for blanks and tabs to appear,
but can hang if they do and the BOZ input value is not followed by
extra valid digits; the repositioning for the second sweep simply
needed to be done in units of character, not valid digits.

Differential Revision: https://reviews.llvm.org/D127431
2022-06-13 16:26:50 -07:00
Peter Klausler f472c099be [flang] Handle USE association in parse tree rewriting
f18 was treating "f() = 1" as a statement function definition
if it could be viewed as being in the specification part and
"f" was a USE-associated function returning a data pointer.
(The non-USE-associated case is fine.)  Fix to allow for "f"
to be USE associated.

Differential Revision: https://reviews.llvm.org/D127430
2022-06-13 16:20:51 -07:00
Peter Klausler 8eebf46964 [flang] Fix crash on USE error
Handle the case of a non-generic procedure that is USE associated
into a scope that has a generic interface of the same name with an
appropriate error rather than crashing.

Differential Revision: https://reviews.llvm.org/D127429
2022-06-13 16:15:47 -07:00
Peter Klausler db52dda8ab [flang][runtime] Detect overflow of fixed-sized exponent output field
When Ew.dEe or Gw.dEe output has an exponent requiring more than 'e'
digits, the whole output field must overflow to asterisks.  The runtime
was detecting short fields and padding them with zeroes, but not
overflow.

Differential Revision: https://reviews.llvm.org/D127428
2022-06-13 16:10:32 -07:00
Peter Klausler 4c42e67bf7 [flang][runtime] Fix overflow detection for REAL input
The test for an overflow during decimal->binary conversion was taking
place too late, causing the data not to be rescanned from the beginning.

Differential Revision: https://reviews.llvm.org/D127427
2022-06-13 16:05:11 -07:00
Peter Klausler 3f3edbe5fc [flang][runtime] Don't emit any leading blanks for G0/E0 output editing
There were cases where E0.d output editing (or G0.d editing that is converted
to E0.d) would emit one or more leading blank characters; fix them.

Differential Revision: https://reviews.llvm.org/D127426
2022-06-13 16:03:24 -07:00
Craig Topper 17457be1c3 [RISCV] Fix use of texternalsym in output pattern where input was tglobaladdr. NFC
I don't think the name used in the output pattern is used to control
anything about the isel table emission, but it should match the input.
2022-06-13 15:42:42 -07:00
Mogball b1b4808c3f [mlir] Fix CMake file 2022-06-13 22:36:14 +00:00
Benjamin Kramer b8cdff8894 [bazel] Unbreak the build after cf6a7c1947 2022-06-14 00:23:17 +02:00
Mogball 537f220891 [mlir] Support getSuccessorInputs from parent op
Ops that implement `RegionBranchOpInterface` are allowed to indicate that they can branch back to themselves in `getSuccessorRegions`, but there is no API that allows them to specify the forwarded operands. This patch enables that by changing `getSuccessorEntryOperands` to accept `None`.

Fixes #54928

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D127239
2022-06-13 22:21:34 +00:00
Florian Hahn 68df5c5c13
[ConstraintElimination] Add tests with cmps with constant ops only.
Add extra test coverage for conditions with constant ops.
2022-06-13 22:57:54 +01:00
Stanislav Mekhanoshin c97436f8b6 [AMDGPU] Use null for dead sdst operand
Differential Revision: https://reviews.llvm.org/D127542
2022-06-13 14:41:40 -07:00
Amir Ayupov 02d510b416 [BOLT][NFC] Pass Function to BC.printInstructions in BinaryBasicBlock::dump
BC::printInstruction(s) has many uses of Function ptr if it's available:
# printing CFI instructions (unconditional)
# printing debug line information (-print-debug-info)
# printing instruction relocations (-print-relocations)

Enable these uses by passing Function ptr from the primary printing entry point:
BinaryBasicBlock::dump.

Reviewed By: maksfb

Differential Revision: https://reviews.llvm.org/D126916
2022-06-13 14:26:51 -07:00
Kazu Hirata 5c41b0f429 [Analysis] Remove getUniqueInstruction (NFC)
The last use was removed on Apr 7, 2022 in commit
5cefe7d9f5.
2022-06-13 14:26:20 -07:00