platform/upstream/llvm.git
21 months ago[LLVM][Support] Support for `llvm::cl::list`'s default values
Son Tuan Vu [Wed, 5 Oct 2022 20:04:47 +0000 (20:04 +0000)]
[LLVM][Support] Support for `llvm::cl::list`'s default values

This patch introduces support for default values of list of CL options.
It fixes the issue in https://github.com/llvm/llvm-project/issues/52667

Reviewed By: bkramer

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

21 months ago[clang][NFC] Use enum for -fstrict-flex-arrays
Bill Wendling [Mon, 3 Oct 2022 19:53:15 +0000 (12:53 -0700)]
[clang][NFC] Use enum for -fstrict-flex-arrays

Use enums for the strict flex arrays flag so that it's more readable.

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

21 months agoRevert "[DSE] Eliminate noop store even through has clobbering between LoadI and...
Arthur Eubanks [Thu, 6 Oct 2022 17:29:46 +0000 (10:29 -0700)]
Revert "[DSE] Eliminate noop store even through has clobbering between LoadI and StoreI"

This reverts commit cd8f3e75813995c1d2da35370ffcf5af3aff9c2f.

Causes miscompiles, see D132657

21 months agoSilence a signed/unsigned mismatch warning; NFC
Aaron Ballman [Thu, 6 Oct 2022 17:30:15 +0000 (13:30 -0400)]
Silence a signed/unsigned mismatch warning; NFC

21 months ago[ConstraintElimination] Remove fixme addressed in 8e3e96298f5a20.
Florian Hahn [Thu, 6 Oct 2022 17:24:15 +0000 (18:24 +0100)]
[ConstraintElimination] Remove fixme addressed in 8e3e96298f5a20.

21 months ago[InstCombine] fold sdiv with hidden common factor
Sanjay Patel [Thu, 6 Oct 2022 16:31:42 +0000 (12:31 -0400)]
[InstCombine] fold sdiv with hidden common factor

(X * Y) s/ (X << Z) --> Y s/ (1 << Z)

https://alive2.llvm.org/ce/z/yRSddG

issue #58137

21 months ago[PhaseOrdering] add test for mul + sdiv; NFC
Sanjay Patel [Thu, 6 Oct 2022 16:25:22 +0000 (12:25 -0400)]
[PhaseOrdering] add test for mul + sdiv; NFC

issue #58137

21 months ago[clang][test] Make headers unique to avoid linking issues
Ben Langmuir [Thu, 6 Oct 2022 16:11:51 +0000 (09:11 -0700)]
[clang][test] Make headers unique to avoid linking issues

Make the empty headers used by cl-pch-showincludes.cpp unique so that
filesystems that link these files together by contents will not see
different behaviour in this test, which is not testing linked files
specifically.

This was uncovered by 5ea78c4113f8 which made us stop mutating the name
of the presumed loc for the file in ContentCache, but that just surfaced
an underlying issue that the filename of multiple includes of linked
files are not separately tracked.

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

21 months ago[ConstraintElimination] Update tests to use opaque pointers.
Florian Hahn [Thu, 6 Oct 2022 17:07:25 +0000 (18:07 +0100)]
[ConstraintElimination] Update tests to use opaque pointers.

21 months ago[InstrProf] Add version into llvm-profdata
Gulfem Savrun Yeniceri [Wed, 5 Oct 2022 01:54:04 +0000 (01:54 +0000)]
[InstrProf] Add version into llvm-profdata

This patch adds support of printing profile version
into llvm-profdata which was proposed in:
https://discourse.llvm.org/t/llvm-profdata-failure-guarantees-for-code-coverage/64924

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

21 months ago[mlir][sparse] Implement insertion sort for the stable sort operator.
bixia1 [Thu, 6 Oct 2022 15:51:46 +0000 (08:51 -0700)]
[mlir][sparse] Implement insertion sort for the stable sort operator.

Reviewed By: aartbik

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

21 months ago[NFC] Replace use of !isTranslationUnit && !isNamespace with !isFileContext
Erich Keane [Thu, 6 Oct 2022 15:52:29 +0000 (08:52 -0700)]
[NFC] Replace use of !isTranslationUnit && !isNamespace with !isFileContext

isFileContext is exactly equal to these two, so simplify the function.

21 months ago[RISCV] Optimization for using compressed beqz and bnez PR#56391
Ivan Tetyushkin [Thu, 6 Oct 2022 16:22:13 +0000 (09:22 -0700)]
[RISCV] Optimization for using compressed beqz and bnez PR#56391

Optimization for using compressed beqz and bnez

If there is pattern
```
br_cc val1 constval eq/neq place
select_cc val1 constval eq/neq trueval falseval
```
and constval does not fit in compressed imm format(6 bit), but fit in
imm format(12 bit), we can replace by non compress sub and compress
c.beqz/c.bneqz:

```
addi val val -constval
c.beqz val place
```

Reviewed By: craig.topper

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

21 months agoRevert "Remove the dependency between lib/DebugInfoDWARF and MC."
Shubham Sandeep Rastogi [Thu, 6 Oct 2022 16:30:18 +0000 (09:30 -0700)]
Revert "Remove the dependency between lib/DebugInfoDWARF and MC."

