platform/upstream/llvm.git
2 years agoRevert "[DebugInfo] Enforce implicit constraints on `distinct` MDNodes"
Arthur Eubanks [Tue, 9 Nov 2021 22:23:04 +0000 (14:23 -0800)]
Revert "[DebugInfo] Enforce implicit constraints on `distinct` MDNodes"

This reverts commit ee7652569854af567ba83e5255d70e80cc8619a1.

Causes crashes, see comments in D104827.

2 years agoFix test after aee49255074fd4ef38d97e6e70cbfbf2f9fd0fa7.
James Y Knight [Tue, 9 Nov 2021 16:18:36 +0000 (11:18 -0500)]
Fix test after aee49255074fd4ef38d97e6e70cbfbf2f9fd0fa7.

(Apparently no buildbots enable both examples and plugins!)

2 years ago[clang] Run LLVM Verifier in modes without CodeGen too
Itay Bookstein [Sat, 6 Nov 2021 22:06:28 +0000 (00:06 +0200)]
[clang] Run LLVM Verifier in modes without CodeGen too

Previously, the Backend_Emit{Nothing,BC,LL} modes did
not run the LLVM verifier since it is usually added via
the TargetMachine::addPassesToEmitFile method according
to the DisableVerify parameter. This is called from
EmitAssemblyHelper::AddEmitPasses, which is only relevant
for BackendAction-s that require CodeGen.

Note:
* In these particular situations the verifier is added
  to the optimization pipeline rather than the codegen
  pipeline so that it runs prior to the BC/LL emission
  pass.
* This change applies to both the old and the new PMs.
* Because the clang tests use -emit-llvm ubiquitously,
  this change will enable the verifier for them.
* A small bug is fixed in emitIFuncDefinition so that
  the clang/test/CodeGen/ifunc.c test would pass:
  the emitIFuncDefinition incorrectly passed the
  GlobalDecl of the IFunc itself to the call to
  GetOrCreateLLVMFunction for creating the resolver.

Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: rjmccall

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

2 years ago[CodeGen] Diagnose and reject non-function ifunc resolvers
Itay Bookstein [Sat, 30 Oct 2021 11:27:38 +0000 (14:27 +0300)]
[CodeGen] Diagnose and reject non-function ifunc resolvers

Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: MaskRay, erichkeane

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

2 years ago[clang][test][NFC] Move attr-ifunc.c test from Sema to CodeGen
Itay Bookstein [Tue, 9 Nov 2021 20:01:56 +0000 (22:01 +0200)]
[clang][test][NFC] Move attr-ifunc.c test from Sema to CodeGen

Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: erichkeane

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

2 years ago[clang][test][NFC] clang-format attr-ifunc.c test
Itay Bookstein [Tue, 9 Nov 2021 20:01:14 +0000 (22:01 +0200)]
[clang][test][NFC] clang-format attr-ifunc.c test

Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: erichkeane

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

2 years agoRevert "Misleading unicode identifier detection pass"
serge-sans-paille [Tue, 9 Nov 2021 21:38:56 +0000 (22:38 +0100)]
Revert "Misleading unicode identifier detection pass"

This reverts commit 7f92a1a84b96ff0b7568a35704c9483e9f24f057.

It triggers an assert, see http://45.33.8.238/linux/60293/step_9.txt

"AST/Decl.h:277: llvm::StringRef clang::NamedDecl::getName() const: Assertion `Name.isIdentifier() && "Name is not a simple identifier"' failed."

2 years ago[CodeGen][Outliner] Clean up dead code
Alexander Shaposhnikov [Tue, 9 Nov 2021 21:27:16 +0000 (21:27 +0000)]
[CodeGen][Outliner] Clean up dead code

Clean up dead code in X86InstrInfo.cpp and AArch64InstrInfo.cpp

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D111151

2 years agoComment AST: Add support for variable templates
Aaron Puchert [Tue, 9 Nov 2021 21:24:44 +0000 (22:24 +0100)]
Comment AST: Add support for variable templates

We treat them as variables of course, though if they have function
pointer type we treat them as functions, i.e. allow parameter and return
value specifications. Just like VarDecls.

Reviewed By: gribozavr2

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

2 years agoComment AST: Declare function pointer variables as functions
Aaron Puchert [Tue, 9 Nov 2021 20:51:38 +0000 (21:51 +0100)]
Comment AST: Declare function pointer variables as functions

We were doing this already for type aliases, and it deduplicates the
code looking through aliases and pointers to find a function type. As
a side effect, this finds two warnings that we apparently missed before.

Reviewed By: gribozavr2

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

2 years agoComment AST: Factor out function type extraction in DeclInfo::fill (NFC)
Aaron Puchert [Tue, 9 Nov 2021 20:46:56 +0000 (21:46 +0100)]
Comment AST: Factor out function type extraction in DeclInfo::fill (NFC)

Reviewed By: gribozavr2

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

2 years agoDebugInfoDWARF: Refactor/simplify a couple of minor things
David Blaikie [Tue, 9 Nov 2021 20:51:05 +0000 (12:51 -0800)]
DebugInfoDWARF: Refactor/simplify a couple of minor things

2 years ago[clang] Don't crash on an incomplete-type base specifier in template context.
Haojian Wu [Tue, 9 Nov 2021 10:10:11 +0000 (11:10 +0100)]
[clang] Don't crash on an incomplete-type base specifier in template context.

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

2 years ago[InstCombine] Add tests for and/or of range checks (NFC)
Nikita Popov [Tue, 9 Nov 2021 20:59:40 +0000 (21:59 +0100)]
[InstCombine] Add tests for and/or of range checks (NFC)

2 years ago[libcxx][CI][AIX] Switch to LLVM_ENABLE_RUNTIMES
David Tenty [Tue, 9 Nov 2021 17:44:44 +0000 (12:44 -0500)]
[libcxx][CI][AIX] Switch to LLVM_ENABLE_RUNTIMES

and to the new `runtimes` top level CMakeLists.txt since the old path is now deprecated. This requires a slight adjustment of the libcxxabi CMake, since there are required macro definitions we previously got via the `llvm/CMakeList.txt` path.

Reviewed By: ldionne, #libc, #libc_abi

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

2 years ago[clang-format] Refactor SpaceBeforeParens to add options
C. Rayroud [Sun, 7 Nov 2021 19:56:35 +0000 (20:56 +0100)]
[clang-format] Refactor SpaceBeforeParens to add options

