platform/upstream/llvm.git
2 years ago[NFC] Add parentheses around && within || to avoid warning
Chuanqi Xu [Mon, 27 Jun 2022 06:44:10 +0000 (14:44 +0800)]
[NFC] Add parentheses around && within || to avoid warning

2 years ago[mlir] Flip MemRef dialect to _Both (NFC)
Jacques Pienaar [Mon, 27 Jun 2022 03:45:25 +0000 (20:45 -0700)]
[mlir] Flip MemRef dialect to _Both (NFC)

2 years agoRevert "[Coroutines] Only do symmetric transfer if optimization is on"
Chuanqi Xu [Mon, 27 Jun 2022 02:38:29 +0000 (10:38 +0800)]
Revert "[Coroutines] Only do symmetric transfer if optimization is on"

This reverts commit 7782e080e80a90f7bb32049beb3787e2118c2251. According
to the discussion of WG21, symmetric transfer is a desired feature.

2 years agoDon't use Optional::hasValue (NFC)
Kazu Hirata [Mon, 27 Jun 2022 02:54:41 +0000 (19:54 -0700)]
Don't use Optional::hasValue (NFC)

This patch replaces x.hasValue() with x where x is contextually
convertible to bool.

2 years ago[lld] Don't use Optional::hasValue (NFC)
Kazu Hirata [Mon, 27 Jun 2022 02:37:14 +0000 (19:37 -0700)]
[lld] Don't use Optional::hasValue (NFC)

This patch replaces x.hasValue() with x where x is contextually
convertible to bool.

2 years ago[lld] Don't use Optional::hasValue (NFC)
Kazu Hirata [Mon, 27 Jun 2022 02:29:40 +0000 (19:29 -0700)]
[lld] Don't use Optional::hasValue (NFC)

This patch replaces x.hasValue() with x where x is contextually
convertible to bool.

2 years ago[mlir] Flip more uses to prefixed accessor form (NFC).
Jacques Pienaar [Mon, 27 Jun 2022 02:12:38 +0000 (19:12 -0700)]
[mlir] Flip more uses to prefixed accessor form (NFC).

Try to keep the final flip small. Need to flip MemRef as there are many
templated cases with it and Tensor.

2 years ago[clang] Don't use Optional::hasValue (NFC)
Kazu Hirata [Mon, 27 Jun 2022 01:51:54 +0000 (18:51 -0700)]
[clang] Don't use Optional::hasValue (NFC)

This patch replaces x.hasValue() with x where x is contextually
convertible to bool.

2 years ago[llvm] Don't use Optional::hasValue (NFC)
Kazu Hirata [Mon, 27 Jun 2022 01:31:51 +0000 (18:31 -0700)]
[llvm] Don't use Optional::hasValue (NFC)

This patch replaces Optional::hasValue with the implicit cast to bool
in conditionals only.

2 years ago[RISCV] Remove extra semicolon. NFC
Craig Topper [Mon, 27 Jun 2022 01:19:16 +0000 (18:19 -0700)]
[RISCV] Remove extra semicolon. NFC

2 years ago[ELF] Remove deprecated -dc
Fangrui Song [Mon, 27 Jun 2022 00:26:44 +0000 (17:26 -0700)]
[ELF] Remove deprecated -dc

-dc is deprecated in release/14.x. Remove it for 15.0.
The only usage I know was FreeBSD crungen which was removed by https://reviews.freebsd.org/D34215

glibc just dropped -Wl,-d today. Keep -d for now.

2 years ago[llvm] Use Optional::has_value instead of Optional::hasValue (NFC)
Kazu Hirata [Sun, 26 Jun 2022 23:10:42 +0000 (16:10 -0700)]
[llvm] Use Optional::has_value instead of Optional::hasValue (NFC)

This patch replaces x.hasValue() with x.has_value() where x is not
contextually convertible to bool.

2 years ago[NFC][SVE] Auto-generate CHECK lines for intrinsic codegen tests.
Paul Walker [Sat, 25 Jun 2022 18:04:49 +0000 (19:04 +0100)]
[NFC][SVE] Auto-generate CHECK lines for intrinsic codegen tests.

2 years ago[MLIR] NFC. Fix doc comment for AliasResult::isNo
Uday Bondhugula [Sun, 26 Jun 2022 02:23:31 +0000 (07:53 +0530)]
[MLIR] NFC. Fix doc comment for AliasResult::isNo

Fix doc comment for AliasResult::isNo. NFC.

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

2 years ago[clang-format] Fix uninitialized memory problem
sstwcw [Sun, 26 Jun 2022 22:22:27 +0000 (22:22 +0000)]
[clang-format] Fix uninitialized memory problem

The setLength function checks for the token kind which could be
uninitialized in the previous version.

The problem was introduced in 2e32ff106e.

Reviewed By: MyDeveloperDay, owenpan

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

2 years ago[RISCV] Evaluate ICE operands to builtins using getIntegerConstantExpr.
Craig Topper [Sun, 26 Jun 2022 20:28:57 +0000 (13:28 -0700)]
[RISCV] Evaluate ICE operands to builtins using getIntegerConstantExpr.