This reverts commit 0008990479a2daf587c2a4f274384b2fb87247fb.

21 months ago[llvm-reduce] Remove debug metadata elements
Ellis Hoag [Wed, 5 Oct 2022 04:27:25 +0000 (21:27 -0700)]
[llvm-reduce] Remove debug metadata elements

There can be lots of `MDTuple` debug metadata nodes. For example, `globals: !{!1, !2}` in `!DICompileUnit()`. Search through all debug info to find `MDTuple`'s and remove some of their elements.

For D135114 I was able to get a reproducer with 364 lines without manually deleting elements. After this patch I got it down to 67 lines.

Reviewed By: dblaikie

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

21 months agoRemove the dependency between lib/DebugInfoDWARF and MC.
Shubham Sandeep Rastogi [Tue, 27 Sep 2022 20:08:29 +0000 (13:08 -0700)]
Remove the dependency between lib/DebugInfoDWARF and MC.

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

21 months ago[ConstraintElimination] Generalize AND matching.
Florian Hahn [Thu, 6 Oct 2022 16:17:37 +0000 (17:17 +0100)]
[ConstraintElimination] Generalize AND matching.

Extend more general matching used for chains of ORs to also support
chains of ANDs.

21 months ago[flang] Update fir.dispatch operation
Valentin Clement [Thu, 6 Oct 2022 16:10:33 +0000 (18:10 +0200)]
[flang] Update fir.dispatch operation

Update the `fir.dispatch` operation to prepare
the lowering part. `nopass` and `pass_arg_pos` attributes
are added in the arguments list so accessors are generated
by MLIR tablegen. A verifier is added as well as some tests.

This patch is part of the implementation of the poltymorphic
entities.
https://github.com/llvm/llvm-project/blob/main/flang/docs/PolymorphicEntities.md

Reviewed By: jeanPerier, PeteSteinfeld

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

21 months ago[CMake] Provide Findzstd module
Petr Hosek [Fri, 30 Sep 2022 20:33:13 +0000 (20:33 +0000)]
[CMake] Provide Findzstd module

This module is used to find the system zstd library. The imported
targets intentionally use the same name as the generate zstd config
CMake file so these can be used interchangeably.

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

21 months ago[gn build] Port 79df8e19beb9
LLVM GN Syncbot [Thu, 6 Oct 2022 16:02:20 +0000 (16:02 +0000)]
[gn build] Port 79df8e19beb9

21 months ago[Format] Drop speculative test added in previous patch, it hits asserts?
Sam McCall [Thu, 6 Oct 2022 15:57:58 +0000 (17:57 +0200)]
[Format] Drop speculative test added in previous patch, it hits asserts?

21 months ago[ADT] Add support for more formats in APFixedPoint
Tyker [Wed, 14 Sep 2022 01:55:32 +0000 (18:55 -0700)]
[ADT] Add support for more formats in APFixedPoint

Prior to this patch FixedPointSemantics and APFixedPoint only support semantics where
the Scale larger or equal to zero and the Width is larger or equal to the Scale.
This patch removes both those requirements while staying API compatible.

21 months ago[flang] Add a "not yet implemented" message for large, constant arrays
Peter Steinfeld [Wed, 5 Oct 2022 21:02:59 +0000 (14:02 -0700)]
[flang] Add a "not yet implemented" message for large, constant arrays

Rather than crashing in llvm code, nip things in the bud.

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

21 months ago[mlir][sparse] Add rewrite rules for sparse-to-sparse reshape operators.
bixia1 [Wed, 5 Oct 2022 21:33:53 +0000 (14:33 -0700)]
[mlir][sparse] Add rewrite rules for sparse-to-sparse reshape operators.

Reviewed By: aartbik

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

21 months ago[InstCombine] fold udiv with hidden common factor
Sanjay Patel [Thu, 6 Oct 2022 15:33:19 +0000 (11:33 -0400)]
[InstCombine] fold udiv with hidden common factor

(X * Y) u/ (X << Z) --> Y u>> Z

https://alive2.llvm.org/ce/z/4G9D_W

21 months ago[InstCombine] add tests for div with common factor; NFC
Sanjay Patel [Thu, 6 Oct 2022 13:42:18 +0000 (09:42 -0400)]
[InstCombine] add tests for div with common factor; NFC

21 months ago[lldb] Move breakpoint hit reset code to Target::CleanupProcess
Pavel Labath [Thu, 29 Sep 2022 14:47:52 +0000 (16:47 +0200)]
[lldb] Move breakpoint hit reset code to Target::CleanupProcess

This ensures it is run regardless of the method we use to initiate the
session (previous version did not handle connects), and it is the same
place that is used for resetting watchpoints.

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

21 months ago[lldb/gdb-server] Better reporting of launch errors
Pavel Labath [Tue, 27 Sep 2022 18:04:10 +0000 (20:04 +0200)]
[lldb/gdb-server] Better reporting of launch errors

Use our "rich error" facility to propagate error reported by the stub to
the user. lldb-server reports rich launch errors as of D133352.

