Commit Graph

426336 Commits

Author SHA1 Message Date
Christopher Di Bella f21187eb2d [clang][tablegen] adds human documentation to `WarningOption`
Building on D126796, this commit adds the infrastructure for being able
to print out descriptions of what each warning does.

Differential Revision: https://reviews.llvm.org/D126832
2022-06-10 17:23:00 +00:00
Joe Nash 78d8fdb88b [AMDGPU] NFC. Comment change to GFX10+ in AsmParser 2022-06-10 12:34:07 -04:00
Joe Nash 9175ab7746 [AMDGPU] gfx11 SRC_POPS_EXISTING_WAVE_ID is removed 2022-06-10 12:32:22 -04:00
Michael Jones 6ce490e5a6 [libc] add buffering to FILE writes
Previously all FILE objects were fully buffered, this patch adds line
buffering and unbuffered output, as well as applying them to stdout and
stderr.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D126829
2022-06-10 09:58:46 -07:00
Benjamin Kramer 6ee5baeb97 [libc][math] Add EXP_MANT_MASK when long double is double or quad 2022-06-10 18:48:31 +02:00
Sanjay Patel e247b0e5c9 [InstCombine] add narrowing transform for low-masked binop with zext operand (2nd try)
The 1st try ( afa192cfb6 ) was reverted because it could
cause an infinite loop with constant expressions.

A test for that and an extra condition to enable the transform
are added now. I also added code comments to better describe
the transform and the existing, related transform.

Original commit message:
https://alive2.llvm.org/ce/z/hRy3rE

As shown in D123408, we can produce this pattern when moving
casts around, and we already have a related fold for a binop
with a constant operand.
2022-06-10 12:42:27 -04:00
Sanjay Patel 4c3139d7b9 [InstCombine] add test for mask op with constant expression; NFC
This is reduced from the post-commit C example in:
afa192cfb6

That was reverted with:
6fedc6a2b4

This will infinite loop unless that transform or the ones
with casts that can "EvaluateInDifferentType" are limited
to ignore constant expressions.
2022-06-10 12:42:27 -04:00
Yusra Syeda 487ace4c73 [SystemZ][z/OS] Add llvm.read_register() intrinsic support for zOS
Differential Revision: https://reviews.llvm.org/D127412
2022-06-10 12:30:07 -04:00
Shao-Ce SUN 117e10304b [RISCV] move `isFaultFirstLoad` into `RISCVInstrInfo`
Fix build errors in D126794

```
ld.lld: error: undefined symbol: llvm::MachineInstr::getNumExplicitDefs() const
>>> referenced by RISCVBaseInfo.cpp
>>>               RISCVBaseInfo.cpp.o:(llvm::isFaultFirstLoad(llvm::MachineInstr const&)) in archive lib/libLLVMRISCVDesc.a

ld.lld: error: undefined symbol: llvm::MachineInstr::findRegisterDefOperandIdx(llvm::Register, bool, bool, llvm::TargetRegisterInfo const*) const
>>> referenced by RISCVBaseInfo.cpp
>>>               RISCVBaseInfo.cpp.o:(llvm::isFaultFirstLoad(llvm::MachineInstr const&)) in archive lib/libLLVMRISCVDesc.a
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
```

Reviewed By: fakepaper56, craig.topper

Differential Revision: https://reviews.llvm.org/D127477
2022-06-11 00:27:53 +08:00
Jay Foad 044b8f4bc8 [AMDGPU] Restore documentation of .amdhsa_shared_vgpr_count
This was accidentally lost in D127402.
2022-06-10 17:06:08 +01:00
Shao-Ce SUN 93116374e7 Revert "[RISCV] move `isFaultFirstLoad` into `RISCVInstrInfo`"
This reverts commit e018e493c1.

