Commit Graph

434775 Commits

Author SHA1 Message Date
Nikita Popov 20524a3c94 [LICM] Add another byval capture test (NFC)
Variant with capture after the loop, in which case promotion is
safe.
2022-09-01 15:18:10 +02:00
serge-sans-paille e0746a8a8d [clang] cleanup -fstrict-flex-arrays implementation
This is a follow up to https://reviews.llvm.org/D126864, addressing some remaining
comments.

It also considers union with a single zero-length array field as FAM for each
value of -fstrict-flex-arrays.

Differential Revision: https://reviews.llvm.org/D132944
2022-09-01 15:06:21 +02:00
Nikita Popov e1826326af [LICM] Add test for byval scalar promotion miscompile (NFC) 2022-09-01 15:03:20 +02:00
Ilia Diachkov 698c800142 [SPIRV] support builtin types and ExtInsts selection
The patch adds the support of OpenCL and SPIR-V built-in types. It also
implements ExtInst selection and adds spv_unreachable and spv_alloca
intrinsics which improve the generation of the corresponding SPIR-V code.
Five LIT tests are included to demonstrate the improvement.

Differential Revision: https://reviews.llvm.org/D132648

Co-authored-by: Aleksandr Bezzubikov <zuban32s@gmail.com>
Co-authored-by: Michal Paszkowski <michal.paszkowski@outlook.com>
Co-authored-by: Andrey Tretyakov <andrey1.tretyakov@intel.com>
Co-authored-by: Konrad Trifunovic <konrad.trifunovic@intel.com>
2022-09-01 16:44:54 +03:00
Sanjay Patel c3d1504d63 [InstCombine] fix crash on type mismatch with fcmp fold
The existing predicate doesn't work for a single-element
vector, so make sure we are not crossing scalar/vector types.

Test (was crashing) based on the post-commit example for:
4827771234
2022-09-01 08:57:55 -04:00
Sanjay Patel addbdac5d5 [InstCombine] fold power-of-2 ctlz/cttz with inverted result
When X is a power-of-two or zero and zero input is poison:
ctlz(i32 X) ^ 31 --> cttz(X)
cttz(i32 X) ^ 31 --> ctlz(X)

https://alive2.llvm.org/ce/z/Cs7sFE
2022-09-01 08:57:55 -04:00
Alex Bradbury 6e1897ce95 [RISCV][NFC] Fix typo in comment in RISCVInstrInfoZicbo.td
Zicbop->Zicbom typo.
2022-09-01 13:49:55 +01:00
Nikita Popov 3f8b1d0f15 [LICM] Add some debug output to scalar promotion (NFC) 2022-09-01 14:46:30 +02:00
Bjorn Pettersson 3aab9d2bb7 [GVN] Pre-commit test case showing miscompile in github issue #57025
This commit adds a reproducer for
  https://github.com/llvm/llvm-project/issues/57025
showing a miscompile in GVN.

Not sure how likely this kind of faults would be in a normal pipeline,
considering that the input IR has some dead code in it. On the other
hand, GVN itself sometimes creates dead basic blocks when splitting
critical edges. Anyway, the fault was found when doing fuzzy testing
using random pass pipelines.

Differential Revision: https://reviews.llvm.org/D131775
2022-09-01 14:43:24 +02:00
Alexey Bataev 982d9ef1c1 [SLP]Fix PR55734: SLP vectorizer's reduce_and formation introduces poison.
Need either follow the original order of the operands for bool logical
ops, or emit freeze instruction to avoid poison propagation.

Differential Revision: https://reviews.llvm.org/D126877
2022-09-01 05:34:45 -07:00
Amara Emerson 4cf3db41da [GlobalISel] Add sdiv exact (X, constant) -> mul combine.
This port of the SDAG optimization is only for exact sdiv case.

Differential Revision: https://reviews.llvm.org/D130517
2022-09-01 13:34:00 +01:00
Yuanbo Li ebd0249fcf [DebugInfo] Missing debug location after replacement in processSRem function
This patch fixes an issue in which CorrelatedValuePropagation::processSRem
would create new instructions to represent the SRem instruction, but would not
correctly copy any existing debug location metadata to the new instruction.