To make this easier to implement, and reduce code duplication, I have
moved the vRun/A/qLaunchSuccess handling into a single
GDBRemoteCommunicationClient function.

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

21 months ago[clangd] Optimize Dex::generateProximityURIs().
Sam McCall [Tue, 4 Oct 2022 23:33:36 +0000 (01:33 +0200)]
[clangd] Optimize Dex::generateProximityURIs().

Production profiles show that generateProximityURIs is roughly 3.8% of
buildPreamble. Of this, the majority (3% of buildPreamble) is parsing
and reserializing URIs.

We can do this with ugly string manipulation instead.

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

21 months ago[Format] Fix crash when hitting eof while lexing JS template string
Sam McCall [Thu, 6 Oct 2022 11:10:19 +0000 (13:10 +0200)]
[Format] Fix crash when hitting eof while lexing JS template string

Different loop termination conditions resulted in confusion of whether
*Offset was intended to be inside or outside the token.
This ultimately led to constructing an out-of-range SourceLocation.

Fix by making Offset consistently point *after* the token.

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

21 months ago[RISCV][InsertVSETVLI] Default to MA not MU
Philip Reames [Thu, 6 Oct 2022 14:46:09 +0000 (07:46 -0700)]
[RISCV][InsertVSETVLI] Default to MA not MU

This changes the default value used for mask policy from mask undisturbed to mask agnostic. In hardware, there may be a minor preference for ta/ma, but since this is only going to apply to instructions which don't use the mask policy bit, this is functionally mostly a nop. The main value is to make future changes to using MA when legal for masked instructions easier to review by reducing test churn.

The prior code was motivated by a desire to minimize state transitions between masked and unmasked code. This patch achieves the same effect using the demanded field logic (landed in afb45ff), and there are no regressions I spotted in the test diffs. (Given the size, I have only been able to skim.) I do want to call out that regressions are possible here; the demanded analysis only works on a block local scope right now, so e.g. a tight loop mixing masked and unmasked computation might see an extra vsetvli or two.

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

21 months ago[libc++] Implement P0591R4 (Utility functions to implement uses-allocator construction)
Nikolas Klauser [Tue, 4 Oct 2022 15:55:42 +0000 (17:55 +0200)]
[libc++] Implement P0591R4 (Utility functions to implement uses-allocator construction)

Reviewed By: ldionne, #libc, huixie90

Spies: huixie90, libcxx-commits, mgorny

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

21 months ago[ConstraintElimination] Order cmps for signed <-> unsigned transfer first.
Florian Hahn [Thu, 6 Oct 2022 14:56:24 +0000 (15:56 +0100)]
[ConstraintElimination] Order cmps for signed <-> unsigned transfer first.

Make sure conditions with constant operands come before conditions
without constant operands. This increases the effectiveness of the
current signed <-> unsigned fact transfer logic.

21 months ago[test][InstCombine] Use opaque pointers in wcslen test cases. NFC
Bjorn Pettersson [Thu, 6 Oct 2022 14:42:04 +0000 (16:42 +0200)]
[test][InstCombine] Use opaque pointers in wcslen test cases. NFC

21 months ago[Clang] Fix using LTO with the new driver in RDC-mode
Joseph Huber [Wed, 5 Oct 2022 19:35:48 +0000 (14:35 -0500)]
[Clang] Fix using LTO with the new driver in RDC-mode

The new driver supports LTO for RDC-mode compilations. However, this was
not correctly handled for non-LTO compilations. HIP can handle this as
it is fed to `lld` which will perform the LTO itself. CUDA however would
require every work which is wholly useless in non-RDC mode so it should
report an error.

Reviewed By: yaxunl

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

21 months ago[mlir][llvmir] Simpler error handling in ConvertFromLLVMIR (nfc).
Tobias Gysi [Thu, 6 Oct 2022 14:11:58 +0000 (17:11 +0300)]
[mlir][llvmir] Simpler error handling in ConvertFromLLVMIR (nfc).

The revision renames some methods of the Importer and changes
the error handling to be closer the ModuleTranslation. In particular,
processValue -> lookupValue and processType -> convertType
now fail if the translation fails (instead of returning an error),
which simplifies the error handling.

The revision prepares a follow up commit that will import
LLVMIR intrinsics using tablegen.

Reviewed By: ftynse

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

21 months ago[ASTMatchers][NFC] Fix wrong code ending command in documentation comments
oToToT [Thu, 6 Oct 2022 14:25:45 +0000 (22:25 +0800)]
[ASTMatchers][NFC] Fix wrong code ending command in documentation comments

21 months ago[RISCV][InsertVSETVLI] Treat mask policy as undemanded if usesMaskPolicy is false
Philip Reames [Thu, 6 Oct 2022 14:18:55 +0000 (07:18 -0700)]
[RISCV][InsertVSETVLI] Treat mask policy as undemanded if usesMaskPolicy is false

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

21 months ago[llvm] [test] Add missing canonicalization of LLVM_ENABLE_ZSTD
Michał Górny [Thu, 6 Oct 2022 12:41:52 +0000 (14:41 +0200)]
[llvm] [test] Add missing canonicalization of LLVM_ENABLE_ZSTD