There are some problems with this commit,
related revision: https://reviews.llvm.org/D127477
2022-06-11 00:03:04 +08:00
Philip Reames d459530804 [RISCV] Fix accidental deletion of test lines in 2247e4d
Apparently, update_analyze_test_checks.sh does *not* warn on conflicting CHECKs, it just silently drops those lines from the generated test.  That is.. less than helpful.
2022-06-10 09:02:41 -07:00
Paul Robinson 3dbb5cb273 [PS5] Use linker scripting to find profiling data, like PS4 2022-06-10 09:00:51 -07:00
Craig Topper e91051184c [RISCV] Mark FSIN and other math functions as Expand for scalable vectors.
This prevents them from being assumed legal by the cost model.

This matches what is done for AArch64 SVE.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D123799
2022-06-10 08:40:07 -07:00
Philip Reames 2247e4de83 [RISCV] Use common prefixes to reduce duplication in cost model tests 2022-06-10 08:36:14 -07:00
Nikita Popov 9c0a878c71 [DCE] Update tests to use opaque pointers (NFC) 2022-06-10 17:31:35 +02:00
Andrzej Warzynski 494cd9b6fc [flang][lowering] Ignore compiler directives
This patch simply replaces a `TODO` with a warning.

This is part of the upstreaming effort from the `fir-dev` branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D127415
2022-06-10 15:26:49 +00:00
Guillaume Chatelet dc9c2eac98 [NFC][Alignment] Simplify code 2022-06-10 15:25:28 +00:00
Adrian Prantl d36757b511 [LLDB][Docs] Fix formatting of example code-block
Tested by building the docs-lldb-html target and
confirming the code-block renders properly with
the fix.

Patch by Michael Buch!

Differential Revision: https://reviews.llvm.org/D127437
2022-06-10 08:17:08 -07:00
Nikita Popov 04b944e230 [InstSimplify] Convert tests to opaque pointers (NFC)
The only interesting test change is in @PR31262, where the following
fold is now performed, while it previously was not:
https://alive2.llvm.org/ce/z/a5Qmr6

llvm/test/Transforms/InstSimplify/ConstProp/gep.ll has not been
updated, because there is a tradeoff between folding and inrange
preservation there that we may want to discuss.

Updates have been performed using:
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34
2022-06-10 17:16:28 +02:00
Guillaume Chatelet 95083fa3b8 [NFC] Remove deadcode 2022-06-10 15:13:42 +00:00
Philip Reames 2b83467d9e [RISCV] Broaden cost model coverage for fixed vectors w/i1 element type 2022-06-10 08:12:42 -07:00
Simon Pilgrim 91adbc3208 [DAG] SimplifyDemandedVectorElts - adding SimplifyMultipleUseDemandedVectorElts handling to ISD::CONCAT_VECTORS
Attempt to look through multiple use operands of ISD::CONCAT_VECTORS nodes

Another minor improvement for D127115
2022-06-10 16:06:43 +01:00
Nikita Popov addc12fb1f [InstSimplify] Name variables/labels in test (NFC)
Run the test through -instnamer. Also drop irrelevant uwtable
attribute.
2022-06-10 16:56:32 +02:00
Nikita Popov 0a5ec1f034 [InstSimplify] Regenerate test checks (NFC) 2022-06-10 16:54:09 +02:00
Sam Estep cd0d52610d [clang][dataflow] In `optional` model, match call return via hasType
Currently the unchecked-optional-access model fails on this example:

    #include <memory>
    #include <optional>

    void foo() {
      std::unique_ptr<std::optional<float>> x;
      *x = std::nullopt;
    }

You can verify the failure by saving the file as `foo.cpp` and running this command:

    clang-tidy -checks='-*,bugprone-unchecked-optional-access' foo.cpp -- -std=c++17

The failing `assert` is in the `transferAssignment` function of the `UncheckedOptionalAccessModel.cpp` file:

    assert(OptionalLoc != nullptr);

The symptom can be treated by replacing that `assert` with an early `return`:

    if (OptionalLoc == nullptr)
      return;

That would be better anyway since we cannot expect to always cover all possible LHS expressions, but it is out of scope for this patch and left as a followup.

Note that the failure did not occur on this very similar example:

    #include <optional>

    template <typename T>
    struct smart_ptr {
      T& operator*() &;
      T* operator->();
    };

    void foo() {
      smart_ptr<std::optional<float>> x;
      *x = std::nullopt;
    }