Differential Revision: https://reviews.llvm.org/D132218
2022-09-01 13:18:17 +01:00
Egor Zhdan 0cb0809336 [Clang][Comments] Parse `<img src=""/>` in doc comments correctly
This is a valid HTML5 tag. Previously it triggered a Clang error (`HTML start tag prematurely ended, expected attribute name or '>'`) since Clang was treating `/>` as a text token. This was happening because after lexing the closing quote (`"`) the lexer state was reset to "Normal" while the tag was not actually closed yet: `>` was not yet parsed at that point.

rdar://91464292

Differential Revision: https://reviews.llvm.org/D132932
2022-09-01 13:17:42 +01:00
Michał Górny 39e0a87c26 [lldb] [Core] Pass error/status from Communication::ReadThread()
Ensure that the ConnectionStatus and Status from
Communication::ReadThread() is correctly passed to ::Read() in order
to fix further discrepancies between ::Read() calls in non-threaded
and threaded modes.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D132577
2022-09-01 14:16:38 +02:00
Florian Hahn fc444ddc77
[VPlan] Add field to track if intrinsic should be used for call. (NFC)
This patch moves the cost-based decision whether to use an intrinsic or
library call to the point where the recipe is created. This untangles
code-gen from the cost model and also avoids doing some extra work as
the information is already computed at construction.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D132585
2022-09-01 13:14:40 +01:00
Nicolas Vasilache 153709c093 [mlir] Address post commit comments on 8f2457ccf0 and fix the test 2022-09-01 04:38:35 -07:00
Dylan Fleming e5caa0f229 [Flang][OpenMP] Add support for real typed reductions in worksharing-loop
Allows addition/multiplication reductions to be used with
real types by adding getReductionOperation() to OpenMP.cpp,
which can select either integer or floating-point instruction.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D132459
2022-09-01 11:16:42 +00:00
Nuno Lopes fa154a9170 Revert "Expand Div/Rem: consider the case where the dividend is zero"
This reverts commit 4aed09868b.
2022-09-01 12:11:22 +01:00
Nathan James cc09b81265
[CTE][docs] Fix bad links in ReleaseNotes 2022-09-01 12:10:53 +01:00
Nicolas Vasilache 8f2457ccf0 [mlir][Linalg] Add missing support for memory space to DropUnitDims
Previously, the memory space would not be propagated properly, creating invalid IR.

Differential Revision: https://reviews.llvm.org/D133101
2022-09-01 04:10:27 -07:00
Nuno Lopes 4aed09868b Expand Div/Rem: consider the case where the dividend is zero
So we can't use ctlz in poison-producing mode
2022-09-01 12:00:03 +01:00
Pavel Samolysov 527b9a9d90 [DeadArgElim] Use structure bindings in foreach loops. NFC
Differential Revision: https://reviews.llvm.org/D133026
2022-09-01 13:48:46 +03:00
LLVM GN Syncbot f252b8477e [gn build] Port d931ac9e27 2022-09-01 10:19:04 +00:00
Wei Yi Tee d931ac9e27 [clang][dataflow] Generalise match switch utility to other AST types and add a `CFGMatchSwitch` which currently handles `CFGStmt` and `CFGInitializer`.
`MatchSwitch` currently takes in matchers and functions for the `Stmt` class.

This patch generalises the match switch utility (renamed to `ASTMatchSwitch`) to work for different AST node types by introducing a template argument which is the base type for the AST nodes that the match switch will handle.

A `CFGMatchSwitch` is introduced as a wrapper around multiple `ASTMatchSwitch`s for different base types. It works by unwrapping `CFGElement`s into their contained AST nodes and passing the nodes to the relevant `ASTMatchSwitch`. The `CFGMatchSwitch` currently only handles `CFGStmt` and `CFGInitializer`.

Reviewed By: gribozavr2, sgatev

Differential Revision: https://reviews.llvm.org/D131616
2022-09-01 10:15:53 +00:00
Sam Clegg 849df8f6f0 [clang][WebAssembly] Pass `-Wa,--no-type-check` through to the MC layer
I took as an example the `-Wa,--noexecstack` clang flag that maps down
to `cc1 -mnoexecstack`.

Differential Revision: https://reviews.llvm.org/D131217
2022-09-01 02:56:58 -07:00
David Spickett d46ea783e6 [LLDB] Simplify cmake for instruction emulation unit tests
I got suspicious because of checking "ARM" for an "ARM64" plugin.
As far as I can tell these never needed an llvm target to function.