The coding style of some projects requires to have more control on space
before opening parentheses.
The goal is to add the support of clang-format to more projects.
For example adding a space only for function definitions or
declarations.
This revision adds SpaceBeforeParensOptions to configure each option
independently from one another.

Differentiel Revision: https://reviews.llvm.org/D110833

2 years ago[clang-format] Address fixme
Björn Schäpers [Fri, 5 Nov 2021 21:20:52 +0000 (22:20 +0100)]
[clang-format] Address fixme

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

2 years agoMisleading unicode identifier detection pass
serge-sans-paille [Fri, 15 Oct 2021 13:18:52 +0000 (15:18 +0200)]
Misleading unicode identifier detection pass

Detect when an identifier contains some Right-To-Left characters.
This pass relates to https://trojansource.codes/

This is a recommit of 299aa4dfa1d8c120648b1404b481d858b76c8173 with missing
option registration fixed.

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

2 years ago[DebugInfo] Fix broken MachO test
Ellis Hoag [Tue, 9 Nov 2021 20:45:54 +0000 (12:45 -0800)]
[DebugInfo] Fix broken MachO test

This test was introduced in https://reviews.llvm.org/D112337 and breaks on mac.

Reviewed By: dblaikie

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

2 years ago[Tools] Add a fuzzing tool to help fuzzing D demangler
Luís Ferreira [Tue, 9 Nov 2021 20:40:45 +0000 (12:40 -0800)]
[Tools] Add a fuzzing tool to help fuzzing D demangler

This patch adds a fuzzing helper tool for D demangler by feeding the demangler API with
pseudo-random null terminated strings with the help of libfuzzer heuristics.

Reviewed By: dblaikie

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

2 years ago[RegAllocFast] Fix nondeterminism in debuginfo generation
Ilya Yanok [Tue, 9 Nov 2021 20:35:43 +0000 (21:35 +0100)]
[RegAllocFast] Fix nondeterminism in debuginfo generation

Changes from commit 1db137b1859692ae33228c530d4df9f2431b2151
added iteration over hash map that can result in non-deterministic
order. Fix that by using a SmallMapVector to preserve the order.

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

2 years ago[compiler-rt] Fix diagnostic in InstrProfError
Gulfem Savrun Yeniceri [Tue, 9 Nov 2021 20:21:49 +0000 (20:21 +0000)]
[compiler-rt] Fix diagnostic in InstrProfError

This patch fixes some issues introduced in
https://reviews.llvm.org/D108942:

1) Remove the default label to fix the bots that use
-Werror,-Wcovered-switch-default
2) Modify the malformed test to fix the bots that are
built without zlib support
3) Modify some error messages in malformed profiles

2 years ago[AArch64] Extend and regenerate fcvt_combine.ll. NFC
David Green [Tue, 9 Nov 2021 20:29:42 +0000 (20:29 +0000)]
[AArch64] Extend and regenerate fcvt_combine.ll. NFC

This adds half and fptoi.sat variants of the tests in fcvt_combine.ll,
and regenerates the resulting check lines.

2 years agoAMDGPU: Regenerate test checks
Matt Arsenault [Thu, 4 Nov 2021 23:31:56 +0000 (19:31 -0400)]
AMDGPU: Regenerate test checks

Update these to include -NEXT to avoid spurious changes in a future
commit.

2 years ago[flang][CodeGen] Transform `fir.{store|load}` to `llvm.{store|load}`
Andrzej Warzynski [Wed, 3 Nov 2021 07:57:13 +0000 (07:57 +0000)]
[flang][CodeGen] Transform `fir.{store|load}` to `llvm.{store|load}`

This patch extends the `FIRToLLVMLowering` pass in Flang by adding a
hook to transform `fir.store`/`fir.load` to `llvm.store`/`fir.load`,
respectively.

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

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

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

Patch originally written by:
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[InstCombine] Combine code for and/or of icmps (NFC)
Nikita Popov [Tue, 9 Nov 2021 20:17:09 +0000 (21:17 +0100)]
[InstCombine] Combine code for and/or of icmps (NFC)

The implementation for and/or is the same, apart from the choice
of exactIntersectWith() vs exactUnionWith(). Extract a common
function to make future extension easier.

2 years ago[gn build] Port 737c4a2673da
LLVM GN Syncbot [Tue, 9 Nov 2021 20:11:28 +0000 (20:11 +0000)]
[gn build] Port 737c4a2673da

2 years ago[clang][openmp][NFC] Remove arch-specific CGOpenMPRuntimeGPU files
Atmn Patel [Tue, 9 Nov 2021 04:16:54 +0000 (23:16 -0500)]
[clang][openmp][NFC] Remove arch-specific CGOpenMPRuntimeGPU files

The existing CGOpenMPRuntimeAMDGCN and CGOpenMPRuntimeNVPTX classes are
just code bloat. By removing them, the codebase gets a bit cleaner.

Reviewed By: jdoerfert, JonChesterfield, tianshilei1992

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

2 years ago[mlir][ods] Cleanup of handling Op vs OpAdaptor
Mogball [Tue, 9 Nov 2021 18:59:06 +0000 (18:59 +0000)]
[mlir][ods] Cleanup of handling Op vs OpAdaptor

In preparation for implementation subrange lookup on attributes.

Depends on D113039

Reviewed By: jpienaar, Chia-hungDuan

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

2 years ago[InstCombine] Refactor and/or of icmp with constant (NFCI)
Nikita Popov [Sat, 6 Nov 2021 21:15:26 +0000 (22:15 +0100)]
[InstCombine] Refactor and/or of icmp with constant (NFCI)

Rather than testing for many specific combinations of predicates
and values, compute the exact icmp regions for both comparisons
and check whether they union/intersect exactly. If they do,
construct the equivalent icmp for the new range. Assuming that the
existing code handled all possible cases, this should be NFC.

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

2 years agoBPF: change btf_type_tag BTF output format
Yonghong Song [Mon, 8 Nov 2021 04:36:52 +0000 (20:36 -0800)]
BPF: change btf_type_tag BTF output format

For the declaration like below:
  int __tag1 * __tag1 __tag2 *g
Commit 41860e602aaa ("BPF: Support btf_type_tag attribute")
implemented the following encoding:
  VAR(g) -> __tag1 --> __tag2 -> pointer -> __tag1 -> pointer -> int

Some further experiments with linux btf_type_tag support, esp.
with generating attributes in vmlinux.h, and also some internal
discussion showed the following format is more desirable:
  VAR(g) -> pointer -> __tag2 -> __tag1 -> pointer -> __tag1 -> int