The difference is caused by the `isCallReturningOptional` matcher, which was previously checking the `functionDecl` of the `callee`. This patch changes it to instead use `hasType` directly on the call expression, fixing the failure for the `std::unique_ptr` example above.

Reviewed By: sgatev

Differential Revision: https://reviews.llvm.org/D127434
2022-06-10 14:52:05 +00:00
John Ericson d5daa5c5b0 [cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymore
First of all, `LLVM_TOOLS_INSTALL_DIR` put there breaks our NixOS
builds, because `LLVM_TOOLS_INSTALL_DIR` defined the same as
`CMAKE_INSTALL_BINDIR` becomes an *absolute* path, and then when
downstream projects try to install there too this breaks because our
builds always install to fresh directories for isolation's sake.

Second of all, note that `LLVM_TOOLS_INSTALL_DIR` stands out against the
other specially crafted `LLVM_CONFIG_*` variables substituted in
`llvm/cmake/modules/LLVMConfig.cmake.in`.

@beanz added it in d0e1c2a550 to fix a
dangling reference in `AddLLVM`, but I am suspicious of how this
variable doesn't follow the pattern.

Those other ones are carefully made to be build-time vs install-time
variables depending on which `LLVMConfig.cmake` is being generated, are
carefully made relative as appropriate, etc. etc. For my NixOS use-case
they are also fine because they are never used as downstream install
variables, only for reading not writing.

To avoid the problems I face, and restore symmetry, I deleted the
exported and arranged to have many `${project}_TOOLS_INSTALL_DIR`s.
`AddLLVM` now instead expects each project to define its own, and they
do so based on `CMAKE_INSTALL_BINDIR`. `LLVMConfig` still exports
`LLVM_TOOLS_BINARY_DIR` which is the location for the tools defined in
the usual way, matching the other remaining exported variables.

For the `AddLLVM` changes, I tried to copy the existing pattern of
internal vs non-internal or for LLVM vs for downstream function/macro
names, but it would good to confirm I did that correctly.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D117977
2022-06-10 14:35:18 +00:00
Joe Nash fd3304ef85 [AMDGPU] gfx11 EXECZ and VCCZ are no longer allowed to be used as
sources to SALU and VALU instructions.

Contributors:
Baptiste Saleil <baptiste.saleil@amd.com>

Patch 20/N for upstreaming of AMDGPU gfx11 architecture

Depends on D126989

Reviewed By: rampitec, foad, #amdgpu

Differential Revision: https://reviews.llvm.org/D127143
2022-06-10 10:03:43 -04:00
Nuno Lopes 952e069393 [NFC] remove 'br undef' from InstCombine test cases
This is UB and allows the compiler to give any result, so these tests weren't meaningful
InstCombine tests are now clean of 'br undef'
2022-06-10 15:28:57 +01:00
Simon Tatham 9073b53e5d [Clang,ARM] Add release note for D127197.
I should have put that in the original commit, but @lenary only just
reminded me that it needed to be there.
2022-06-10 15:19:33 +01:00
Nikita Popov 51bddfb1a0 [InstCombine] Add additional cost of phi tests (NFC)
These check for undesirable folds for a cast of a loop phi.
2022-06-10 16:14:46 +02:00
Louis Dionne 959a9923de [libc++][NFC] Fix indentation of some #if directives 2022-06-10 10:11:24 -04:00
Jay Foad 4b2d70fa5b [AMDGPU] Basic implementation of isExtractSubvectorCheap
Add a basic implementation of isExtractSubvectorCheap that only
considers extracts at offset 0.

Differential Revision: https://reviews.llvm.org/D127385
2022-06-10 14:43:07 +01:00
Ivan Kosarev eccbe6d122 [TableGen][CodeEmitterGen] Do not crash on insufficient positional instruction operands.
Reviewed By: foad

Differential Revision: https://reviews.llvm.org/D126288
2022-06-10 14:38:54 +01:00
Hans Wennborg 3800b157d7 [SimplifyCFG] Share code to compute switch density between ShouldBuildLookupTable() and ReduceSwitchRange()
They're computing the same thing. No functionality change.

Differential revision: https://reviews.llvm.org/D127482
2022-06-10 15:29:36 +02:00
Guillaume Chatelet 38637ee477 [clang] Add support for __builtin_memset_inline
In the same spirit as D73543 and in reply to https://reviews.llvm.org/D126768#3549920 this patch is adding support for `__builtin_memset_inline`.

The idea is to get support from the compiler to easily write efficient memory function implementations.

This patch could be split in two:
 - one for the LLVM part adding the `llvm.memset.inline.*` intrinsics.
 - and another one for the Clang part providing the instrinsic as a builtin.

Differential Revision: https://reviews.llvm.org/D126903
2022-06-10 13:13:59 +00:00
Nuno Lopes eb8cbb3ad7 [NFC] Add 3 more -inseltpoison.ll test variations 2022-06-10 14:06:32 +01:00
Shao-Ce SUN e018e493c1 [RISCV] move `isFaultFirstLoad` into `RISCVInstrInfo`
Fix build errors in D126794

```
ld.lld: error: undefined symbol: llvm::MachineInstr::getNumExplicitDefs() const
>>> referenced by RISCVBaseInfo.cpp
>>>               RISCVBaseInfo.cpp.o:(llvm::isFaultFirstLoad(llvm::MachineInstr const&)) in archive lib/libLLVMRISCVDesc.a

ld.lld: error: undefined symbol: llvm::MachineInstr::findRegisterDefOperandIdx(llvm::Register, bool, bool, llvm::TargetRegisterInfo const*) const
>>> referenced by RISCVBaseInfo.cpp
>>>               RISCVBaseInfo.cpp.o:(llvm::isFaultFirstLoad(llvm::MachineInstr const&)) in archive lib/libLLVMRISCVDesc.a
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
```

Reviewed By: fakepaper56

Differential Revision: https://reviews.llvm.org/D127477
2022-06-10 21:03:47 +08:00
Nico Weber 8406839d19 Revert "[analyzer] Deprecate `-analyzer-store region` flag"
This reverts commit d50d9946d1.
Broke check-clang, see comments on https://reviews.llvm.org/D126067

Also revert dependent change "[analyzer] Deprecate the unused 'analyzer-opt-analyze-nested-blocks' cc1 flag"
This reverts commit 07b4a6d046.

Also revert "[analyzer] Fix buildbots after introducing a new frontend warning"
This reverts commit 90374df15d.
(See https://reviews.llvm.org/rG90374df15ddc58d823ca42326a76f58e748f20eb)
2022-06-10 08:50:13 -04:00
Balazs Benics 90374df15d [analyzer] Fix buildbots after introducing a new frontend warning
It seems like I should have ran the `check-clang` target after introducing a new warning diagnostic entry.
My bad. I'll run it next time; `check-clang-analysis` was not enough.
Here is a link to the broken bot: http://45.33.8.238/linux/78236/step_7.txt

This commit should fix this.

Differential Revision: https://reviews.llvm.org/D126067
2022-06-10 14:47:23 +02:00
Simon Pilgrim 5acbb2dda2 [X86] combineMulToPMADDWD - don't bitcast the source ops before splitting to ensure we split the build vectors early
Fixes a regression on D127115 - splitting was creating extract_subvector(bitcast(build_vector())) patterns which prevented the build vectors being split before being bitcast to vXi16 types, resulting in various issues with further folding of the (now legal) build vectors
2022-06-10 13:44:49 +01:00
Guillaume Chatelet 12ccdd67aa [NFC] Use proper getSliceAlign type in SROA 2022-06-10 12:37:41 +00:00
Sanjay Patel 6fedc6a2b4 Revert "[InstCombine] add narrowing transform for low-masked binop with zext operand"
This reverts commit afa192cfb6.
This can cause an infinite loop as shown with an example in the
post-commit thread.
2022-06-10 08:25:10 -04:00
Ivan Kosarev 60d6fbb621 [AMDGPU][GFX9][GFX10] Support base+soffset+offset SMEM atomics.
Resolves a part of
https://github.com/llvm/llvm-project/issues/38652

Reviewed By: dp

Differential Revision: https://reviews.llvm.org/D127314
2022-06-10 13:22:41 +01:00
David Sherwood 8daaea206b [InstCombine] Use +0.0 instead of -0.0 as the FP identity for some folds
In foldSelectIntoOp we sometimes transform a select of a fadd into a
fadd of a select, where we select between data and an identity value.
For both fadd and fsub the identity is always -0.0, but if the nsz
flag is set on the select instruction we can use +0.0 instead. Doing
so then triggers other optimisations, such as when folding the select
of masked load into a new masked load.

Differential Revision: https://reviews.llvm.org/D126774
2022-06-10 12:42:34 +01:00
Diana Picus 46f08a4ee0 [flang] Fix RUN line in test from 3e782ba
The current RUN line leaves a parse-ir-error.s file around, which might
confuse the buildbots. Direct the output into the void instead (although
it would probably be better to direct it to FileCheck).
2022-06-10 11:36:52 +00:00
Shivam Gupta 8311604669 [NFC] update clang-tools-extra README.txt 2022-06-10 16:59:57 +05:30
Markus Mützel 99fe38a13a [flang][runtime] Remove dependency on C++ <mutex> on Windows
The implementation of the Lock class on Windows currently uses C++
mutexes. That introduces a dependency on the C++ runtime on that
platform.

Use a Windows CriticalSection instead of a std::mutex to avoid that
dependency.

This works for me with MinGW (tested in a CLANG64 environment of MSYS2).

See also D126291.

Differential Revision: https://reviews.llvm.org/D127316
2022-06-10 11:25:45 +00:00
Balazs Benics 4c38953f32 [clang-tidy] Remove reference to CSA AnalysisStoreOpt field
D126215 removed the `AnalysisStoreOpt` field, so `clang-tidy` should not
refer to it.
http://45.33.8.238/linux/78232/step_4.txt

  ../../clang-tools-extra/clang-tidy/ClangTidy.cpp:444:22: error: no
member named 'AnalysisStoreOpt' in 'clang::AnalyzerOptions'
      AnalyzerOptions->AnalysisStoreOpt = RegionStoreModel;
      ~~~~~~~~~~~~~~~~~^
  ../../clang-tools-extra/clang-tidy/ClangTidy.cpp:444:41: error: use of
undeclared identifier 'RegionStoreModel'
      AnalyzerOptions->AnalysisStoreOpt = RegionStoreModel;

This one liner patch should resolve the build failure.

Differential Revision: https://reviews.llvm.org/D126215
2022-06-10 13:21:28 +02:00
Balazs Benics 07b4a6d046 [analyzer] Deprecate the unused 'analyzer-opt-analyze-nested-blocks' cc1 flag
This flag was introduced by
6818991d71
    commit 6818991d71
    Author: Ted Kremenek <kremenek@apple.com>
    Date:   Mon Dec 7 22:06:12 2009 +0000

  Add clang-cc option '-analyzer-opt-analyze-nested-blocks' to treat
  block literals as an entry point for analyzer checks.

The last reference was removed by this commit:
5c32dfc5fb

    commit 5c32dfc5fb
    Author: Anna Zaks <ganna@apple.com>
    Date:   Fri Dec 21 01:19:15 2012 +0000

  [analyzer] Add blocks and ObjC messages to the call graph.
  This paves the road for constructing a better function dependency graph.
  If we analyze a function before the functions it calls and inlines,
  there is more opportunity for optimization.
  Note, we add call edges to the called methods that correspond to
  function definitions (declarations with bodies).

Consequently, we should remove this dead flag.
However, this arises a couple of burning questions.
 - Should the `cc1` frontend still accept this flag - to keep
   tools/users passing this flag directly to `cc1` (which is unsupported,
   unadvertised) working.
 - If we should remain backward compatible, how long?
 - How can we get rid of deprecated and obsolete flags at some point?

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D126067
2022-06-10 13:09:37 +02:00