Some RISC-V builtins requires ICE operands. We should call
getIntegerConstantExpr instead of EmitScalarExpr to match other
targets.

This was made a little trickier by the vector intrinsics not having
a valid type string, but there are two that have ICE operands so
I specified them manually.

2 years ago[Driver][test] Add libclang_rt.profile{{.*}}.a tests for OpenBSD
Frederic Cambus [Fri, 24 Jun 2022 08:47:30 +0000 (10:47 +0200)]
[Driver][test] Add libclang_rt.profile{{.*}}.a tests for OpenBSD

This was requested in D109244.

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

2 years ago[clang-format] Quit analyzing solution space for large state count
owenca [Sat, 25 Jun 2022 05:09:57 +0000 (22:09 -0700)]
[clang-format] Quit analyzing solution space for large state count

Fixes #56043.

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

2 years ago[Driver] Use Component in OpenBSD::getCompilerRT to find libraries
Greg Steuck [Sun, 26 Jun 2022 19:04:43 +0000 (21:04 +0200)]
[Driver] Use Component in OpenBSD::getCompilerRT to find libraries

Clang uses runtime libraries for some advanced features like
sanitizers. Different systems have different preferences about file
placement. OpenBSD with this change will use this name for ASan:
/usr/lib/clang/15.0.0/lib/libclang_rt.asan.a

Already committed to OpenBSD repository then amended to cover the
case of development tree.

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

2 years ago[RISCV] Refactor SelectAddrRegImm to not depend on SelectBaseAddr.
Craig Topper [Sun, 26 Jun 2022 18:08:44 +0000 (11:08 -0700)]
[RISCV] Refactor SelectAddrRegImm to not depend on SelectBaseAddr.

SelectBaseAddr was a minor convenience to use since it already'
existed for vector load/store. D128187 is going to remove the other
uses of SelectBaseAddr so it has less reason to exist.

This patch removes the dependency on SelectBaseAddr and adds a new
SelectAddrFrameIndex to share some code with SelectFrameAddrRegImm.

2 years ago[mlir] Generalize SCF passes to not have to run on FuncOp.
Stella Laurenzo [Sun, 26 Jun 2022 17:39:20 +0000 (10:39 -0700)]
[mlir] Generalize SCF passes to not have to run on FuncOp.

Seems to have been an accident of history and none of these had any reason to be restricted to FuncOp.

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

2 years agoPHINode::removeIncomingValue: use poison as a placeholder instead of undef when the...
Nuno Lopes [Sun, 26 Jun 2022 17:50:47 +0000 (18:50 +0100)]
PHINode::removeIncomingValue: use poison as a placeholder instead of undef when the PHI is dead [NFC]

2 years ago[CodeGenPrepare] Avoid double map lookup. NFCI
Craig Topper [Sun, 26 Jun 2022 17:45:48 +0000 (10:45 -0700)]
[CodeGenPrepare] Avoid double map lookup. NFCI

2 years ago[LICM] Use poison to replace unreachable values instead of undef [NFC]
Nuno Lopes [Sun, 26 Jun 2022 13:56:35 +0000 (14:56 +0100)]
[LICM] Use poison to replace unreachable values instead of undef [NFC]

2 years agoUpdate LibASTImporter.rst
Shivam [Sun, 26 Jun 2022 13:52:52 +0000 (19:22 +0530)]
Update LibASTImporter.rst

As my last commit changed the name of ImportError to ASTImportError , this section also needs to be updated so changed it.

2 years ago[clang] Add missing Interpreter -> ClangDriverOptions dependency
Vassil Vassilev [Sun, 26 Jun 2022 13:47:50 +0000 (13:47 +0000)]
[clang] Add missing Interpreter -> ClangDriverOptions dependency

Without this, it is possible that Interpreter.cpp is being built before
clang/Driver/Options.inc is generated.

Observed only infrequently, serial builds and ext4 manifest the problem
much more often than parallel builds and btrfs.

https://reviews.llvm.org/rG06487b010d48c36c7714ee083ed38dff65711812
is a very similar case.

Patch by t184256!

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

2 years agoAllow interfaces to operate on in-memory buffers with no source location info.
Tapasweni Pathak [Sun, 26 Jun 2022 09:40:43 +0000 (09:40 +0000)]
Allow interfaces to operate on in-memory buffers with no source location info.

This patch is a part of the upstreaming efforts. Cling has the ability to spawn
child interpreters (mainly for auto completions). The child interpreter import
Decls using the ASTImporter which casuses the assertion here
https://github.com/llvm/llvm-project/blob/65eb74e94b414fcde6bfa810d1c30c7fcb136b77/clang/include/clang/Basic/SourceLocation.h#L322

The patch is co-developed with V. Vassilev.

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

2 years ago[LoopSimplifyCFG] use poison when replacing dead instructions instead of undef [NFC]
Nuno Lopes [Sun, 26 Jun 2022 13:15:40 +0000 (14:15 +0100)]
[LoopSimplifyCFG] use poison when replacing dead instructions instead of undef [NFC]

