Commit Graph

415940 Commits

Author SHA1 Message Date
Balazs Benics 7036413dc2 Revert "Revert "[analyzer] Fix taint rule of fgets and setproctitle_init""
This reverts commit 2acead35c1.

Let's try `REQUIRES: asserts`.
2022-02-23 12:55:31 +01:00
Balazs Benics a848a5cf2f Revert "Revert "[analyzer] Fix taint propagation by remembering to the location context""
This reverts commit d16c5f4192.

Let's try `REQUIRES: asserts`.
2022-02-23 12:53:07 +01:00
Dawid Jurczak fbe38a784e [NFC][Lexer] Make access to LangOpts more consistent
Before this change without any good reason Lexer::LangOpts is sometimes accessed by getter and another time read directly in Lexer functions.
Since getLangOpts is a bit more verbose prefer direct access to LangOpts member when possible.

Differential Revision: https://reviews.llvm.org/D120333
2022-02-23 12:46:13 +01:00
Nikita Popov 6777ec9e4d [ValueTracking] Support signed intrinsic clamp
This is the same special logic we apply for SPF signed clamps
when computing the number of sign bits, just for intrinsics.

This just uses the same logic as the select case, but there's
multiple directions this could be improved in: We could also use
the num sign bits from the clamped value, we could do this during
constant range calculation, and there's probably unsigned analogues
for the constant range case at least.
2022-02-23 12:45:16 +01:00
Nikita Popov d6e008089c [InstCombine] Add tests for add of clamp pattern (NFC)
Add intrinsic versions of existing SPF tests.
2022-02-23 12:45:16 +01:00
iains e0f1dd018e [C++20][Modules] Rework testcase to use split file [NFC].
This switches the testcase committed for initial C++20 modules import tracking to
use split-file rather than preprocessor directives.

Differential Revision: https://reviews.llvm.org/D120352
2022-02-23 11:07:36 +00:00
Alex Bradbury c5bcfb983e [RISCV] Avoid infinite loop between DAGCombiner::visitMUL and RISCVISelLowering::transformAddImmMulImm
See https://github.com/llvm/llvm-project/issues/53831 for a full discussion.

The basic issue is that DAGCombiner::visitMUL and
RISCVISelLowering;:transformAddImmMullImm get stuck in a loop, as the
current checks in transformAddImmMulImm aren't sufficient to avoid all
cases where DAGCombiner::isMulAddWithConstProfitable might trigger a
transformation. This patch makes transformAddImmMulImm bail out if C0
(the constant used for multiplication) has more than one use.

Differential Revision: https://reviews.llvm.org/D120332
2022-02-23 11:05:46 +00:00
Anton Afanasyev f84d732f8c [AggressiveInstCombine] Add `phi` nodes support to `TruncInstCombine`
Expand `TruncInstCombine` to handle loops by adding `phi` nodes
to expression graph.

Reviewed by: RKSimon, lebedev.ri

Differential Revision: https://reviews.llvm.org/D109817
2022-02-23 14:01:55 +03:00
Nikita Popov e2f627e5e3 [InstCombine] Fold sub of umin to usub.sat
We were handling sub of umax, but not the conjugated umin case.

https://alive2.llvm.org/ce/z/4fdZfy
https://alive2.llvm.org/ce/z/BhUQBM
2022-02-23 12:00:34 +01:00
Nikita Popov 4b5261e10f [InstCombine] Add tests for sub of umin intrinsic (NFC)
We should be converting these into usub.sat.
2022-02-23 12:00:34 +01:00
Valery Pykhtin 152325d2f3 [ArgPromotion] Regenerate test checks for crash.ll – restored ALL_OLDPM prefix,
add –allow-unused-prefixes.

This test has two runs that differ in what functions are left after the inliner,
for example: barney exists on OLDPM path but don’t exist on NEWPM path.
I restored prefixes this test had had after automatic checks were introduced
for this test.

For now there are no checks left for ALL_NEWPM path, but the behavior seem to
change over time so I added –allow-unused-prefixes to ease following check updates.

Renamed %tmp => %temp IR values to avoid update warning.