Add LLVM_ENABLE_ZSTD to llvm_canonicalize_cmake_booleans().  This is
needed to ensure that the substitutions in lit.site.cfg.py resolve
to correct Python booleans.

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

21 months agoSilence a duplicate diagnostic about K&R C function definitions
Aaron Ballman [Thu, 6 Oct 2022 14:07:16 +0000 (10:07 -0400)]
Silence a duplicate diagnostic about K&R C function definitions

We would issue the same diagnostic twice in the case that the K&R C
function definition is preceded by a static declaration of the function
with a prototype.

Fixes #58181

21 months ago[clang][C++20] Note github issue in the FIXME matching requires clause.
Utkarsh Saxena [Thu, 6 Oct 2022 11:51:17 +0000 (13:51 +0200)]
[clang][C++20] Note github issue in the FIXME matching requires clause.

21 months ago[ConstraintElimination] Add tests with logical ANDs.
Florian Hahn [Thu, 6 Oct 2022 13:50:12 +0000 (14:50 +0100)]
[ConstraintElimination] Add tests with logical ANDs.

21 months ago[VectorCombine] remove unused test prefixes; NFC
Sanjay Patel [Thu, 6 Oct 2022 13:39:14 +0000 (09:39 -0400)]
[VectorCombine] remove unused test prefixes; NFC

These would change with D135278, but for now everything is the same.

21 months ago[gn build] port d1f13c54f1728 (Inclusions/Stdlib)
Nico Weber [Thu, 6 Oct 2022 13:38:23 +0000 (09:38 -0400)]
[gn build] port d1f13c54f1728 (Inclusions/Stdlib)

21 months ago[VectorCombine] add tests for scalar fneg with insert/extract; NFC
Sanjay Patel [Wed, 5 Oct 2022 12:55:22 +0000 (08:55 -0400)]
[VectorCombine] add tests for scalar fneg with insert/extract; NFC

21 months ago[gn build] port d785a8eaa25d
Nico Weber [Thu, 6 Oct 2022 11:31:06 +0000 (07:31 -0400)]
[gn build] port d785a8eaa25d

21 months ago[C++20][Clang] P2468R2 The Equality Operator You Are Looking For
Utkarsh Saxena [Fri, 23 Sep 2022 13:02:28 +0000 (15:02 +0200)]
[C++20][Clang] P2468R2 The Equality Operator You Are Looking For

Implement
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2468r2.html.

Primarily we now accept
```
template<typename T> struct CRTPBase {
  bool operator==(const T&) const;
  bool operator!=(const T&) const;
};
struct CRTP : CRTPBase<CRTP> {};
bool cmp_crtp = CRTP() == CRTP();
bool cmp_crtp2 = CRTP() != CRTP();
```

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

21 months ago[CodeGenCXX] Remove typed pointer check lines from test (NFC)
Nikita Popov [Thu, 6 Oct 2022 11:05:13 +0000 (13:05 +0200)]
[CodeGenCXX] Remove typed pointer check lines from test (NFC)

This test already has check lines for opaque pointers, remove the
unnecessary typed pointer check lines.

21 months ago[ConstraintElimination] Generalize OR matching.
Florian Hahn [Thu, 6 Oct 2022 10:56:21 +0000 (11:56 +0100)]
[ConstraintElimination] Generalize OR matching.

Extend OR handling to traverse chains of ORs.

21 months ago[RelativeVTablesABI] Convert tests to opaque pointers (NFC)
Nikita Popov [Thu, 6 Oct 2022 10:36:10 +0000 (12:36 +0200)]
[RelativeVTablesABI] Convert tests to opaque pointers (NFC)

Converted using https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34
with manual fixup, primarily to drop check lines for types that
no longer appear with opaque pointers.

21 months ago[Test] Add test showing missed branch elimination due to loop predication transform
Dmitry Makogon [Thu, 6 Oct 2022 09:30:25 +0000 (16:30 +0700)]
[Test] Add test showing missed branch elimination due to loop predication transform

21 months ago[mlir] Add bar.warp.sync to NVVM
Guray Ozen [Wed, 5 Oct 2022 10:23:32 +0000 (12:23 +0200)]
[mlir] Add bar.warp.sync to NVVM

It adds the missing `bar.warp.sync` to the nvvm dialect. It is a barrier to synchronize for threads in a warp.

Reviewed By: ftynse

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

21 months ago[CodeGenCXX] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 6 Oct 2022 10:12:57 +0000 (12:12 +0200)]
[CodeGenCXX] Convert some tests to opaque pointers (NFC)

Conversion done using the script at
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34.

These are tests where the conversion worked out of the box and no
manual fixup was performed.

21 months agoRevert "[CMake] Provide Findzstd module"
Nikita Popov [Thu, 6 Oct 2022 10:02:13 +0000 (12:02 +0200)]
Revert "[CMake] Provide Findzstd module"

This reverts commit 849059861c63f5d89a6956191ecb8da8acf16bdb.

This breaks running llvm tests:

llvm-lit: /home/npopov/repos/llvm-project/llvm/utils/lit/lit/TestingConfig.py:138: fatal: unable to parse config file '/home/npopov/repos/llvm-project/build/test/lit.site.cfg.py', traceback: Traceback (most recent call last):
  File "/home/npopov/repos/llvm-project/llvm/utils/lit/lit/TestingConfig.py", line 127, in load_from_path
    exec(compile(data, path, 'exec'), cfg_globals, None)
  File "/home/npopov/repos/llvm-project/build/test/lit.site.cfg.py", line 48, in <module>
    config.have_zstd = FALSE
NameError: name 'FALSE' is not defined

21 months agoRevert "Revert "[clang][Lex] Fix a crash on malformed string literals""
Kadir Cetinkaya [Thu, 6 Oct 2022 09:39:43 +0000 (11:39 +0200)]
Revert "Revert "[clang][Lex] Fix a crash on malformed string literals""

This reverts commit feea7ef23cb1bef92d363cc613052f8f3a878fc2.
Drops the test case, see https://reviews.llvm.org/D135161#3839510

21 months ago[clangd] Avoid scanning up to end of file on each comment!
Sam McCall [Wed, 5 Oct 2022 20:23:10 +0000 (22:23 +0200)]
[clangd] Avoid scanning up to end of file on each comment!

Assigning char* (pointing at comment start) to StringRef was causing us
to scan the rest of the source file looking for the null terminator.

This seems to be eating about 8% of our *total* CPU!

While fixing this, factor out the common bits from the two places we're
parsing IWYU pragmas.

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

21 months ago[clang] Add Create method for CXXBoolLiteralExpr
David Spickett [Wed, 5 Oct 2022 11:22:54 +0000 (11:22 +0000)]
[clang] Add Create method for CXXBoolLiteralExpr

Reviewed By: shafik

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

21 months ago[Local] Fix unused variable warnings (NFC)
Nikita Popov [Thu, 6 Oct 2022 08:30:59 +0000 (10:30 +0200)]
[Local] Fix unused variable warnings (NFC)

21 months ago[AA] Update unit test missed in previous commit (NFC)
Nikita Popov [Thu, 6 Oct 2022 08:26:24 +0000 (10:26 +0200)]
[AA] Update unit test missed in previous commit (NFC)

Missed this unit test use in 3d0b5f019e85eab5e7153516d3f6e9e4f2b9135b.

21 months ago[CMake] Provide Findzstd module
Petr Hosek [Fri, 30 Sep 2022 20:33:13 +0000 (20:33 +0000)]
[CMake] Provide Findzstd module

This module is used to find the system zstd library. The imported
targets intentionally use the same name as the generate zstd config
CMake file so these can be used interchangeably.

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

21 months ago[AA] Remove unused template argument from AAResultBase (NFC)
Nikita Popov [Tue, 27 Sep 2022 09:20:19 +0000 (11:20 +0200)]
[AA] Remove unused template argument from AAResultBase (NFC)

After D94363, there is no more need to use CRTP here.

21 months agoDetect Visual Studio in Windows packaging script
Pierrick Bouvier [Thu, 6 Oct 2022 08:18:26 +0000 (10:18 +0200)]
Detect Visual Studio in Windows packaging script

Instead of hardcoding a specific VS install, try sequentially:

- %VSINSTALLDIR% (already set from a vs prompt)
- 2019/Enterprise
- 2019/Professional
- 2019/Community
- 2019/BuildTools

It stops when one is found and set vsdevcmd env var.

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

21 months ago[SourceManager] Improve getFileIDLoaded.
Haojian Wu [Wed, 5 Oct 2022 09:31:04 +0000 (11:31 +0200)]
[SourceManager] Improve getFileIDLoaded.

Similar to getFileIDLocal patch, but for the version for load module.

Test with clangd (building AST with preamble), FileID scans in binary
search is reduced:

SemaExpr.cpp: 142K -> 137K (-3%)
FindTarget.cpp: 368K -> 343K (-6%)

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

21 months ago[ConstraintElimination] Extend test coverage for AND chains.
Florian Hahn [Thu, 6 Oct 2022 08:11:07 +0000 (09:11 +0100)]
[ConstraintElimination] Extend test coverage for AND chains.

21 months ago[AA] Pass AAResults through AAQueryInfo
Nikita Popov [Sat, 9 Jan 2021 17:09:20 +0000 (18:09 +0100)]
[AA] Pass AAResults through AAQueryInfo

Currently, AAResultBase (from which alias analysis providers inherit)
stores a reference back to the AAResults aggregation it is part of,
so it can perform recursive alias analysis queries via
getBestAAResults().

This patch removes the back-reference from AAResultBase to AAResults,
and instead passes the used aggregation through the AAQueryInfo.
This can be used to perform recursive AA queries using the full
aggregation.

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

21 months ago[clang][Tooling] Move STL recognizer to its own library
Kadir Cetinkaya [Wed, 5 Oct 2022 07:52:20 +0000 (09:52 +0200)]
[clang][Tooling] Move STL recognizer to its own library

As pointed out in https://reviews.llvm.org/D119130#3829816, this
introduces a clang AST dependency to the clangToolingInclusions, which is used
by clang-format.