The format makes it similar to other modifier like 'const', e.g.,
  const int *g
which has encoding VAR(g) -> PTR -> CONST -> int

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

2 years ago[InstCombine] Fuse checks for LHS (~(A | B) & C) | ... NFC.
Stanislav Mekhanoshin [Wed, 3 Nov 2021 18:10:26 +0000 (11:10 -0700)]
[InstCombine] Fuse checks for LHS (~(A | B) & C) | ... NFC.

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

2 years agoRevert "[clang-tidy] Fix lint warning in ClangTidyDiagnosticConsumer.cpp (NFC)"
Jorge Gorbe Moya [Tue, 9 Nov 2021 19:24:05 +0000 (11:24 -0800)]
Revert "[clang-tidy] Fix lint warning in ClangTidyDiagnosticConsumer.cpp (NFC)"

The change causes multiple clang-tidy tests to fail under ASan.

This reverts commit 00769572025f9b0d36dc832d3c1bc61500091ed5.

2 years ago[InstCombine] fix code comment to match code; NFC
Sanjay Patel [Tue, 9 Nov 2021 18:26:04 +0000 (13:26 -0500)]
[InstCombine] fix code comment to match code; NFC

2 years ago[libc++] Adds missing forward_list merge tests.
Mark de Wever [Sat, 6 Nov 2021 19:30:08 +0000 (20:30 +0100)]
[libc++] Adds missing forward_list merge tests.

During the review of D112660 it turned out the tests for
`std::forward_list::merge` are incomplete.

Adds tests for the rvalue reference overloads. The tests are extended to
better test the Effects [forward.list.ops]/25 and Remarks
[forward.list.ops]/27 of the function:
- x is empty after the merge.
- Pointers and references to the moved elements of x now refer to those
  same elements but as members of *this.
- Iterators referring to the moved elements will continue to refer to
  their elements, but they now behave as iterators into *this, not into x.
- The algorithm is stable.

Reviewed By: Quuxplusone, #libc, ldionne

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

2 years ago[Sema] Mark virtual method declaration in union as invalid
Yuanfang Chen [Tue, 9 Nov 2021 18:33:33 +0000 (10:33 -0800)]
[Sema] Mark virtual method declaration in union as invalid

Currently, this is only diagnosed but the decl is not marked invalid. This may hit assertions down the path.

This also reverts the fix for PR49534 since it is not needed anymore.

Reviewed By: hubert.reinterpretcast

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

2 years ago[DebugInfo] Only create concrete DIEs of concrete functions
Ellis Hoag [Tue, 9 Nov 2021 18:52:10 +0000 (10:52 -0800)]
[DebugInfo] Only create concrete DIEs of concrete functions

At the begining of the module we can iterate through the functions to
see which SPs should have concrete DIEs. Then when we need to reference
a DIE for a SP we can decide if it's ok to create a concrete DIE or not.

Fixes
 * https://bugs.llvm.org/show_bug.cgi?id=52159
 * https://bugs.llvm.org/show_bug.cgi?id=30637

Reviewed By: dblaikie

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

2 years ago[lldb] XFAIL TestPlatformKill on windows
Pavel Labath [Tue, 9 Nov 2021 18:39:17 +0000 (19:39 +0100)]
[lldb] XFAIL TestPlatformKill on windows

-> PR52451

2 years agoUse yaml2obj instead of relying on invoking the Darwin system assembler.
Adrian Prantl [Tue, 9 Nov 2021 18:46:09 +0000 (10:46 -0800)]
Use yaml2obj instead of relying on invoking the Darwin system assembler.

2 years ago[llvm-reduce] Fix invalid reduction in basic-blocks delta pass
Dwight Guth [Tue, 9 Nov 2021 18:42:52 +0000 (10:42 -0800)]
[llvm-reduce] Fix invalid reduction in basic-blocks delta pass

Previously, if the basic-blocks delta pass tried to remove a basic block
that was the last basic block in a function that did not have external
or weak linkage, the resulting IR would become invalid. Since removing
the last basic block in a function is effectively identical to removing
the function body itself, we check explicitly for this case and if we
detect it, we run the same logic as in ReduceFunctionBodies.cpp

Reviewed By: aeubanks

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

2 years ago[gn build] Port 533862933398
LLVM GN Syncbot [Tue, 9 Nov 2021 18:38:40 +0000 (18:38 +0000)]
[gn build] Port 533862933398

2 years ago[NFC] Rename GVN -> GVNPass and SROA -> SROAPass
Arthur Eubanks [Mon, 1 Nov 2021 15:56:48 +0000 (08:56 -0700)]
[NFC] Rename GVN -> GVNPass and SROA -> SROAPass

To be more consistent with other pass struct names.

There are still more passes that don't end with "Pass", but these are the important ones.

Reviewed By: asbirlea

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

2 years ago[ProfileData] Fix a warning
Kazu Hirata [Tue, 9 Nov 2021 18:34:00 +0000 (10:34 -0800)]
[ProfileData] Fix a warning

This patch fixes:

  llvm/lib/ProfileData/InstrProf.cpp:146:3: error: default label in
  switch which covers all enumeration values
  [-Werror,-Wcovered-switch-default]

2 years agoRevert "Reapply db28934 "[IndVars] Pass TTI to replaceCongruentIVs""
Douglas Yung [Tue, 9 Nov 2021 18:28:41 +0000 (10:28 -0800)]
Revert "Reapply db28934 "[IndVars] Pass TTI to replaceCongruentIVs""

This reverts commit 5ec23863320ca12bfabb6dcff1d0425cb614b7a5.

This change is causing test failures on the PS4 linux build bot: https://lab.llvm.org/buildbot/#/builders/139/builds/12871

2 years agoRevert rG299aa4dfa1d8c120648b1404b481d858b76c8173 "Misleading unicode identifier...
Simon Pilgrim [Tue, 9 Nov 2021 18:25:07 +0000 (18:25 +0000)]
Revert rG299aa4dfa1d8c120648b1404b481d858b76c8173 "Misleading unicode identifier detection pass"

This is failing on various buildbots: https://lab.llvm.org/buildbot/#/builders/109/builds/25932

2 years ago[gn build] Port 299aa4dfa1d8
Arthur Eubanks [Tue, 9 Nov 2021 18:20:43 +0000 (10:20 -0800)]
[gn build] Port 299aa4dfa1d8

2 years ago[gn build] Port 22a1aa5a43cb
Arthur Eubanks [Tue, 9 Nov 2021 18:20:42 +0000 (10:20 -0800)]
[gn build] Port 22a1aa5a43cb