Looking at the corresponding cmake for the libraries under test they
don't reference target libraries either.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D133024
2022-09-01 09:40:04 +00:00
Anastasia Stulova 6b1a04529c [OpenCL][SPIR-V] Test extern functions with a pointer arg.
Added a test case that enhances coverage of opaque pointers
particularly for the problematic case with extern functions
for which there is no solution found for type recovery.

Differential Revision: https://reviews.llvm.org/D130768
2022-09-01 10:22:47 +01:00
Sheng c640b8ce33 [NFC][clang] LLVM_FALLTHROUGH => [[fallthrough]] 2022-09-01 09:19:00 +00:00
David Spickett 6829cd17b5 [LLVM] Add missing stdint include to Bit.h
To fix failing builds on Windows on Arm:
https://lab.llvm.org/staging/#/builders/59/builds/928/steps/4/logs/stdio

<...>/ADT/bit.h(50,5): error: unknown type name 'uint32_t'
    uint32_t v = Value;
    ^
2022-09-01 09:17:35 +00:00
Douglas Yung 9eadad51ba Revert "[test][msan] Basic debug info test"
This reverts commit ed241e8730.

This test is failing on many bots:

https://lab.llvm.org/buildbot/#/builders/3/builds/12656
https://lab.llvm.org/buildbot/#/builders/6/builds/12696
https://lab.llvm.org/buildbot/#/builders/9/builds/12687
https://lab.llvm.org/buildbot/#/builders/58/builds/25332
https://lab.llvm.org/buildbot/#/builders/67/builds/8059
https://lab.llvm.org/buildbot/#/builders/117/builds/8806
https://lab.llvm.org/buildbot/#/builders/139/builds/27430
https://lab.llvm.org/buildbot/#/builders/164/builds/24139
https://lab.llvm.org/buildbot/#/builders/216/builds/9144
2022-09-01 02:09:04 -07:00
Muhammad Omair Javaid 0e6a71e6a3 [LLDB] Make build.py use uname to set platform
This patch makes build helper script build.py to use platform.uname for
machine/architecture detection. Visual studio environment when set using
various batch files like vcvars*.bat set PLATFORM environment variable
however VsDevCmd.bat does not set PLATFORM variable.

Differential Revision: https://reviews.llvm.org/D133011
2022-09-01 14:00:47 +05:00
Muhammad Omair Javaid 4db7832203 [LLDB] Make API tests to run using MSYS tools
MSYS 'uname' on windows returns "MSYS_NT*" instead of windows32 and also
MSYS 'pwd' returns non-windows path string.
This patch fixes Makefile.rules to make adjustments required to run LLDB
API tests using MSYS tools.

Differential Revision: https://reviews.llvm.org/D133002
2022-09-01 14:00:46 +05:00
Nikita Popov 43e7d9af1d [InstCombine] Fold extractvalue of phi
Just as we do for most other operations, we should push
extractvalue instructions through phis, if this does not increase
unfolded instruction count.
2022-09-01 10:51:54 +02:00
Nikita Popov 5b219dd9e9 [InstCombine] Add tests for extractvalue of phi (NFC) 2022-09-01 10:47:10 +02:00
Chuanqi Xu 7e19d53da4 [NFC] Emit builtin coroutine calls uniforally
All the coroutine builtins were emitted in EmitCoroutineIntrinsic except
__builtin_coro_size. This patch tries to emit all the corotine builtins
uniformally.
2022-09-01 16:31:51 +08:00
Sam Clegg 92920c4fe3 [MC][WebAssembly] Allow accurate errors in doBeforeLabelEmit
Although we only currently have one error produced in this function I am
working on changes right now that add some more.  This change makes the
error location more accurate.

Differential Revision: https://reviews.llvm.org/D133016
2022-09-01 01:26:33 -07:00
liqinweng c45810f810 [RISCV] When ISD::SETUGT && Imm == -1, has processed before lowering
When ISD::SETUGT && Imm == -1, has processed before lowering. Use assert replace it

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D132373
2022-09-01 15:38:16 +08:00
liqinweng 62a238a1f8 [RISCV][NFC] Add cost model tests of llvm.fmuladd
Reviewed By: benshi001