Differential revision: https://reviews.llvm.org/D120207
2022-02-23 13:39:46 +03:00
Stanislav Gatev 169e1aba55 Revert "[clang][dataflow] Add support for global storage values"
This reverts commit 7ea103de14.
2022-02-23 10:32:17 +00:00
Iain Sandoe 5a74e6a21c [Modules] Add module structure output to -module-file-info.
It is useful to be able to visualise the C++20 modules content of a PCM file
both for inspection and for testing.  In particular, when adding more module
types to support C++20 Partitions and Header Units, we would like to be able
to confirm that the output PCM has the intended structure.

The existing scheme for dumping data is restricted to the content of the AST
file control block, which does not include structural data beyond imports.

The change here makes use of the AST unit that is set up by BeginSourceFile
to query for the information on the primary and sub-modules.  We can then
inspect each of these in turn, accounting for Global, Private, Imported and
Exported modules/fragments and then showing the sub-stucture of the main
module(s).

The disadvantage of this mechanism is that it has no easy method to control
the granularity of the output.  Perhaps more detailed inspection would be
better handled by a stand-alone module inspection tool.

Differential Revision: https://reviews.llvm.org/D119823
2022-02-23 10:26:42 +00:00
LLVM GN Syncbot 7021b5a2fa [gn build] Port 25d7b4fb44 2022-02-23 10:12:15 +00:00
Simon Pilgrim 9d91e03b7d [clang] CIndex.cpp - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointers are used immediately, so assert the cast is correct instead of returning nullptr
2022-02-23 10:09:44 +00:00
Andrzej Warzynski 16a91a1cbe [flang][driver] Make `flang-new` always generate run-time type info
Currently, the driver generates the tables with "run-time type
information for derived types" only when specific actions are run.
However, the corresponding data might be required by the subsequent
compilation stages (e.g. lowering, code-gen) and should be generated
unconditionally. Note that this is only possible once the semantic
checks have been run.

Note that when generating these tables, extra semantic errors might be
generated. The driver will always report these and in most cases such
semantic errors will cause the driver to exit immediately. The only
exception are actions inheriting from `PrescanAndSemaDebugAction`.
Currently, there's only one such action: `DebugDumpAllAction`
(corresponds to `-fdebug-dump-all` command-line flag). I've updated the
comments for this action to clarify this.

This change will mostly affect lowering, which currently is only
available for most basic examples (e.g. empty programs). I wasn't able
to find a working case that would demonstrate the new behaviour. I
hope that this change is straightforward enough and am submitting it
without a test.

Differential Revision: https://reviews.llvm.org/D120051
2022-02-23 10:08:03 +00:00
Alexey Lapshin 25d7b4fb44 [objcopy][NFC] Rename files to avoid clashing of archive members.
libtool uses file names to name members of an static library.
Files, located in different directories and having matching name,
would have the same name inside an archive. This is not a problem
for ld, but may be a problem for ar. This patch renames files
from ObjCopy library to avoid names clashing.

See https://reviews.llvm.org/D88827#3335814

Differential Revision: https://reviews.llvm.org/D120345
2022-02-23 13:05:39 +03:00
Adrian Kuegel 0fc11418a7 [mlir][Bazel] Fix wrong dependency for GPUBaseIncGen. 2022-02-23 10:53:35 +01:00
Anton Afanasyev ea249489f5 [Test][AggressiveInstCombine] Add test for `phi` instruction 2022-02-23 12:50:50 +03:00
Balazs Benics fa0a80e017 Revert "Revert "[analyzer] Add failing test case demonstrating buggy taint propagation""
This reverts commit b8ae323cca.