2 years ago[DebugInfo] Enforce implicit constraints on `distinct` MDNodes
Scott Linder [Thu, 4 Nov 2021 16:52:32 +0000 (16:52 +0000)]
[DebugInfo] Enforce implicit constraints on `distinct` MDNodes

Add UNIQUED and DISTINCT properties in Metadata.def and use them to
implement restrictions on the `distinct` property of MDNodes:

* DIExpression can currently be parsed from IR or read from bitcode
  as `distinct`, but this property is silently dropped when printing
  to IR. This causes accepted IR to fail to round-trip. As DIExpression
  appears inline at each use in the canonical form of IR, it cannot
  actually be `distinct` anyway, as there is no syntax to describe it.
* Similarly, DIArgList is conceptually always uniqued. It is currently
  restricted to only appearing in contexts where there is no syntax for
  `distinct`, but for consistency it is treated equivalently to
  DIExpression in this patch.
* DICompileUnit is already restricted to always being `distinct`, but
  along with adding general support for the inverse restriction I went
  ahead and described this in Metadata.def and updated the parser to be
  general. Future nodes which have this restriction can share this
  support.

The new UNIQUED property applies to DIExpression and DIArgList, and
forbids them to be `distinct`. It also implies they are canonically
printed inline at each use, rather than via MDNode ID.

The new DISTINCT property applies to DICompileUnit, and requires it to
be `distinct`.

A potential alternative change is to forbid the non-inline syntax for
DIExpression entirely, as is done with DIArgList implicitly by requiring
it appear in the context of a function. For example, we would forbid:

    !named = !{!0}
    !0 = !DIExpression()

Instead we would only accept the equivalent inlined version:

    !named = !{!DIExpression()}

This essentially removes the ability to create a `distinct` DIExpression
by construction, as there is no syntax for `distinct` inline. If this
patch is accepted as-is, the result would be that the non-canonical
version is accepted, but the following would be an error and produce a diagnostic:

    !named = !{!0}
    ; error: 'distinct' not allowed for !DIExpression()
    !0 = distinct !DIExpression()

Also update some documentation to consistently use the inline syntax for
DIExpression, and to describe the restrictions on `distinct` for nodes
where applicable.

Reviewed By: StephenTozer, t-tye

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

2 years ago[libc++] Simplify selftest to avoid passing arguments to it
Louis Dionne [Wed, 4 Nov 2020 13:56:04 +0000 (08:56 -0500)]
[libc++] Simplify selftest to avoid passing arguments to it

This makes the test pass on executors that don't support passing additional
arguments.

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

2 years ago[CodeView] Properly handle a DISubprogram in getScopeIndex.
Chih-Ping Chen [Wed, 3 Nov 2021 20:44:00 +0000 (16:44 -0400)]
[CodeView] Properly handle a DISubprogram in getScopeIndex.

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

2 years ago[libc++] Enable -Wformat-nonliteral when building libc++
Louis Dionne [Fri, 29 Oct 2021 16:36:57 +0000 (12:36 -0400)]
[libc++] Enable -Wformat-nonliteral when building libc++

Using user-provided data as a format string is a well known source of
security vulnerabilities. For this reason, it is a good idea to compile
our code with -Wformat-nonliteral, which basically warns if a non-constant
string is used as a format specifier. This is the compiler’s best signal
that a format string call may be insecure.

I audited the code after adding the warning and made sure that the few
places where we used a non-literal string as a format string were not
potential security issues. I either disabled the warning locally for
those instances or fixed the warning by using a literal. The idea is
that after we add the warning to the build, any new use of a non-literal
string in a format string will trigger a diagnostic, and we can either
get rid of it or disable the warning locally, which is a way of
acknowledging that it has been audited.

I also looked into enabling it in the test suite, which would perhaps
allow finding additional instances of it in our headers, however that
is not possible at the moment because Clang doesn't support putting
__attribute__((__format__(...))) on variadic templates, which would
be needed.

rdar://84571685

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

2 years agoAdd a requires line to test.
Adrian Prantl [Tue, 9 Nov 2021 18:15:54 +0000 (10:15 -0800)]
Add a requires line to test.

2 years ago[llvm-reduce] Add flag to start at finer granularity
Dwight Guth [Tue, 9 Nov 2021 18:13:33 +0000 (10:13 -0800)]
[llvm-reduce] Add flag to start at finer granularity

Sometimes if llvm-reduce is interrupted in the middle of a delta pass on
a large file, it can take quite some time for the tool to start actually
doing new work if it is restarted again on the partially-reduced file. A
lot of time ends up being spent testing large chunks when these large
chunks are very unlikely to actually pass the interestingness test. In
cases like this, the tool will complete faster if the starting
granularity is reduced to a finer amount. Thus, we introduce a command
line flag that automatically divides the chunks into smaller subsets a
fixed, user-specified number of times prior to beginning the core loop.

Reviewed By: aeubanks

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

2 years agoRevert "[mlir] Add nano precision clock to execution engine"
Mehdi Amini [Tue, 9 Nov 2021 18:11:59 +0000 (18:11 +0000)]
Revert "[mlir] Add nano precision clock to execution engine"

This reverts commit 48d1f099d492b0d796743d1528f09947e4d2d864.

Broke the MLIR buildbots

2 years ago[libc] refactor atof string parsing
Michael Jones [Mon, 1 Nov 2021 17:32:19 +0000 (10:32 -0700)]
[libc] refactor atof string parsing

Split the code for parsing hexadecimal floating point numbers from the
code for parsing the decimal floating point numbers so that the parsing
can be faster for both of them.

This decreases the time for the benchmark in release mode by about 15%,
which noticeably beats GLibc.

Old version: 2.299s
New version: 1.893s
GLibc: 2.133s