2 years agoRevert "[clang-repl] Support destructors of global objects."
Sunho Kim [Sun, 26 Jun 2022 12:57:05 +0000 (21:57 +0900)]
Revert "[clang-repl] Support destructors of global objects."

This reverts commit 9de8b05bfe0de2915d2443d06159396c5f9d389f.

2 years ago[libc++] Simplify type_traits and use more builtins
Nikolas Klauser [Sun, 26 Jun 2022 12:55:19 +0000 (14:55 +0200)]
[libc++] Simplify type_traits and use more builtins

Reviewed By: ldionne, #libc

Spies: manojgupta, cjdb, ayzhao, alanphipps, libcxx-commits

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

Stuff

2 years ago[ArgumentPromotion] use poison when replacing dead instructions instead of undef...
Nuno Lopes [Sun, 26 Jun 2022 12:44:05 +0000 (13:44 +0100)]
[ArgumentPromotion] use poison when replacing dead instructions instead of undef [NFC]

2 years ago[Support] Work around an issue when building with old versions of libstdc++
Benjamin Kramer [Sun, 26 Jun 2022 10:54:32 +0000 (12:54 +0200)]
[Support] Work around an issue when building with old versions of libstdc++

llvm/lib/Support/UnicodeNameToCodepoint.cpp:189:12: error: chosen constructor is explicit in copy-initialization
    return {N, false, 0};
           ^~~~~~~~~~~~~
/usr/include/c++/5.4.0/tuple:479:19: note: explicit constructor declared here
        constexpr tuple(_UElements&&... __elements)
                  ^

2 years ago[clang-repl] Implement code undo.
Jun Zhang [Sun, 19 Jun 2022 02:39:03 +0000 (10:39 +0800)]
[clang-repl] Implement code undo.

In interactive C++ it is convenient to roll back to a previous state of the
compiler. For example:
clang-repl> int x = 42;
clang-repl> %undo
clang-repl> float x = 24 // not an error

To support this, the patch extends the functionality used to recover from
errors and adds functionality to recover the low-level execution infrastructure.

The current implementation is based on watermarks. It exploits the fact that
at each incremental input the underlying compiler infrastructure is in a valid
state. We can only go N incremental inputs back to a previous valid state. We do
not need and do not do any further dependency tracking.

This patch was co-developed with V. Vassilev, relies on the past work of Purva
Chaudhari in clang-repl and is inspired by the past work on the same feature
in the Cling interpreter.

Co-authored-by: Purva-Chaudhari <purva.chaudhari02@gmail.com>
Co-authored-by: Vassil Vassilev <v.g.vassilev@gmail.com>
Signed-off-by: Jun Zhang <jun@junz.org>
2 years ago[clang-repl] Support destructors of global objects.
Sunho Kim [Sun, 26 Jun 2022 10:02:19 +0000 (19:02 +0900)]
[clang-repl] Support destructors of global objects.

Supports destructors of global objects by properly calling jitdylib deinitialize which calls the global dtors of ir modules.

This supersedes https://reviews.llvm.org/D127945. There was an issue when calling deinitialize on windows but it got fixed by https://reviews.llvm.org/D128037.

Reviewed By: v.g.vassilev

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

2 years agoRevert "[LiveInterval] Simplify. NFC"
Nikita Popov [Sun, 26 Jun 2022 09:37:15 +0000 (11:37 +0200)]
Revert "[LiveInterval] Simplify. NFC"

This reverts commit e733b80f3cba26bf2df9bd691120f37fc1af21ce.

This caused a major compile-time regression:
https://llvm-compile-time-tracker.com/compare.php?from=3b7c3a654c9175f41ac871a937cbcae73dfb3c5d&to=e733b80f3cba26bf2df9bd691120f37fc1af21ce&stat=instructions

About 1% on average, 10% on individual files.

2 years ago[AVR] Fix expanding MOVW for overlapping registers
Patryk Wychowaniec [Sun, 26 Jun 2022 09:20:04 +0000 (17:20 +0800)]
[AVR] Fix expanding MOVW for overlapping registers

When expanding a MOVW (16-bit copy) to two MOVs (8-bit copy), the
lower byte always comes first. This is incorrect for corner cases like
'$r24r23 -> $r25r24', in which the higher byte copy should come first.

Current patch fixes that bug as recorded at
https://github.com/rust-lang/rust/issues/98167

Reviewed By: benshi001

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

2 years ago[ELF] Improve compound assignment tests
Fangrui Song [Sun, 26 Jun 2022 05:30:52 +0000 (22:30 -0700)]
[ELF] Improve compound assignment tests

Also use strchr instead of is_contained.

2 years ago[clang] Don't use Optional::hasValue (NFC)
Kazu Hirata [Sun, 26 Jun 2022 05:26:24 +0000 (22:26 -0700)]
[clang] Don't use Optional::hasValue (NFC)