Since rest of the inclusion tooling doesn't depend on clang ast, moving this
into a separate library.

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

21 months ago[AA] Thread AAQI through getModRefBehavior() (NFC)
Nikita Popov [Fri, 15 Jan 2021 19:38:47 +0000 (20:38 +0100)]
[AA] Thread AAQI through getModRefBehavior() (NFC)

This is in preparation for D94363, as we will need AAQI to
perform the recursive call to the function variant.

21 months ago[clang] Remove CLANG_ENABLE_OPAQUE_POINTERS cmake option
Nikita Popov [Wed, 5 Oct 2022 12:20:57 +0000 (14:20 +0200)]
[clang] Remove CLANG_ENABLE_OPAQUE_POINTERS cmake option

Remove the ability to disable opaque pointers by default in clang.
It is still possible to explicitly disable them via cc1
-no-opaque-pointers.

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

21 months ago[ConstraintElimination] Extend test coverage for OR chains.
Florian Hahn [Thu, 6 Oct 2022 07:39:10 +0000 (08:39 +0100)]
[ConstraintElimination] Extend test coverage for OR chains.

21 months ago[DAG] Update `isKnownNeverNaN` for `FMA/FMAD`
Pierre van Houtryve [Thu, 29 Sep 2022 07:45:46 +0000 (07:45 +0000)]
[DAG] Update `isKnownNeverNaN` for `FMA/FMAD`

We can still get a NaN even if none of the operands are NaN,
e.g. from +inf/-inf. D50804 didn't catch that.

Reviewed By: arsenm

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

21 months ago[ConstraintElimination] Use ConstraintTy::IsSigned instead of Predicate.
Florian Hahn [Thu, 6 Oct 2022 06:51:48 +0000 (07:51 +0100)]
[ConstraintElimination] Use ConstraintTy::IsSigned instead of Predicate.

This should be NFC and ensure the sign of the constraint is used
consistently in the future.

21 months ago[AMDGPU][GISel] Add missing V2S16 BUILD_VECTOR_TRUNC legalization
Pierre van Houtryve [Tue, 4 Oct 2022 12:09:14 +0000 (12:09 +0000)]
[AMDGPU][GISel] Add missing V2S16 BUILD_VECTOR_TRUNC legalization

Previously we would be unable to legalize V2S16 BUILD_VECTOR_TRUNC on GFX8 & below as the custom legalization was missing.

Reviewed By: arsenm

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

21 months ago[InstrProf] Make __llvm_profile_counter_bias_default hidden
Alex Brachet [Thu, 6 Oct 2022 06:16:22 +0000 (06:16 +0000)]
[InstrProf] Make __llvm_profile_counter_bias_default hidden

This symbol shouldn't have default visibility.

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

21 months ago[mlir][tensor][bufferize] Bufferize inserts into equivalent tensors in-place
Matthias Springer [Thu, 6 Oct 2022 06:05:56 +0000 (15:05 +0900)]
[mlir][tensor][bufferize] Bufferize inserts into equivalent tensors in-place

Inserting a tensor into an equivalent tensor is a no-op after bufferization. No alloc is needed.

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

21 months agoFix d5090cd94, MSVC mangling issue
Alex Brachet [Thu, 6 Oct 2022 05:24:45 +0000 (05:24 +0000)]
Fix d5090cd94, MSVC mangling issue

Evidently * and [] are mangled differently by MSVC...

21 months ago[llvm-driver] Add various tools to the llvm-driver
Alex Brachet [Thu, 6 Oct 2022 05:16:13 +0000 (05:16 +0000)]
[llvm-driver] Add various tools to the llvm-driver

The llvm-driver, enabled with LLVM_TOOL_LLVM_DRIVER_BUILD combines many llvm executables
into one to save overall toolchain size. This patch adds a few more llvm tools to the
llvm-driver.

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

21 months ago[clang-format][NFC] Clean up class HeaderIncludes and Format.cpp
owenca [Thu, 29 Sep 2022 06:21:19 +0000 (23:21 -0700)]
[clang-format][NFC] Clean up class HeaderIncludes and Format.cpp

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

21 months ago[mlir][bazel] fix VectorToGPU bazel breakage
Aart Bik [Thu, 6 Oct 2022 04:08:12 +0000 (21:08 -0700)]
[mlir][bazel] fix VectorToGPU bazel breakage

NOTE: this is probably not the long term organization
      that you want to keep after the refactoring to new
      directories, but this fixes the breakage for now;
      I leave proper refactoring of build to the NVGPU
      bazel team.

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

21 months ago[mlir][nvgpu] NFC - move NVGPU conversion helpers to NvGpu utils library
Christopher Bate [Wed, 5 Oct 2022 15:56:50 +0000 (09:56 -0600)]
[mlir][nvgpu] NFC - move NVGPU conversion helpers to NvGpu utils library

The ConvertVectorToGpu pass implementation contained a small private
support library for performing various calculations during conversion
between `vector` and `nvgpu.mma.sync` and `nvgpu.ldmatrix` operations.
The support library is moved under `Dialect/NVGPU/Utils` because the
functions have wider utility. Some documentation comments are added or
improved.