Tests run by running the following command 10 times for each version:
time ~/llvm-project/build/bin/libc_str_to_float_comparison_test ~/parse-number-fxx-test-data/data/*

the parse-number-fxx-test-data-repository is here:
https://github.com/nigeltao/parse-number-fxx-test-data/tree/fe94de252c691900982050c8e7c503d1efd1299a

It's important to build llvm-libc in Release mode for accurate
performance comparisons against glibc (set -DCMAKE_BUILD_TYPE=Release in
your cmake).
You also have to build the libc_str_to_float_comparison_test target.

Reviewed By: lntue

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

2 years ago[llvm-objdump] -p: Dump PE header for PE/COFF
Fangrui Song [Tue, 9 Nov 2021 18:08:41 +0000 (10:08 -0800)]
[llvm-objdump] -p: Dump PE header for PE/COFF

For a trivial DLL built with `clang --target=x86_64-windows -O2 -c a.c; lld-link -subsystem:console -dll a.o -out:a.dll`,
`objdump -p` vs `llvm-objdump -p`:

```
-a.dll:     file format pei-x86-64
-
+a.dll: file format coff-x86-64
 Characteristics 0x2022
        executable
        large address aware
@@ -57,4 +56,4 @@
 Entry d 0000000000000000 00000000 Delay Import Directory
 Entry e 0000000000000000 00000000 CLR Runtime Header
 Entry f 0000000000000000 00000000 Reserved
-
+Export Table:
```

For a Linux image (`vmlinuz-5.10.76-gentoo-r1`) built with `CONFIG_EFI_STUB=y`

```
-vmlinuz-5.10.76-gentoo-r1:     file format pei-x86-64
-
-Characteristics 0x20e
+vmlinuz-5.10.76-gentoo-r1:     file format coff-x86-64
+Characteristics 0x206
        executable
        line numbers stripped
-       symbols stripped
        debugging information removed

 Time/Date              Wed Dec 31 16:00:00 1969
@@ -55,10 +53,4 @@
 Entry d 0000000000000000 00000000 Delay Import Directory
 Entry e 0000000000000000 00000000 CLR Runtime Header
 Entry f 0000000000000000 00000000 Reserved
-
-
-PE File Base Relocations (interpreted .reloc section contents)
-
-Virtual Address: 000037ca Chunk size 10 (0xa) Number of fixups 1
-       reloc    0 offset    0 [37ca] ABSOLUTE
-
+Export Table:
```

`symbols stripped` looks like a GNU objdump problem.

Reviewed By: jhenderson, alexander-shaposhnikov

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

2 years ago[compiler-rt] Add more diagnostic to InstrProfError
Gulfem Savrun Yeniceri [Mon, 30 Aug 2021 19:12:16 +0000 (19:12 +0000)]
[compiler-rt] Add more diagnostic to InstrProfError

If profile data is malformed for any kind of reason, we generate
an error that only reports "malformed instrumentation profile data"
without any further information. This patch extends InstrProfError
class to receive an optional error message argument, so that we can
do better error reporting.

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

2 years ago[libc++] Fix lifetime issues of temporaries.
Mark de Wever [Wed, 3 Nov 2021 19:50:59 +0000 (20:50 +0100)]
[libc++] Fix lifetime issues of temporaries.

The ASAN build failed due to using pointers to a temporary whose
lifetime had expired.

Updating the libc++ Docker image to Ubuntu Focal caused some breakage.
This was temporary disabled in D112737. This re-enables two of these
tests.

Reviewed By: ldionne, #libc

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

2 years ago[libc++] Mark a failing test.
Mark de Wever [Wed, 3 Nov 2021 20:09:59 +0000 (21:09 +0100)]
[libc++] Mark a failing test.

The tests fails in debug mode since it manipulates an iterator to a
`std::string` returned from the dylib. This is a known issue for the
debug iterators.

Updating the libc++ Docker image to Ubuntu Focal caused some breakage.
This was temporary disabled in D112737. This re-enables one of these
tests.

Reviewed By: ldionne, #libc, Quuxplusone

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

2 years ago[libc++][cmake] Improves benchmark build.
Mark de Wever [Mon, 8 Nov 2021 17:58:18 +0000 (18:58 +0100)]
[libc++][cmake] Improves benchmark build.

The CMake dependencies don't properly list the libc++ headers. When a
libc++ header is modified the affected benchmarks aren't rebuild. This
makes testing benchmarks tricky and may cause accidentally not using the
latest modifications during testing. This change causes CMake to
determine the proper dependencies.

This shouldn't affect the CI build.

Reviewed By: #libc, ldionne

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

2 years ago[ARM] Fix unused variable warning in Release builds
Benjamin Kramer [Tue, 9 Nov 2021 17:55:52 +0000 (18:55 +0100)]
[ARM] Fix unused variable warning in Release builds

2 years ago[ELF] Improve sh_info=0 and sh_info>=num_sections diagnostic for SHT_REL/SHT_RELA
Fangrui Song [Tue, 9 Nov 2021 17:54:12 +0000 (09:54 -0800)]
[ELF] Improve sh_info=0 and sh_info>=num_sections diagnostic for SHT_REL/SHT_RELA

PR52408 reported an sh_info=0 instance. I have seen sh_info=0
independently before.

sh_info>=num_sections is probably very rare. Just use one diagnostic for
the two types of errors.

Delete invalid-relocations.test which is covered by invalid/bad-reloc-target.test

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

2 years ago[flang] Fix error in characteristics check at procedure pointer assignment
Emil Kieri [Tue, 9 Nov 2021 15:10:42 +0000 (16:10 +0100)]
[flang] Fix error in characteristics check at procedure pointer assignment

If the procedure pointer has an explicit interface, its characteristics must
equal the characteristics of its target, except that the target may be pure or
elemental also when the pointer is not (cf. F2018 10.2.2.4(3)). In the semantics
check for assignment of procedure pointers, the attributes of the procedures
were not checked correctly due to a typo. This caused some illegal
pointer-target-combinations to pass without raising an error. Fix this, and
expand the test case to improve the coverage of procedure pointer assignment
checks.

Reviewed By: PeteSteinfeld

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

2 years ago[InstCombine] fold sub-of-umax to 0-usubsat
Sanjay Patel [Tue, 9 Nov 2021 17:31:15 +0000 (12:31 -0500)]
[InstCombine] fold sub-of-umax to 0-usubsat

Op0 - umax(X, Op0) --> 0 - usub.sat(X, Op1)

I'm not sure if this is really an improvement in IR because
we probably have better recognition/analysis for min/max,
but this lines up with the fold we do for the icmp+select
idiom and removes another diff from D98152.

This is similar to the previous fold in the code that was
added with:
83c2fb9f66be
baa6a851308d

https://alive2.llvm.org/ce/z/5MrVB9

2 years ago[InstCombine] fix typo in test; NFC
Sanjay Patel [Tue, 9 Nov 2021 16:24:35 +0000 (11:24 -0500)]
[InstCombine] fix typo in test; NFC

This was intended to commute the previous test, but failed to swap the values.

2 years agoSupport looking up absolute symbols
Adrian Prantl [Tue, 9 Nov 2021 01:01:21 +0000 (17:01 -0800)]
Support looking up absolute symbols

The Swift stdlib uses absolute symbols in the dylib to communicate
feature flags to the process. LLDB's expression evaluator needs to be
able to find them. This wires up absolute symbols so they show up in
the symtab lookup command, which is also all that's needed for them to
be visible to the expression evaluator JIT.

rdar://85093828

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

2 years agoComment parsing: Complete list of Doxygen commands
Aaron Puchert [Tue, 9 Nov 2021 14:05:30 +0000 (15:05 +0100)]
Comment parsing: Complete list of Doxygen commands

These should be all the commands from [1] except those that are marked
obsolete, and "link" / "endlink", as that conflicts with the existing
HeaderDoc pair "link / "/link". For some commands we don't have the
ideal category, but it should work good enough for most cases.

There seems to be no existing test for most commands (except the ones
interpreted by -Wdocumentation), and to some extent such a test wouldn't
look very interesting. But I added a test for the correct parsing of
formulas, as they're a bit special. And I had to adapt
comment-lots-of-unknown-commands.c because typo correction was kicking
in and recognizing some of the commands.

This should fix a couple of reported bugs: PR17437, PR19581, PR24062
(partially, no diagnostic for matching cond/endcond), PR32909, PR37813,
PR44243 (partially, email@domain.com must be addressed separately).

[1] https://www.doxygen.nl/manual/commands.html

Reviewed By: gribozavr2

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

2 years ago[libc++] P0433R2: test that deduction guides are properly SFINAEd away.
Konstantin Varlamov [Tue, 9 Nov 2021 17:21:02 +0000 (09:21 -0800)]
[libc++] P0433R2: test that deduction guides are properly SFINAEd away.

Deduction guides for containers should not participate in overload
resolution when called with certain incorrect types (e.g. when called
with a template argument in place of an `InputIterator` that doesn't
qualify as an input iterator). Similarly, class template argument
deduction should not select `unique_ptr` constructors that take a
a pointer.

The tests try out every possible incorrect parameter (but never more
than one incorrect parameter in the same invocation).

Also add deduction guides to the synopsis for associative and unordered
containers (this was accidentally omitted from [D112510](https://reviews.llvm.org/D112510)).

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

2 years ago[mlir] Flip math dialect to _Both prefixed form (NFC)
Jacques Pienaar [Tue, 9 Nov 2021 17:30:37 +0000 (09:30 -0800)]
[mlir] Flip math dialect to _Both prefixed form (NFC)

See https://llvm.discourse.group/t/psa-ods-generated-accessors-will-change-to-have-a-get-prefix-update-you-apis/4476

2 years ago[ARM] reject -mtp=cp15 if target subarch does not support it
Ard Biesheuvel [Tue, 9 Nov 2021 17:26:29 +0000 (18:26 +0100)]
[ARM] reject -mtp=cp15 if target subarch does not support it

Currently, we permit -mtp=cp15 even for targets that don't implement the
TLS register. When building for ARMv6 or earlier, this means we emit
instructions that will UNDEF at runtime. For Thumb1, passing -mtp=cp15
will trigger an assert in the backend.

So let's add some diagnostics to ensure that -mtp=cp15 is only accepted
for ARMv6T2 or newer.

Reviewed By: nickdesaulniers

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

2 years ago[Demangle] Add minimal support for D programming language
Luís Ferreira [Tue, 9 Nov 2021 17:04:46 +0000 (09:04 -0800)]
[Demangle] Add minimal support for D programming language

This patch adds minimal support for D programming language demangling on LLVM
core based on the D name mangling spec. This will allow easier integration on a
future LLDB plugin for D either in the upstream tree or outside of it.

Minimal support includes recognizing D demangling encoding and at least one
mangling name, which in this case is `_Dmain` mangle.

Reviewed By: jhenderson, lattner

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

2 years ago[ARM] implement support for TLS register based stack protector
Ard Biesheuvel [Tue, 9 Nov 2021 09:18:09 +0000 (10:18 +0100)]
[ARM] implement support for TLS register based stack protector

Implement support for loading the stack canary from a memory location held in
the TLS register, with an optional offset applied. This is used by the Linux
kernel to implement per-task stack canaries, which is impossible on SMP systems
when using a global variable for the stack canary.

Reviewed By: nickdesaulniers

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

2 years ago[OpenMP][libomp][CMake] use uppercase_CMAKE_BUILD_TYPE
Jonathan Peyton [Mon, 1 Nov 2021 19:23:54 +0000 (14:23 -0500)]
[OpenMP][libomp][CMake] use uppercase_CMAKE_BUILD_TYPE

Have standalone builds define uppercase_CMAKE_BUILD_TYPE and use it.
llvm/CMakeLists.txt defines uppercase_CMAKE_BUILD_TYPE for regular LLVM
builds with OpenMP enabled.

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

2 years agoReland "[lld-macho] Fix assertion failure in registerCompactUnwind""
Vy Nguyen [Tue, 9 Nov 2021 15:42:21 +0000 (10:42 -0500)]
Reland "[lld-macho] Fix assertion failure in registerCompactUnwind""

PR/52372

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

New changes:
- use llvm-otool instead of `otool` which doesn't in exist on non-OSX platforms
- add llvm-otool to the set of tools used by test so that the bot will use the <build_dir>/bin/llvm-otool instead of the unqualified `llvm-otool` (which may not exist)
- update tests since the latest (TOT) llvm-otool prints a space between two bytes and the old one doesn't.

2 years ago[lldb-vscode] Add presentation hints for scopes
Andy Yankovsky [Mon, 8 Nov 2021 14:44:31 +0000 (15:44 +0100)]
[lldb-vscode] Add presentation hints for scopes

Scopes can have an optional hint for how to present this scope in the UI:
https://microsoft.github.io/debug-adapter-protocol/specification#Types_Scope

The IDEs can use the hint to present the data accordingly. For example,
Visual Studio has a separate Registers window, which is populated with the
data from the scope with `presentationHint: "registers"`.

Reviewed By: wallace

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

2 years agoRevert "add tsan shared lib"
zijunzhao [Tue, 9 Nov 2021 16:36:06 +0000 (16:36 +0000)]
Revert "add tsan shared lib"

This reverts commit 92c9b340be4164f44772ddf5a50a4a5acdbd6607.

2 years ago[InstCombine] allow commute in sub-of-umax fold
Sanjay Patel [Tue, 9 Nov 2021 15:48:47 +0000 (10:48 -0500)]
[InstCombine] allow commute in sub-of-umax fold

This fold was added with:
83c2fb9f66be
...but missed the commuted pattern:
https://alive2.llvm.org/ce/z/_tYEGy

2 years ago[InstCombine] add/move tests for sub-of-umax; NFC
Sanjay Patel [Tue, 9 Nov 2021 15:35:13 +0000 (10:35 -0500)]
[InstCombine] add/move tests for sub-of-umax; NFC

2 years ago[libcxx] Add a dependency on unwind in cxx_static, if LIBCXXABI_USE_LLVM_UNWINDER...
Martin Storsjö [Tue, 9 Nov 2021 08:14:16 +0000 (10:14 +0200)]
[libcxx] Add a dependency on unwind in cxx_static, if LIBCXXABI_USE_LLVM_UNWINDER is set

Even if building cxx_static in itself doesn't actually link in the
requested unwinder, add a synthetic dependency so that building
cxx_static makes sure that the unwinder that was requested to be used
also gets built.

This makes sure that tests (when run with just a plain "ninja check-cxx")
actually use the newly built unwinder, as intended.

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

2 years ago[clang] [docs] Fix markup
Nathan Sidwell [Tue, 9 Nov 2021 15:39:22 +0000 (07:39 -0800)]
[clang] [docs]  Fix markup

code-block needs a blank line

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

2 years agoRevert "[lld-macho] Fix assertion failure in registerCompactUnwind"
Vy Nguyen [Tue, 9 Nov 2021 15:31:47 +0000 (10:31 -0500)]
Revert "[lld-macho] Fix assertion failure in registerCompactUnwind"

broke windows build - reverting to investigate
This reverts commit b2d92584742e333799ed6a3687c801dde9bb6174.

2 years ago[clang] GCC directive extension extension: Hash NNN lines
Nathan Sidwell [Mon, 8 Nov 2021 17:45:26 +0000 (09:45 -0800)]
[clang] GCC directive extension extension: Hash NNN lines

Some time back I extended GCC's '# NNN' line marker semantics.
Specifically popping to a blank filename will restore the filename to
that of the popped-to include.  Restore to line 5 of including file
(escaped BOL #'s to avoid git eliding them):

\# 5 "" 2

Added documentation for this line control extension.

This was useful in developing modules tests, but turned out to also be
useful with machine-generated source code.  Specifically, a generated
include file that itself includes fragments from elsewhere.  The
ability to pop to the generated include file -- with its full path
prefix -- is useful for diagnostic & debug purposes.  For instance
something like:

// Machine generated -- DO NOT EDIT
Type Var = {
\# 7 "encoded.dsl" 1 // push to snippet-container
{snippet, of, code}
\# 6 " 2 // Restore to machined-generated source
,
};

// user-code
...
\#include "dsl.h"
...

That pop to "" will restore the filename to '..includepath../dsl.h',
which is better than restoring to plain "dsl.h".

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

2 years ago[X86] combineMulToPMADDWD - handle any pow2 vector type and split to legal types
Simon Pilgrim [Tue, 9 Nov 2021 15:11:21 +0000 (15:11 +0000)]
[X86] combineMulToPMADDWD - handle any pow2 vector type and split to legal types

combineMulToPMADDWD is currently limited to legal types, but there's no reason why we can't handle any larger type that the existing SplitOpsAndApply code can use to split to legal X86ISD::VPMADDWD ops.

This also exposed a missed opportunity for pre-SSE41 targets to handle SEXT ops from types smaller than vXi16 - without PMOVSX instructions these will always be expanded to unpack+shifts, so we can cheat and convert this into a ZEXT(SEXT()) sequence to make it a valid PMADDWD op.

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

2 years ago[llvm] Use MachineBasicBlock::{successors,predecessors} (NFC)
Kazu Hirata [Tue, 9 Nov 2021 15:11:13 +0000 (07:11 -0800)]
[llvm] Use MachineBasicBlock::{successors,predecessors} (NFC)

2 years ago[lld-macho] Fix assertion failure in registerCompactUnwind
Vy Nguyen [Tue, 2 Nov 2021 20:28:31 +0000 (16:28 -0400)]
[lld-macho] Fix assertion failure in registerCompactUnwind

PR/52372

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

2 years ago[HWASan] Ensure RNG is initialized in GenerateRandomTag
Matt Morehouse [Tue, 9 Nov 2021 14:52:32 +0000 (06:52 -0800)]
[HWASan] Ensure RNG is initialized in GenerateRandomTag

Fixes a CHECK-failure caused by glibc's pthread_getattr_np
implementation calling realloc.  Essentially, Thread::GenerateRandomTag
gets called during Thread::Init and before Thread::InitRandomState:

  HWAddressSanitizer: CHECK failed: hwasan_thread.cpp:134 "((random_buffer_)) != (0)" (0x0, 0x0) (tid=314)
    #0 0x55845475a662 in __hwasan::CheckUnwind()
    #1 0x558454778797 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long)
    #2 0x558454766461 in __hwasan::Thread::GenerateRandomTag(unsigned long)
    #3 0x55845475c58b in __hwasan::HwasanAllocate(__sanitizer::StackTrace*, unsigned long, unsigned long, bool)
    #4 0x55845475c80a in __hwasan::hwasan_realloc(void*, unsigned long, __sanitizer::StackTrace*)
    #5 0x5584547608aa in realloc
    #6 0x7f6f3a3d8c2c in pthread_getattr_np
    #7 0x5584547790dc in __sanitizer::GetThreadStackTopAndBottom(bool, unsigned long*, unsigned long*)
    #8 0x558454779651 in __sanitizer::GetThreadStackAndTls(bool, unsigned long*, unsigned long*, unsigned long*, unsigned long*)
    #9 0x558454761bca in __hwasan::Thread::InitStackAndTls(__hwasan::Thread::InitState const*)
    #10 0x558454761e5c in __hwasan::HwasanThreadList::CreateCurrentThread(__hwasan::Thread::InitState const*)
    #11 0x55845476184f in __hwasan_thread_enter
    #12 0x558454760def in HwasanThreadStartFunc(void*)
    #13 0x7f6f3a3d6fa2 in start_thread
    #14 0x7f6f3a15b4ce in __clone

Also reverts 7a3fb71c3cbdd80666335fa8f6f071b43f0b922a, as it's now
unneeded.

Reviewed By: vitalybuka

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

2 years agoMisleading unicode identifier detection pass
serge-sans-paille [Fri, 15 Oct 2021 13:18:52 +0000 (15:18 +0200)]
Misleading unicode identifier detection pass

Detect when an identifier contains some Right-To-Left characters.
This pass relates to https://trojansource.codes/

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

2 years agoUpdate MaxMinLatency even if dependencies have been already scheduled.
Sergei Larin [Wed, 7 Feb 2018 17:55:58 +0000 (11:55 -0600)]
Update MaxMinLatency even if dependencies have been already scheduled.

Covers an extremely rare corner case on internal book keeping.

2 years ago[LoopVectorize] Extract the last lane from a uniform store
Kerry McLaughlin [Tue, 9 Nov 2021 09:51:00 +0000 (09:51 +0000)]
[LoopVectorize] Extract the last lane from a uniform store

Changes VPReplicateRecipe to extract the last lane from an unconditional,
uniform store instruction. collectLoopUniforms will also add stores to
the list of uniform instructions where Legal->isUniformMemOp is true.

setCostBasedWideningDecision now sets the widening decision for
all uniform memory ops to Scalarize, where previously GatherScatter
may have been chosen for scalable stores.

This fixes an assert ("Cannot yet scalarize uniform stores") in
setCostBasedWideningDecision when we have a loop containing a
uniform i1 store and a scalable VF, which we cannot create a scatter for.

Reviewed By: sdesmalen, david-arm, fhahn

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

2 years ago[fir] Add fir.convert op conversion from FIR to LLVM IR
Valentin Clement [Tue, 9 Nov 2021 14:37:49 +0000 (15:37 +0100)]
[fir] Add fir.convert op conversion from FIR to LLVM IR

Add conversion pattern for the `fir.convert` operation.

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

This patch was previously landed with a truncated version that
was failing the windows buildbot.

Reviewed By: rovka, awarzynski

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[lldb] Fix cross-platform kills
Pavel Labath [Thu, 4 Nov 2021 12:23:12 +0000 (13:23 +0100)]
[lldb] Fix cross-platform kills

This patch fixes an amusing bug where a Platform::Kill operation would
happily terminate a proces on a completely different platform, as long
as they have the same process ID. This was due to the fact that the
implementation was iterating through all known (debugged) processes in
order terminate them directly.

This patch just deletes that logic, and makes everything go through the
OS process termination APIs. While it would be possible to fix the logic
to check for a platform match, it seemed to me that the implementation
was being too smart for its own good -- accessing random Process
objects without knowing anything about their state is risky at best.
Going through the os ensures we avoid any races.

I also "upgrade" the termination signal to a SIGKILL to ensure the
process really dies after this operation.

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

2 years ago[analyzer][docs] Fix the incorrect structure of the checker docs
Kristóf Umann [Mon, 8 Nov 2021 13:40:45 +0000 (14:40 +0100)]
[analyzer][docs] Fix the incorrect structure of the checker docs

The alpha.security.cert section came right after alpha.security, making it look
like checkers like alpha.security.MmapWriteExec belonged to that package.

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

2 years agoRevert "[fir] Add fir.convert op conversion from FIR to LLVM IR"
Valentin Clement [Tue, 9 Nov 2021 14:03:51 +0000 (15:03 +0100)]
Revert "[fir] Add fir.convert op conversion from FIR to LLVM IR"

This reverts commit 165879ec31ed5cc6e4e1a2524c86fc80b81ebbda.

Windows buildbot failure

2 years ago[fir] Add fir.convert op conversion from FIR to LLVM IR
Valentin Clement [Tue, 9 Nov 2021 13:54:21 +0000 (14:54 +0100)]
[fir] Add fir.convert op conversion from FIR to LLVM IR

Add conversion pattern for the `fir.convert` operation.

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

Reviewed By: rovka, awarzynski

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[InstCombine] enhance vector bitwise select matching
Sanjay Patel [Tue, 9 Nov 2021 13:27:09 +0000 (08:27 -0500)]
[InstCombine] enhance vector bitwise select matching

(Cond & C) | (~bitcast(Cond) & D) --> bitcast (select Cond, (bc C), (bc D))

This is part of fixing:
https://llvm.org/PR34047

That report shows a case where a bitcast is sitting between the select condition
candidate and its 'not' value due to current cast canonicalization rules.

There's a bitcast type restriction that might be violated in existing matching,
but I still need to investigate if that is possible -
Alive2 shows we can only do this transform safely when the bitcast is from
narrow to wide vector elements (otherwise poison could leak into elements
that were safe in the original code):
https://alive2.llvm.org/ce/z/Hf66qh

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

2 years ago[DebugInfo][LSR] Add test for use of IV with a SCEV containing undef
Chris Jackson [Tue, 9 Nov 2021 13:26:54 +0000 (13:26 +0000)]
[DebugInfo][LSR] Add test for use of IV with a SCEV containing undef

Added a lit test that checks scev-based salvagaing does not select IVs
that have a SCEV containing an undef.

Original Differential Revision: https://reviews.llvm.org/D111810

2 years ago[mlir] Add nano precision clock to execution engine
Denys Shabalin [Tue, 9 Nov 2021 11:02:33 +0000 (12:02 +0100)]
[mlir] Add nano precision clock to execution engine

Reviewed By: ftynse, nicolasvasilache

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

2 years ago[fir] Force target for FIR to LLVM IR conversion
Valentin Clement [Tue, 9 Nov 2021 13:26:40 +0000 (14:26 +0100)]
[fir] Force target for FIR to LLVM IR conversion

2 years ago[fir] Add complex operations conversion from FIR LLVM IR
Valentin Clement [Tue, 9 Nov 2021 13:15:07 +0000 (14:15 +0100)]
[fir] Add complex operations conversion from FIR LLVM IR

This patch add conversion for primitive operations on complex types.
- fir.addc
- fir.subc
- fir.mulc
- fir.divc
- fir.negc

This adds also the type conversion for !fir.complex<KIND> type.

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

This patch was updated to avoid failure on windows buildbot.
Flang codegen does not support windows target so we force the test
to use a known target instead.

Reviewed By: kiranchandramohan, rovka

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[DebugInfo][LSR] Add more stringent checks on IV selection and salvage
Chris Jackson [Tue, 9 Nov 2021 12:22:59 +0000 (12:22 +0000)]
[DebugInfo][LSR] Add more stringent checks on IV selection and salvage
attempts

Prevent the selection of IVs that have a SCEV containing an undef. Also
prevent salvaging attempts for values for which a SCEV could not be
created by ScalarEvolution and have only SCEVUknown.

Reviewed by: Orlando

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