Differential Revision: https://reviews.llvm.org/D132922
2022-09-01 15:33:02 +08:00
Balázs Kéri d56a1c6824 [clang][analyzer] Errno modeling code refactor (NFC).
Some of the code used in StdLibraryFunctionsChecker is applicable to
other checkers, this is put into common functions. Errno related
parts of the checker are simplified and renamed. Documentations in
errno_modeling functions are updated.

This change makes it available to have more checkers that perform
modeling of some standard functions. These can set the errno state
with common functions and the bug report messages (note tags) can
look similar.

Reviewed By: steakhal, martong

Differential Revision: https://reviews.llvm.org/D131879
2022-09-01 09:05:59 +02:00
Matthias Springer 547942841f [mlir][interfaces] Drop `dest`/`tileDestOperands` from TilingInterface
`getTiledImplementation`/`generateResultTileValue` only computes the tiled operation, but does not insert the result into any tensor.

Differential Revision: https://reviews.llvm.org/D133015
2022-09-01 08:53:53 +02:00
Tres Popp 7c0cf32838 bazel fixes for c55b41d519 2022-09-01 08:19:52 +02:00
YingChi Long 5ee51e8154
[clang] trim trailing space in format tests. NFC
Found in https://reviews.llvm.org/D132568

Differential Revision: https://reviews.llvm.org/D133085
2022-09-01 13:30:40 +08:00
Vitaly Buka ed241e8730 [test][msan] Basic debug info test 2022-08-31 22:06:21 -07:00
Fangrui Song 5e643cd7b7 [ELF] --gdb-index: error if constant pool size exceeds UINT32_MAX
If so, the last symbol's name_offset likely exceeds 0xffffffff and is not
supported by the format
(https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html#Index-Section-Format).
I have seen an internal oversized executable with such a corrupted .gdb_index
2022-08-31 21:10:01 -07:00
Fangrui Song 7a20d6abe4 [ELF] Correctly compute .gdb_index size when symbol's name offset overflows
if `nameOff` overflows, `size` may be underestimated.
In writeTo, `memcpy(buf + sym.nameOff, sym.name.data(), sym.name.size());` may
cause an out-of-bounds write, leading to a SIGSEGV.
2022-08-31 21:04:26 -07:00
gonglingqin 6e47ebdcec [LoongArch] Support ISD::BR_CC and branch according to condition flag register
Use bceqz/bcnez instead of movcf2gr + bnez/beqz for branch jumps.

Differential Revision: https://reviews.llvm.org/D132824
2022-09-01 10:43:16 +08:00
Arthur Eubanks 04f3c20989 [NFC][LICM] Stop passing around unused BFI
Uses of this were removed in 1a25d0bfbb.
2022-08-31 19:15:34 -07:00
YingChi Long e3bd67eddf
[clang][Sema] check default argument promotions for printf
The main focus of this patch is to make ArgType::matchesType check for
possible default parameter promotions when the argType is not a pointer.
If so, no warning will be given for `int`, `unsigned int` types as
corresponding arguments to %hhd and %hd. However, the usage of %hhd
corresponding to short is relatively rare, and it is more likely to be a
misuse. This patch keeps the original behavior of clang like this as
much as possible, while making it more convenient to consider the
default arguments promotion.

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

Reviewed By: aaron.ballman, nickdesaulniers, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D132568
2022-09-01 10:10:10 +08:00
Mark Zhuang 62454e83b0 [NFC] Fix typo
Reviewed By: eopXD

Differential Revision: https://reviews.llvm.org/D133079
2022-08-31 19:08:46 -07:00
Louis Dionne c084b14866 [runtimes] Shrink the set of runtimes included in the bootstrapping build by default
This patch is in preparation for removing libcxx, libcxxabi and libunwind
from LLVM_ENABLE_PROJECTS. When we make that switch, folks who were
previously using LLVM_ENABLE_PROJECTS=all in order to build those
runtimes will be able to add LLVM_ENABLE_RUNTIMES=all to start building
those projects using the bootstrapping build.

This is technically a breaking change for folks who had been using
LLVM_ENABLE_RUNTIMES=all, however I suspect the set of people currently
doing that is extremely small, so this is likely acceptable (more than
breaking folks who are using LLVM_ENABLE_PROJECTS=all).

Differential Revision: https://reviews.llvm.org/D132479
2022-08-31 21:41:56 -04:00