Reviewed By: ThomasRaoux

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

21 months ago[mlir][sparse] Favors defined dimension when optimize lattice points.
Peiming Liu [Thu, 6 Oct 2022 01:07:40 +0000 (01:07 +0000)]
[mlir][sparse] Favors defined dimension when optimize lattice points.

Reviewed By: aartbik

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

21 months ago[mlir][sparse] Fixing bug in python test
wren romano [Thu, 6 Oct 2022 00:59:34 +0000 (17:59 -0700)]
[mlir][sparse] Fixing bug in python test

This is a followup to D135004, to correct one of the tests that didn't get caught by the buildbot.

Reviewed By: aartbik

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

21 months ago[SPIRV] read kernel arg attributes from fuction/module metadata
Ilia Diachkov [Mon, 3 Oct 2022 21:05:25 +0000 (00:05 +0300)]
[SPIRV] read kernel arg attributes from fuction/module metadata

The patch introduces reading the attributes of kernel arguments both from
function-attached and module-level metadata, during kernel arguments lowering.
Two tests are added to show the improvement.

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

Co-authored-by: Aleksandr Bezzubikov <zuban32s@gmail.com>
Co-authored-by: Michal Paszkowski <michal.paszkowski@outlook.com>
Co-authored-by: Andrey Tretyakov <andrey.tretyakov@mail.com>
Co-authored-by: Konrad Trifunovic <konrad.trifunovic@intel.com>
21 months ago[mlir][sparse] Adjusting DimLevelType numeric values for faster predicates
wren romano [Wed, 5 Oct 2022 23:23:14 +0000 (16:23 -0700)]
[mlir][sparse] Adjusting DimLevelType numeric values for faster predicates

This differential adjusts the numeric values for DimLevelType values: using the low-order two bits for recording the "No" and "Nu" properties, and the high-order bits for the formats per se.  (The choice of encoding may seem a bit peculiar, since the bits are mapped to negative properties rather than positive properties.  But this was done in order to preserve the collation order of DimLevelType values.  If we don't care about collation order, then we may prefer to flip the semantics of the property bits, so that they're less surprising to readers.)

Using distinguished bits for the properties and formats enables faster implementation for the predicates detecting those properties/formats, which matters because this is in the runtime library itself (rather than on the codegen side of things).  This differential pushes through the changes to the enum values, and optimizes the basic predicates.  However it does not optimize all the places where we check compound predicates (e.g., "is compressed or singleton"), to help reduce rebasing conflict with D134933.  Those optimizations will be done after this differential and D134933 are landed.

Reviewed By: aartbik

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

21 months ago[Sink] Allow sinking of invariant loads across critical edges
Carl Ritson [Thu, 6 Oct 2022 00:06:32 +0000 (09:06 +0900)]
[Sink] Allow sinking of invariant loads across critical edges

Invariant loads can always be sunk.

Reviewed By: foad, arsenm

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