This patch replaces Optional::hasValue with the implicit cast to bool
in conditionals only.

2 years ago[ELF] Support -= *= /= <<= >>= &= |= in symbol assignments
Fangrui Song [Sun, 26 Jun 2022 05:22:59 +0000 (22:22 -0700)]
[ELF] Support -= *= /= <<= >>= &= |= in symbol assignments

2 years ago[llvm] Don't use Optional::hasValue (NFC)
Kazu Hirata [Sun, 26 Jun 2022 04:42:52 +0000 (21:42 -0700)]
[llvm] Don't use Optional::hasValue (NFC)

This patch replaces Optional::hasValue with the implicit cast to bool
in conditionals only.

2 years ago[ELF] Allow ? without adjacent space
Fangrui Song [Sun, 26 Jun 2022 04:16:59 +0000 (21:16 -0700)]
[ELF] Allow ? without adjacent space

GNU ld allows 1 ? 2?3:4 : 5?6 :7

2 years ago[ELF][test] Improve expression test
Fangrui Song [Sun, 26 Jun 2022 04:11:32 +0000 (21:11 -0700)]
[ELF][test] Improve expression test

2 years ago[ELF] Fix assertion failure when PROVIDE/HIDDEN/PROVIDE_HIDDEN does not have =
Fangrui Song [Sun, 26 Jun 2022 03:26:47 +0000 (20:26 -0700)]
[ELF] Fix assertion failure when PROVIDE/HIDDEN/PROVIDE_HIDDEN does not have =

2 years ago[ELF] Allow an expression to follow = in a symbol assignment
Fangrui Song [Sun, 26 Jun 2022 03:25:34 +0000 (20:25 -0700)]
[ELF] Allow an expression to follow = in a symbol assignment

GNU ld doesn't require whitespace before =. Match it.

2 years ago[gn build] Port 9ed2e68c9ae5
LLVM GN Syncbot [Sun, 26 Jun 2022 02:21:47 +0000 (02:21 +0000)]
[gn build] Port 9ed2e68c9ae5

2 years ago[clang-format] Handle Verilog preprocessor directives
sstwcw [Sun, 26 Jun 2022 01:54:02 +0000 (01:54 +0000)]
[clang-format] Handle Verilog preprocessor directives

Verilog uses the backtick instead of the hash.  In this revision
backticks are lexed manually and then get labeled as hashes so the logic
for handling C preprocessor stuff don't have to change.  Hashes get
labeled as identifiers for Verilog-specific stuff like delays.

Reviewed By: HazardyKnusperkeks

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

2 years ago[clang-format] Parse Verilog if statements
sstwcw [Sun, 26 Jun 2022 01:51:40 +0000 (01:51 +0000)]
[clang-format] Parse Verilog if statements

This patch mainly handles treating `begin` as block openers.

While and for statements will be handled in another patch.

Reviewed By: HazardyKnusperkeks

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

2 years ago[clang-format] Fix whitespace counting stuff
sstwcw [Sun, 26 Jun 2022 01:25:39 +0000 (01:25 +0000)]
[clang-format] Fix whitespace counting stuff

The current way of counting whitespace would count backticks as
whitespace.  For Verilog stuff we need backticks to be handled
correctly.  For JavaScript the current way is to compare the entire
token text to see if it's a backtick.  However, when the backtick is the
first token following an escaped newline, the escaped newline will be
part of the tok::unknown token.  Verilog has macros and escaped newlines
unlike JavaScript.  So we can't regard an entire tok::unknown token as
whitespace.  Previously, the start of every token would be matched for
newlines.  Now, it is all whitespace instead of just newlines.

The column counting problem has already been fixed for JavaScript in
e71b4cbdd140f059667f84464bd0ac0ebc348387 by counting columns elsewhere.

Reviewed By: HazardyKnusperkeks

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

2 years ago[clang-tidy] cppcoreguidelines-virtual-class-destructor: Fix crash when "virtual...
Joachim Priesner [Fri, 24 Jun 2022 17:01:35 +0000 (11:01 -0600)]
[clang-tidy] cppcoreguidelines-virtual-class-destructor: Fix crash when "virtual" keyword is expanded from a macro

Check llvm::Optional before dereferencing it.

Compute VirtualEndLoc differently to avoid an assertion failure
in clang::SourceManager::getFileIDLoaded:

Assertion `0 && "Invalid SLocOffset or bad function choice"' failed

2 years ago[ELF] Fix precedence of ? when there are 2 or more operators on the left hand side
Fangrui Song [Sat, 25 Jun 2022 20:48:52 +0000 (13:48 -0700)]
[ELF] Fix precedence of ? when there are 2 or more operators on the left hand side

For 1 != 1 <= 1 ? 1 : 2, the current code incorrectly considers that ?
has a higher precedence than != (minPrec).

Also, add a test for right associativity.

2 years ago[ELF] Fix precedence of == and != in expressions
Fangrui Song [Sat, 25 Jun 2022 20:47:32 +0000 (13:47 -0700)]
[ELF] Fix precedence of == and != in expressions

In GNU ld, the == and != operators have lower precedence than < > <= >=.
This behavior matches C.

2 years ago[RISCV] Merge more rv32/rv64 vector intrinsic tests that contain the same content.
Craig Topper [Sat, 25 Jun 2022 19:19:40 +0000 (12:19 -0700)]
[RISCV] Merge more rv32/rv64 vector intrinsic tests that contain the same content.

2 years ago[flang] Restore Optional::value() (NFC)
Kazu Hirata [Sat, 25 Jun 2022 20:21:34 +0000 (13:21 -0700)]
[flang] Restore Optional::value() (NFC)

This patch restores several calls to Optional::value() in preference
to Optional::operator*.

The Flang C++ Style Guide tells us to use x.value() where no presence
test is obviously protecting a *x reference to the contents.

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

2 years ago[Driver][Minix] -r: imply -nostdlib like GCC
Brad Smith [Sat, 25 Jun 2022 20:16:38 +0000 (16:16 -0400)]
[Driver][Minix] -r: imply -nostdlib like GCC

Similar to D116843 for Gnu.cpp

Reviewed By: MaskRay

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

2 years agoRevert "[libc++] Simplify type_traits and use more builtins"
Manoj Gupta [Sat, 25 Jun 2022 16:51:00 +0000 (09:51 -0700)]
Revert "[libc++] Simplify type_traits and use more builtins"

This reverts commit 42f8f557989741434d7b7b4439b3eef3e68b2ab5.

Breaks float128 usage, test case provided in D127226.

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

2 years ago[ELF] Support quoted name in the TARGET command
Fangrui Song [Sat, 25 Jun 2022 19:31:20 +0000 (12:31 -0700)]
[ELF] Support quoted name in the TARGET command

2 years ago[ELF] Support quoted symbol in the ENTRY command
Fangrui Song [Sat, 25 Jun 2022 19:19:45 +0000 (12:19 -0700)]
[ELF] Support quoted symbol in the ENTRY command

This matches GNU ld and matches other places we unquote the symbol name.

Fixes #56208

2 years ago[ELF][test] Improve linkerscript/entry.s
Fangrui Song [Sat, 25 Jun 2022 19:14:47 +0000 (12:14 -0700)]
[ELF][test] Improve linkerscript/entry.s

2 years agoFix build after ab736a27
Philip Reames [Sat, 25 Jun 2022 19:09:25 +0000 (12:09 -0700)]
Fix build after ab736a27

This class is templatized by the concrete subclass - not all subclasses have a data layout field called DL.

2 years ago[LiveInterval] Simplify. NFC
Fangrui Song [Sat, 25 Jun 2022 18:59:33 +0000 (11:59 -0700)]
[LiveInterval] Simplify. NFC

2 years agoRevert "Don't use Optional::hasValue (NFC)"
Kazu Hirata [Sat, 25 Jun 2022 18:56:50 +0000 (11:56 -0700)]
Revert "Don't use Optional::hasValue (NFC)"

This reverts commit aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.

2 years agoDon't use Optional::hasValue (NFC)
Kazu Hirata [Sat, 25 Jun 2022 18:55:57 +0000 (11:55 -0700)]
Don't use Optional::hasValue (NFC)

2 years ago[clang, clang-tools-extra] Don't use Optional::{hasValue,getValue} (NFC)
Kazu Hirata [Sat, 25 Jun 2022 18:55:33 +0000 (11:55 -0700)]
[clang, clang-tools-extra] Don't use Optional::{hasValue,getValue} (NFC)

2 years ago[ORC][LLJIT] Define atexit symbol in GenericLLVMIRPlatformSupport.
Sunho Kim [Sat, 25 Jun 2022 18:49:05 +0000 (03:49 +0900)]
[ORC][LLJIT] Define atexit symbol in GenericLLVMIRPlatformSupport.

Define atexit symbol in GenericLLVMIRPlatformSupport so that it doesn't need to be defined by user.

On windows, llvm codegen emits atexit runtime calls to support global deinitializers as there is no lower function like cxa_atexit as in Itanium C++ ABI. ORC JIT user had to define custom atexit symbol manually. This was a hassle as it has to deal with dso_handle and cxa_atexit internals of LLJIT. If client didn't provide atexit definition, the default behaviour is just linking with host atexit function which is destined to fail as it calls dtors when the host program exits. This is after jit instances and buffers are freed, so users would see weird access violation exception from the uknown location. (in console application, the debugger thinks exception happened in scrt_common_main_seh)

This is a hack that has some caveats. (e.g. memory address is not identical) But, it's better than the situation described in the above. Ultimately, we will move on to ORC runtime that is able to solve the memory address issue properly.

Reviewed By: sgraenitz

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

2 years ago[RISCV] Implement getVScaleForTuning and thus prefer scalable vectorization when...
Philip Reames [Sat, 25 Jun 2022 18:18:40 +0000 (11:18 -0700)]
[RISCV] Implement getVScaleForTuning and thus prefer scalable vectorization when enabled

LoopVectorizer uses getVScaleForTuning for deciding how to discount the cost of a potential vector factor by the amount of work performed. Without the callback implemented, the vectorizer was defaulting to an estimated vscale of 1. This results in fixed vectorization looking falsely profitable (since it used the command line VLEN).

The test change is pretty limited since a) we don't have much coverage of the vectorizer with scalable vectors at all, and b) what little coverage we have mostly uses i64 element types. There's a separate issue with <vscale x 1 x i64> which prevents us from getting to this stage of costing, and thus only the one test explicitly written to avoid that is visible in the diff. However, this is actually a very wide impact change as it changes the practical vectorization result when both fixed and scalable is enabled to scalable.

As an aside, I think the vectorizer is at little too strongly biased towards scalable when both are legal, but we can explore that separately. For now, let's just get the cost model working the way it was intended.

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

2 years ago[llvm] Don't use Optional::{hasValue,getValue} (NFC)
Kazu Hirata [Sat, 25 Jun 2022 18:24:23 +0000 (11:24 -0700)]
[llvm] Don't use Optional::{hasValue,getValue} (NFC)

2 years ago[BasicTTI] Account for vector of pointers in getMemoryOpCost
Philip Reames [Sat, 25 Jun 2022 18:11:58 +0000 (11:11 -0700)]
[BasicTTI] Account for vector of pointers in getMemoryOpCost

By using getPrimitiveSizeInBits, we were getting 0 for every pointer type. This code is trying to account for the cost of truncating a store or extending a load to convert from the source vector element type to the legal vector element type.

I'd originally seen this as a crash when trying to scalarize a <vscale x 1 x ptr> type coming from the vectorizer. Here's a minimum reproducer to exercise the code in question.

void e(int *argv[], int *p) {
  for (int i = 0; i < 1024; i++)
    argv[i] = p;
}

This was checked in as the splat_ptr test in 2cf320d. After bbf3fd, this no longer crashes since we correctly return invalid if the extending load/truncating store isn't legal.

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

2 years ago[RISCV] Make getMinRVVVectorSizeInBits and getMaxRVVVectorSizeInBits protected [nfc]
Philip Reames [Fri, 24 Jun 2022 23:59:46 +0000 (16:59 -0700)]
[RISCV] Make getMinRVVVectorSizeInBits and getMaxRVVVectorSizeInBits protected [nfc]

These are now only used in the implementation of getRealMinVLen and getRealMaxVLEn, and useRVVForFixedLengthVectors; make them protected to discourage new users.

2 years ago[libcxx][test] MaybePOCCAAllocator should meet the Cpp17Allocator requirements
Casey Carter [Fri, 7 Jan 2022 02:45:28 +0000 (18:45 -0800)]
[libcxx][test] MaybePOCCAAllocator should meet the Cpp17Allocator requirements

Implement `rebind`, the rebinding constructor, and rebind-compatible comparison operators.

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

2 years ago[NFC] Remove dead code
Guillaume Chatelet [Sat, 25 Jun 2022 17:18:29 +0000 (17:18 +0000)]
[NFC] Remove dead code

2 years ago[gn build] Port c92056d03881
LLVM GN Syncbot [Sat, 25 Jun 2022 17:03:46 +0000 (17:03 +0000)]
[gn build] Port c92056d03881

2 years ago[Clang][C++23] P2071 Named universal character escapes
Corentin Jabot [Mon, 4 Apr 2022 10:41:12 +0000 (12:41 +0200)]
[Clang][C++23] P2071 Named universal character escapes

Implements [[ https://wg21.link/p2071r1  | P2071 Named Universal Character Escapes ]] - as an extension in all language mode, the patch  not warn in c++23 mode will be done later once this paper is plenary approved (in July).

We add

 * A code generator that transforms `UnicodeData.txt` and `NameAliases.txt` to a space efficient data structure that can be queried in `O(NameLength)`
 * A set of functions in `Unicode.h` to query that data, including

   * A function to find an exact match of a given Unicode character name
   * A function to perform a loose (ignoring case, space, underscore, medial hyphen) matching
   * A function returning the best matching codepoint for a given string per edit distance

 * Support of `\N{}` escape sequences in String and character Literals, with loose and typos diagnostics/fixits
 * Support of `\N{}` as UCN with loose matching diagnostics/fixits.

Loose matching is considered an error to match closely the semantics of P2071.

The generated data contributes to 280kB of data to the binaries.

`UnicodeData.txt` and `NameAliases.txt`  are not committed to the repository in this patch, and regenerating the data is a manual process.

Reviewed By: tahonermann

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

2 years ago[mlir] Fix a warning
Kazu Hirata [Sat, 25 Jun 2022 16:18:04 +0000 (09:18 -0700)]
[mlir] Fix a warning

This patch fixes:

  llvm-project/mlir/lib/Dialect/Linalg/Transforms/SplitReduction.cpp:300:26:
  error: comparison of integers of different signs: 'int64_t' (aka
  'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]

2 years ago[mlir][shape] Switch types to ODS generated (NFC)
Jacques Pienaar [Sat, 25 Jun 2022 16:06:52 +0000 (09:06 -0700)]
[mlir][shape] Switch types to ODS generated (NFC)

These were already pretty simple, so just switching to generated.

2 years agoGlobalISel: Make LoadStoreOpt preserve all
Matt Arsenault [Fri, 24 Jun 2022 23:03:57 +0000 (19:03 -0400)]
GlobalISel: Make LoadStoreOpt preserve all

Avoids dropping CSE info analysis

2 years agoX86: Regenerate test checks
Matt Arsenault [Fri, 24 Jun 2022 15:57:04 +0000 (11:57 -0400)]
X86: Regenerate test checks

2 years agoCodeGen: Use else if between Value and PseudoSourceValue cases
Matt Arsenault [Fri, 24 Jun 2022 01:55:42 +0000 (21:55 -0400)]
CodeGen: Use else if between Value and PseudoSourceValue cases

These are mutually exclusive.

2 years ago[MLIR][Presburger] Support computing a representation of a set that only has locals...
Arjun P [Tue, 21 Jun 2022 04:30:11 +0000 (06:30 +0200)]
[MLIR][Presburger] Support computing a representation of a set that only has locals that are divs

This paves the way for integer-exact projection, and for supporting
non-division locals in subtraction, complement, and equality checks.

Reviewed By: Groverkss

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

2 years agoReland "[lldb] [llgs] Support multiprocess in qfThreadInfo"
Michał Górny [Sat, 25 Jun 2022 13:04:26 +0000 (15:04 +0200)]
Reland "[lldb] [llgs] Support multiprocess in qfThreadInfo"

Now preserving the non-standard behavior of returning "OK" response
when there is no debugged process.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128152

2 years ago[clang-format] NFC Sort names of format token types
sstwcw [Sat, 25 Jun 2022 08:35:51 +0000 (08:35 +0000)]
[clang-format] NFC Sort names of format token types

Suggested by HazardyKnusperkeks in D126845.

Reviewed By: HazardyKnusperkeks, owenpan

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

2 years ago[asan][test] XFAIL global-location-nodebug.cpp on Solaris
Rainer Orth [Sat, 25 Jun 2022 08:40:11 +0000 (10:40 +0200)]
[asan][test] XFAIL global-location-nodebug.cpp on Solaris

A new test `FAIL`s on Solaris:

  FAIL: AddressSanitizer-i386-sunos ::
TestCases/global-location-nodebug.cpp (465 of 64279)
  FAIL: AddressSanitizer-i386-sunos-dynamic ::
TestCases/global-location-nodebug.cpp (961 of 64279)

The problem is the unconditional use of `-Wl,-S`:

  ld: fatal: dlopen() of support library (-lstdc++) failed with error:
ld.so.1: ld: -lstdc++: open failed: No such file or directory

`ld -S` has a completely different semantics compared to GNU `ld
-S`/`--strip-debug`: specify a link-edit support library.  To avoid this,
I've chosen to `XFAIL` the test.

Tested on `amd64-pc-solaris2.11`.

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

2 years agoRevert "[lldb] [llgs] Support multiprocess in qfThreadInfo"
Michał Górny [Sat, 25 Jun 2022 07:39:25 +0000 (09:39 +0200)]
Revert "[lldb] [llgs] Support multiprocess in qfThreadInfo"

This reverts part of commit 75757c86c695a6b4695458343637b3c4fe86def6.
It broke the following test:

  commands/target/auto-install-main-executable/TestAutoInstallMainExecutable.py

I need more time to figure it out, so I'm reverting the code changes
and marking the tests depending on them xfail.

2 years ago[DeadArgElim] Replace insert with emplace (NFC)
Pavel Samolysov [Sat, 25 Jun 2022 07:31:27 +0000 (10:31 +0300)]
[DeadArgElim] Replace insert with emplace (NFC)

2 years ago[flang] Use descriptors for real/complex input other than kinds 4 and 8
Valentin Clement [Sat, 25 Jun 2022 07:18:59 +0000 (09:18 +0200)]
[flang] Use descriptors for real/complex input other than kinds 4 and 8

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

Reviewed By: PeteSteinfeld, vdonaldson

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2 years ago[libc] Add compound assignment and pre-increment operators to UInt.
Siva Chandra Reddy [Sat, 25 Jun 2022 06:38:03 +0000 (06:38 +0000)]
[libc] Add compound assignment and pre-increment operators to UInt.

2 years ago[Driver] Fix -fstrict-flex-arrays= help message after D126864
Fangrui Song [Sat, 25 Jun 2022 05:20:37 +0000 (22:20 -0700)]
[Driver] Fix -fstrict-flex-arrays= help message after D126864

2 years ago[clang] Add back -fsanitize=array-bounds workaround for size-1 array after -fstrict...
Fangrui Song [Sat, 25 Jun 2022 05:15:47 +0000 (22:15 -0700)]
[clang] Add back -fsanitize=array-bounds workaround for size-1 array after -fstrict-flex-arrays change

Before C99 introduced flexible array member, common practice uses size-1 array
to emulate FAM, e.g. https://github.com/python/cpython/issues/94250
As a result, -fsanitize=array-bounds instrumentation skipped such structures
as a workaround (from 539e4a77bbabbc19f22b2bd24e04af2e432e599d).

D126864 accidentally dropped the workaround. Add it back with tests.

2 years ago[libc][Obvious] Compare values of the same type in memory_utils/backend_test.
Siva Chandra Reddy [Sat, 25 Jun 2022 04:50:04 +0000 (04:50 +0000)]
[libc][Obvious] Compare values of the same type in memory_utils/backend_test.

2 years ago[libc][Obvious] Fix incorrect nested namespace name.
Siva Chandra Reddy [Sat, 25 Jun 2022 04:47:21 +0000 (04:47 +0000)]
[libc][Obvious] Fix incorrect nested namespace name.

2 years ago[libc] Add a cacheline size of arm target.
Siva Chandra Reddy [Fri, 24 Jun 2022 18:08:18 +0000 (18:08 +0000)]
[libc] Add a cacheline size of arm target.

It is set arbitrarily at 32 now. It can be adjusted as required in
future.

2 years agoRevert "[CMake][compiler-rt] Clean up the use of libcxx and libcxxabi"
Petr Hosek [Sat, 25 Jun 2022 03:10:55 +0000 (03:10 +0000)]
Revert "[CMake][compiler-rt] Clean up the use of libcxx and libcxxabi"

This reverts commit 4164cfa537e545f8ea9bc4f3c8b913867a7ac79d since
it broke the clang-x86_64-debian-fast builder:

  https://lab.llvm.org/buildbot/#/builders/109/builds/41339

2 years ago[CMake][compiler-rt] Clean up the use of libcxx and libcxxabi
Petr Hosek [Thu, 2 Jun 2022 18:45:26 +0000 (18:45 +0000)]
[CMake][compiler-rt] Clean up the use of libcxx and libcxxabi

We no longer support the use of LLVM_ENABLE_PROJECTS for libcxx and
libcxxabi. We don't use paths to libcxx and libcxxabi in compiler-rt.

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

2 years ago[RISCV][MC] Fold UIMM related code
Shao-Ce SUN [Fri, 24 Jun 2022 09:36:38 +0000 (17:36 +0800)]
[RISCV][MC] Fold UIMM related code

Reviewed By: craig.topper

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

2 years ago[clang-format] Further improve requires clause detection
Björn Schäpers [Fri, 24 Jun 2022 06:02:35 +0000 (08:02 +0200)]
[clang-format] Further improve requires clause detection

If there is a typeish token before the requires, it can't be a requires
expression.

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

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

2 years ago[CMake] Use set rather than list PREPEND
Petr Hosek [Sat, 25 Jun 2022 02:18:51 +0000 (02:18 +0000)]
[CMake] Use set rather than list PREPEND

list PREPEND is only supported since CMake 3.15.

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

2 years ago[MCA][unittest] Hot fix for -Wpessimizing-move on test harness
Min-Yih Hsu [Sat, 25 Jun 2022 01:31:27 +0000 (18:31 -0700)]
[MCA][unittest] Hot fix for -Wpessimizing-move on test harness

Hot fix for -Wpessimizing-move build errors regarding MCA unit test
harness introduced in 97579dcc6d3cd129c75b0502f7c43a18292d44b1.

2 years ago[lldb] Add support for specifying a log handler
Jonas Devlieghere [Fri, 24 Jun 2022 19:53:10 +0000 (12:53 -0700)]
[lldb] Add support for specifying a log handler

This patch adds a new flag to `log enable`, allowing the user to specify
a custom log handler. In addition to the default (stream) handler, this
allows using the circular log handler (which logs to a fixed size,
in-memory circular buffer) as well as the system log handler (which logs
to the operating system log).

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

2 years ago[MLInliner] No need to invalidate everything post-inlining.
Mircea Trofin [Sat, 25 Jun 2022 01:19:34 +0000 (18:19 -0700)]
[MLInliner] No need to invalidate everything post-inlining.

We really just need to invalidate loop info and the dominator tree, in
addition to the FunctionPropertiesInfo we were invalidating originally.
Doing more adds unnecessary compile time overhead.

2 years ago[gn build] Port b847692ed8e1
LLVM GN Syncbot [Sat, 25 Jun 2022 01:03:12 +0000 (01:03 +0000)]
[gn build] Port b847692ed8e1

2 years ago[gn build] (manually) port 97579dcc6d3 (LLVMMCATests)
Nico Weber [Sat, 25 Jun 2022 01:00:16 +0000 (21:00 -0400)]
[gn build] (manually) port 97579dcc6d3 (LLVMMCATests)

The CMake code makes a number of imho strange choices. I pointed those
out on https://reviews.llvm.org/D127083.

The GN build mirrors the CMake build's choices for now.