Let's try `REQUIRES: asserts`.
2022-02-23 10:48:06 +01:00
Simon Moll 606320ed30 [VE][NFC] Move functions to VVP module
Separate vector isel functions to the module they belong to. Keep scalar
stuff and calls into vector isel in the VEISelLowering.
2022-02-23 10:44:56 +01:00
serge-sans-paille eb4c860811 Cleanup llvm/DebugInfo/PDB headers
accumulated preprocessed size:
before: 1065515095
after: 1065629059

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D120195
2022-02-23 10:31:34 +01:00
Bill Wendling 823b32fbfb [NFC] Add #include for constants 2022-02-23 01:26:53 -08:00
Bill Wendling c1b9672534 [NFC] Add #include for constants 2022-02-23 01:23:45 -08:00
Tobias Hieta 8182dba0c2 [compiler-rt][builtins] Fix CMake builtin target flag
clang-cl doesn't support -target <target>, instead it only supports
--target=<target> so building a RUNTIME configuration for clang-cl
ended up in never building builtins. Which in turn lead to clang-cl
not being able to find the runtime libraries because we depend
on the compiler_rt.builtins.lib being in the runtime dir for the
Driver to add it as a candidate.

I don't think this should have any downsides since most the code
these days are using --target=<target> instead of the old syntax.

Reviewed By: mstorsjo

Differential Revision: https://reviews.llvm.org/D120308
2022-02-23 10:23:17 +01:00
Bill Wendling a5bbc6ef99 [NFC] Remove unnecessary "#include"s from header files 2022-02-23 01:20:48 -08:00
David Green a10789d6cd [ARM] Recognize SSAT and USAT from SMIN/SMAX
We have some recognition of SSAT and USAT from SELECT_CC at the moment.
This extends the matching to SMIN/SMAX which can help catch more cases,
either from min/max being the canonical form in instcombine or from some
expanded nodes like fp_to_si_sat.

Differential Revision: https://reviews.llvm.org/D119819
2022-02-23 08:55:54 +00:00
Nikita Popov 65dc78d63e [InstCombine] Remove one-use limitation from X-Y==0 fold
This one-use limitation is artificial, we do not increase
instruction count if we perform the fold with multiple uses. The
motivating case is shown in @sub_eq_zero_select, where the one-use
limitation causes us to miss a subsequent select fold.

I believe the backend is pretty good about reusing flag-producing
subs for cmps with same operands, so I think doing this is fine.

Differential Revision: https://reviews.llvm.org/D120337
2022-02-23 09:37:30 +01:00
Nathan James 79353f940c
[clang-tidy][NFC] Remove Tristate from CachedGlobList
The tristate is a little redundant as we can determine if the item was already in the cache based on the return from try_emplace.

Reviewed By: salman-javed-nz

Differential Revision: https://reviews.llvm.org/D120196
2022-02-23 08:35:31 +00:00
Nathan James c34d898183
[ASTMatchers] Expand isInline matcher to VarDecl
Add support to the `isInline` matcher for C++17's inline variables.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D118900
2022-02-23 08:34:00 +00:00
Chuanqi Xu f85a6a8127 [NFC] Add unittest for Decl::isInExportDeclContext 2022-02-23 16:29:42 +08:00
Stanislav Gatev 7ea103de14 [clang][dataflow] Add support for global storage values
This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: ymandel, xazax.hun

Differential Revision: https://reviews.llvm.org/D120149
2022-02-23 08:27:58 +00:00
LLVM GN Syncbot ef9a659631 [gn build] Port a2fab82f33 2022-02-23 08:21:48 +00:00
Haojian Wu a2fab82f33 [pseudo] Implement LRTable.
This patch introduces a dense implementation of the LR parsing table, which is
used by LR parsers.

We build a SLR(1) parsing table from the LR(0) graph.

Statistics of the LR parsing table on the C++ spec grammar:
  - number of states: 1449
  - number of actions: 83069
  - size of the table (bytes): 334928

Differential Revision: https://reviews.llvm.org/D118196
2022-02-23 09:21:34 +01:00
Lian Wang 3497124771 [RISCV] Add more test for GORCI aliaes in Zbp extension
Supplement tests for some aliaes of gorci.

RV32:
add orc4.h/orc2.h in rv32zbp.ll
add orc.h/orc16/orc8/orc4/orc2/orc in rv32zbp-intrinsic.ll