21 months ago[mlir] vector.multi_reduction canonicalizes to vector.shape_cast (or
Murali Vijayaraghavan [Wed, 5 Oct 2022 23:46:02 +0000 (23:46 +0000)]
[mlir] vector.multi_reduction canonicalizes to vector.shape_cast (or
vector.extract, if the result is a scalar) only if all reduction
dimensions are of size 1.

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

21 months ago[NFC] Fix typo in error message.
Daniel Rodríguez Troitiño [Wed, 5 Oct 2022 20:38:04 +0000 (13:38 -0700)]
[NFC] Fix typo in error message.

Fix typo in error message. No other changes

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

21 months ago[clang-offload-bundler] extracting compatible bundle entry
Yaxun (Sam) Liu [Fri, 23 Sep 2022 14:35:55 +0000 (10:35 -0400)]
[clang-offload-bundler] extracting compatible bundle entry

In HIP a library is usually compiled with default target ID e.g. gfx906 so that
it can be used in all GPU configurations. The bitcode is saved in bundled
bitcode with gfx906 in entry ID.

In runtime compilation, a HIP program is compiled with a target ID matching
the GPU configuration, e.g. gfx906:xnack-. This program needs to link with
a library bundled bitcode with target ID gfx906.

For example:

  clang --offload-arch=gfx906 -o lib.o lib.hip
  clang --offload-arch=gfx906:xnack- program.hip lib.o

This common use case requires that clang-offlod-bundler to be able to extract
entry with compatible target ID, e.g. extracting an gfx906 entry when requesting
gfx906:xnack-.

Currently clang-offload-bundler only allow extracting entry with exact match
of target ID. This patch relaxes that so that it can extract entries with compatible
target ID.

Reviewed by: Artem Belevich, Saiyedul Islam

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

21 months agoRevert "[libc] Resolve NaN/implementation-defined behavior of floating-point tests"
Dominic Chen [Wed, 5 Oct 2022 23:33:07 +0000 (16:33 -0700)]
Revert "[libc] Resolve NaN/implementation-defined behavior of floating-point tests"

This reverts commit 5470b1fcb5754b45c1233df7759411ff56942d6e.

21 months ago[mlir][tosa] tosa.resize canonicalizer for trivial noop
Rob Suderman [Wed, 5 Oct 2022 23:28:19 +0000 (16:28 -0700)]
[mlir][tosa] tosa.resize canonicalizer for trivial noop

If the scaling factor is by 1 with no offset or border, then the
resize is a no-op.

Reviewed By: dcaballe

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

21 months ago[libc] Resolve NaN/implementation-defined behavior of floating-point tests
Dominic Chen [Thu, 29 Sep 2022 21:57:56 +0000 (14:57 -0700)]
[libc] Resolve NaN/implementation-defined behavior of floating-point tests

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

21 months ago[mlir][sparse] further implement singleton dimension level type
wren romano [Wed, 5 Oct 2022 20:30:22 +0000 (13:30 -0700)]
[mlir][sparse] further implement singleton dimension level type

Handle more cases of singleton DLT including direct sparse2sparse conversion.  (Followup to D134096)

Depends On D134926

Reviewed By: aartbik

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

21 months ago[clang][deps] Canonicalize module map path
Ben Langmuir [Thu, 29 Sep 2022 23:04:38 +0000 (16:04 -0700)]
[clang][deps] Canonicalize module map path

When dep-scanning, canonicalize the module map path as much as we can.
This avoids unnecessarily needing to build multiple versions of a module
due to symlinks or case-insensitive file paths.

Despite the name `tryGetRealPathName`, the previous implementation did
not actually return the realpath most of the time, and indeed it would
be incorrect to do so since the realpath could be outside the module
directory, which would have broken finding headers relative to the
module.

Instead, use a canonicalization that is specific to the needs of
modulemap files (canonicalize the directory separately from the
filename).

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

21 months ago[mlir][sparse] Case coverage fix no errorhandling
Nathaniel McVicar [Wed, 5 Oct 2022 21:51:39 +0000 (14:51 -0700)]
[mlir][sparse] Case coverage fix no errorhandling

Restores the fix from D134925 for MSVC without breaking cpu runner.

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

21 months ago[AArch64][KCFI] Define Size for KCFI_CHECK
Sami Tolvanen [Wed, 5 Oct 2022 22:07:32 +0000 (22:07 +0000)]
[AArch64][KCFI] Define Size for KCFI_CHECK

Specify the correct size for the KCFI_CHECK pseudo
instruction, which is lowered into six 4-byte instructions in
AArch64AsmPrinter::LowerKCFI_CHECK.

Link: https://github.com/ClangBuiltLinux/linux/issues/1730
21 months agoReduceOperands: Do not crash on vector of pointer types
Matthias Braun [Wed, 5 Oct 2022 00:49:01 +0000 (17:49 -0700)]
ReduceOperands: Do not crash on vector of pointer types

Avoid crash in `reduceOperandsOneDeltaPass` function for operands with
vector of pointer type.

While on it add a `reduce-operands-ptr.ll` test in the spirit of the
existing `reduce-operands-int.ll`/`reduce-operands-fp.ll` tests.

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

21 months ago[mlir][sparse] move sparse tensor rewriting into its own pass
Aart Bik [Wed, 5 Oct 2022 20:38:51 +0000 (13:38 -0700)]
[mlir][sparse] move sparse tensor rewriting into its own pass

Makes individual testing and debugging easier.

Reviewed By: bixia

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

21 months agoRevert "Added canonicalization for vector.multi_reduction"
Murali Vijayaraghavan [Wed, 5 Oct 2022 21:43:51 +0000 (21:43 +0000)]
Revert "Added canonicalization for vector.multi_reduction"

This reverts commit c16f3260a9255c7d9880f72de7d856f9ceeb1866.

There's a bug in the commit creates a scalar result with `ShapeCastOp`.
Reverting till that fix is done.

21 months ago[RISCV][ISel] Finally fix the UBSan error
Quentin Colombet [Wed, 5 Oct 2022 21:42:34 +0000 (21:42 +0000)]
[RISCV][ISel] Finally fix the UBSan error

Forgot another SDValue check and a boolean initialization.

21 months ago[flang] Keep current polymorphic implementation under a flag
Valentin Clement [Wed, 5 Oct 2022 21:04:59 +0000 (23:04 +0200)]
[flang] Keep current polymorphic implementation under a flag

It is useful for couple of test suite like NAG to keep failing
with a TODO until the polymorphic entities is implemented  all the
way done to codegen.

This pass adds a flag to LoweringOptions for experimental development.
This flag is off by default and can be enable in `bbc` with `-polymorphic-type`.
Options can be added in the driver and tco when needed.

Reviewed By: PeteSteinfeld

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

21 months ago[clangd] Avoid lexicographic compare when sorting SymbolIDs. NFC
Sam McCall [Wed, 5 Oct 2022 21:00:35 +0000 (23:00 +0200)]
[clangd] Avoid lexicographic compare when sorting SymbolIDs. NFC

These are 8 bytes and we don't care about the actual ordering, so use
integer compare.

The array generated code has some extra byte swaps (clang), calls memcmp (gcc)
or inlines a big chain of comparisons (MSVC): https://godbolt.org/z/e79r6jM6K