RV64:
add orc4.h/orc2.h in rv64zbp.ll
add orc.h/orc32/orc16/orc8/orc4/orc2/orc/orc16.w/orc8.w/
    orc4.w/orc2.w/orc.w in rv64zbp-intrinsic.ll

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D120388
2022-02-23 08:02:33 +00:00
Valentin Clement b3d1f073de
[flang] Lower real constant
This patch handles lowering of real constant.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2022-02-23 08:27:54 +01:00
Lian Wang 7abcb7ba87 [RISCV] Supplement more tests for GREVI aliaes in Zbp extension
Supplement tests for some aliaes of grevi.

RV32:
add rev4.h/rev2.h in rv32zbp.ll
add rev/rev2/rev4/rev8/rev16 in rv32zbp-intrinsic.ll

RV64:
add rev4.h/rev2.h in rv64zbp.ll
add rev.h/rev/rev2/rev4/rev8/rev16/rev32/rev.w/rev2.w/
    rev4.w/rev8.w/rev16.w in rv64zbp-intrinsic.ll

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D120304
2022-02-23 06:15:52 +00:00
minglotus-6 f415d74d1d [SampleProfile] Handle the case when the option `MaxNumPromotions` is zero.
In places where `MaxNumPromotions` is used to allocated an array, bail out early to prevent allocating an array of length 0.

Differential Revision: https://reviews.llvm.org/D120295
2022-02-22 21:44:32 -08:00
Fangrui Song b96fc4860f [ELF][test] Fix CU address_size in some gdb-index tests
Revert 251640ab57 which fixed the wrong thing.

While here, add `2>&1 | count 0` to assert no warning from lib/DebugInfo/DWARF.
2022-02-22 21:42:15 -08:00
Fangrui Song 045f07b7dc [ProfileData] Remove unused and racy FunctionSamples::Format after D51643
The write may be racy if ThinLTO creates multiple `InProcessThinBackend` instances.
2022-02-22 20:29:08 -08:00
Alex Lorenz f5153d9e72 [compiler-rt][builtins] build the macOS compiler-rt built-ins with Mac Catalyst support
This patch extends compiler-rt's cmake config to build macOS builtins with both macOS and Mac Catalyst support.
This is done by telling the compiler to emit macho files with two build version load commands.

Differential Revision: https://reviews.llvm.org/D118875
2022-02-22 19:32:19 -08:00
Fangrui Song 251640ab57 [ELF][test] Terminate .debug_info with a null entry to fix warnings 2022-02-22 19:20:56 -08:00
Arthur Eubanks 36e335eeb5 [clang] Remove Address::deprecated() calls in CodeGenFunction.cpp 2022-02-22 18:28:49 -08:00
Joseph Huber 6a0b78af91 [OpenMP] Remove static allocator in linker wrapper
Summary:
We don't need this static allocator to survive the entire file, the
strings stored have a defined lifetime.
2022-02-22 21:22:19 -05:00
Joseph Huber 55cb84d9fb [OpenMP] Unrecognized objects should not be considered failure
Summary:
This patch removes the error we recieve when attempting to extract
offloading sections. We shouldn't consider this a failure because
extracting bitcode isn't necessarily required.
2022-02-22 21:22:18 -05:00
David Blaikie 2172b1758d Remove redundant word word in AsmParser DIFlag parsing 2022-02-22 17:50:13 -08:00
Philip Reames a9861d3c85 [instcombine] Avoid binops for comparison consistency tests
It turns out that instcombine is smarter than I am, and several of these ended up folded for the wrong reasons.
2022-02-22 17:26:03 -08:00
Amara Emerson b661470bce Revert "Revert "[AArch64][GlobalISel] Optimize conjunctions of compares to conditional compares.""
This reverts commit 55c181a6c7.

The original commit I made was an old patch, mea culpa. Committing the right
implementation with test case for the reported crash.
2022-02-22 17:22:11 -08:00
Arthur Eubanks cde658fa1f [clang] Remove Address::deprecated() calls in CGVTables.cpp 2022-02-22 16:54:28 -08:00
Alina Sbirlea 7fea963a45 [Docs] Add self to credits 2022-02-22 16:43:53 -08:00