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
Nuno Lopes [Sun, 26 Jun 2022 12:44:05 +0000 (13:44 +0100)]
[ArgumentPromotion] use poison when replacing dead instructions instead of undef [NFC]
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)
^
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>
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
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.
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
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.
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.
Fangrui Song [Sun, 26 Jun 2022 05:22:59 +0000 (22:22 -0700)]
[ELF] Support -= *= /= <<= >>= &= |= in symbol assignments
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.
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
Fangrui Song [Sun, 26 Jun 2022 04:11:32 +0000 (21:11 -0700)]
[ELF][test] Improve expression test
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 =
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.
LLVM GN Syncbot [Sun, 26 Jun 2022 02:21:47 +0000 (02:21 +0000)]
[gn build] Port
9ed2e68c9ae5
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
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
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
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
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.
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.
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.
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
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
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
Fangrui Song [Sat, 25 Jun 2022 19:31:20 +0000 (12:31 -0700)]
[ELF] Support quoted name in the TARGET 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
Fangrui Song [Sat, 25 Jun 2022 19:14:47 +0000 (12:14 -0700)]
[ELF][test] Improve linkerscript/entry.s
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.
Fangrui Song [Sat, 25 Jun 2022 18:59:33 +0000 (11:59 -0700)]
[LiveInterval] Simplify. 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.
Kazu Hirata [Sat, 25 Jun 2022 18:55:57 +0000 (11:55 -0700)]
Don't use Optional::hasValue (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)
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
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
Kazu Hirata [Sat, 25 Jun 2022 18:24:23 +0000 (11:24 -0700)]
[llvm] Don't use Optional::{hasValue,getValue} (NFC)
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
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.
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
Guillaume Chatelet [Sat, 25 Jun 2022 17:18:29 +0000 (17:18 +0000)]
[NFC] Remove dead code
LLVM GN Syncbot [Sat, 25 Jun 2022 17:03:46 +0000 (17:03 +0000)]
[gn build] Port
c92056d03881
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
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]
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.
Matt Arsenault [Fri, 24 Jun 2022 23:03:57 +0000 (19:03 -0400)]
GlobalISel: Make LoadStoreOpt preserve all
Avoids dropping CSE info analysis
Matt Arsenault [Fri, 24 Jun 2022 15:57:04 +0000 (11:57 -0400)]
X86: Regenerate test checks
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.
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
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
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
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
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.
Pavel Samolysov [Sat, 25 Jun 2022 07:31:27 +0000 (10:31 +0300)]
[DeadArgElim] Replace insert with emplace (NFC)
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>
Siva Chandra Reddy [Sat, 25 Jun 2022 06:38:03 +0000 (06:38 +0000)]
[libc] Add compound assignment and pre-increment operators to UInt.
Fangrui Song [Sat, 25 Jun 2022 05:20:37 +0000 (22:20 -0700)]
[Driver] Fix -fstrict-flex-arrays= help message after D126864
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.
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.
Siva Chandra Reddy [Sat, 25 Jun 2022 04:47:21 +0000 (04:47 +0000)]
[libc][Obvious] Fix incorrect nested namespace name.
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.
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
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
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
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
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
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.
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
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.
LLVM GN Syncbot [Sat, 25 Jun 2022 01:03:12 +0000 (01:03 +0000)]
[gn build] Port
b847692ed8e1
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.
lewuathe [Fri, 24 Jun 2022 23:59:13 +0000 (08:59 +0900)]
[mlir][affine] Rigorous check for loop unrolling store operation
Static loop unrolling does not change the operation type. We can rigorously make sure to use affine.store in the check.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D128237
Fabian Parzefall [Sat, 25 Jun 2022 00:00:20 +0000 (17:00 -0700)]
[BOLT] Mark option values of --split-functions deprecated
The SplitFunctions pass does not distinguish between various splitting
modes anymore. This change updates the command line interface to
reflect this behavior by deprecating values passed to the
--split-function option.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D128558
lewuathe [Fri, 24 Jun 2022 23:27:38 +0000 (08:27 +0900)]
[mlir][quant] output spec verification check for quant.region
We can have validation test for quant.region having incompatible output spec.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D128245
Philip Reames [Fri, 24 Jun 2022 23:48:21 +0000 (16:48 -0700)]
[RISCV] Implement RISCVTTIImpl::getMaxVScale correctly
The comments in the existing code appear to pre-exist the standardization of the +v extension. In particular, the specification *does* provide a bound on the maximum value VLEN can take. From what I can tell, the LMUL comment was simply a misunderstanding of what this API returns.
This API returns the maximum value that vscale can take at runtime. This is used in the vectorizer to bound the largest scalable VF (e.g. LMUL in RISCV terms) which can be used without violating memory dependence.
Differential Revision: https://reviews.llvm.org/D128538
Kirill Okhotnikov [Fri, 24 Jun 2022 23:39:32 +0000 (01:39 +0200)]
[libc][math] Fix broken compilation due to __builtin_inf/nan functions.
Min-Yih Hsu [Fri, 24 Jun 2022 23:10:27 +0000 (16:10 -0700)]
[MCA] Hot fix for -Wmismatched-tags errors on mca::SourceMgr
Hot fix for -Wmismatched-tags build errors regarding mca::SourceMgr
changes introduced in
97579dcc6d3cd129c75b0502f7c43a18292d44b1.
Min-Yih Hsu [Sun, 5 Jun 2022 19:06:01 +0000 (12:06 -0700)]
[MCA] Allow mca::Instruction-s to be recycled and reused
This patch introduces a new feature that allows InstrBuilder to reuse
mca::Instruction recycled from IncrementalSourceMgr. This significantly
reduces the memory footprint.
Note that we're only recycling instructions that have static InstrDesc
and no variadic operands.
Differential Revision: https://reviews.llvm.org/D127084
Min-Yih Hsu [Mon, 30 May 2022 23:50:09 +0000 (16:50 -0700)]
[MCA] Introducing incremental SourceMgr and resumable pipeline
The new resumable mca::Pipeline capability introduced in this patch
allows users to save the current state of pipeline and resume from the
very checkpoint.
It is better (but not require) to use with the new IncrementalSourceMgr,
where users can add mca::Instruction incrementally rather than having a
fixed number of instructions ahead-of-time.
Note that we're using unit tests to test these new features. Because
integrating them into the `llvm-mca` tool will make too many churns.
Differential Revision: https://reviews.llvm.org/D127083
Petr Hosek [Fri, 24 Jun 2022 18:52:35 +0000 (18:52 +0000)]
[CMake][compiler-rt] Treat target cflags as list rather than string
This is need after
30dfe016d4259398689dc1be163e0ecc804b5feb.
Differential Revision: https://reviews.llvm.org/D128548
Wei Yi Tee [Fri, 24 Jun 2022 22:06:30 +0000 (00:06 +0200)]
[clang][dataflow] Implement functionality to compare if two boolean values are equivalent.
`equivalentBoolValues` compares equivalence between two booleans. The current implementation does not consider constraints imposed by flow conditions on the booleans and its subvalues.
Depends On D128520
Reviewed By: gribozavr2, xazax.hun
Differential Revision: https://reviews.llvm.org/D128521
Wei Yi Tee [Fri, 24 Jun 2022 22:02:13 +0000 (00:02 +0200)]
[clang][dataflow] Refactor function that queries the solver for satisfiability checking.
Given a set of `Constraints`, `querySolver` adds common background information across queries (`TrueVal` is always true and `FalseVal` is always false) and passes the query to the solver.
`checkUnsatisfiable` is a simple wrapper around `querySolver` for checking that the solver returns an unsatisfiable result.
Depends On D128519
Reviewed By: gribozavr2, xazax.hun
Differential Revision: https://reviews.llvm.org/D128520
Kirill Okhotnikov [Fri, 24 Jun 2022 21:59:26 +0000 (23:59 +0200)]
[libc][math] Fix broken aarch64 due to clz refactoring.
Mitch Phillips [Fri, 24 Jun 2022 21:49:37 +0000 (14:49 -0700)]
fix-forward hwasan-globals.cpp (round 2)
Just force the aarch64 target compilation (after making sure the test
only runs if that target is available).
Because global metadata isn't target-specific, just selecting a target
here is fine.
Should fix https://reviews.llvm.org/D127544#3609312
Mitch Phillips [Fri, 24 Jun 2022 21:31:45 +0000 (14:31 -0700)]
Don't run hwasan-globals.cpp test on non-x86/aarch64
Fix-forward for https://reviews.llvm.org/D127544#3609312
IR pass has some target-specific inline asm lowering that check-fails
for non-x86 non-aarch64 targets.
For now, just run these tests only on those targets.
Xing Xue [Fri, 24 Jun 2022 21:25:15 +0000 (17:25 -0400)]
[libc++][AIX] Make basic_string layout compatible with earlier version
Summary:
Patch D123580 changed to use bit fields for strings in long and short mode. As a result, this changes the layout of these strings on AIX because bit fields on AIX are 4 bytes, which breaks the ABI compatibility with earlier strings before the change on AIX. This patch uses the attribute 'packed' and anonymous structure to make string layout compatible. This patch will also make test cases alignof.compile.pass.cpp and sizeof.compile.pass.cpp introduced in D127672 pass on AIX.
Reviewed by: philnik, Mordante, hubert.reinterpretcast, libc++
Differential Revision: https://reviews.llvm.org/D128285
Wei Yi Tee [Fri, 24 Jun 2022 19:59:16 +0000 (21:59 +0200)]
[clang][dataflow] Move logic for creating implication and iff expressions into `DataflowAnalysisContext` from `DataflowEnvironment`.
To keep functionality of creating boolean expressions in a consistent location.
Depends On D128357
Reviewed By: gribozavr2, sgatev, xazax.hun
Differential Revision: https://reviews.llvm.org/D128519
Kirill Okhotnikov [Mon, 6 Jun 2022 08:10:24 +0000 (10:10 +0200)]
[libc][math] fmod/fmodf implementation.
This is a implementation of find remainder fmod function from standard libm.
The underline algorithm is developed by myself, but probably it was first
invented before.
Some features of the implementation:
1. The code is written on more-or-less modern C++.
2. One general implementation for both float and double precision numbers.
3. Spitted platform/architecture dependent and independent code and tests.
4. Tests covers 100% of the code for both float and double numbers. Tests cases with NaN/Inf etc is copied from glibc.
5. The new implementation in general 2-4 times faster for “regular” x,y values. It can be 20 times faster for x/y huge value, but can also be 2 times slower for double denormalized range (according to perf tests provided).
6. Two different implementation of division loop are provided. In some platforms division can be very time consuming operation. Depend on platform it can be 3-10 times slower than multiplication.
Performance tests:
The test is based on core-math project (https://gitlab.inria.fr/core-math/core-math). By Tue Ly suggestion I took hypot function and use it as template for fmod. Preserving all test cases.
`./check.sh <--special|--worst> fmodf` passed.
`CORE_MATH_PERF_MODE=rdtsc ./perf.sh fmodf` results are
```
GNU libc version: 2.35
GNU libc release: stable
21.166 <-- FPU
51.031 <-- current glibc
37.659 <-- this fmod version.
```
Fangrui Song [Fri, 24 Jun 2022 20:52:27 +0000 (13:52 -0700)]
Revert "[Driver][test] Replace ^//$ with empty string"
This reverts commit
4817b7729a1846b709ec02b98bfe11b0125f8e8f.
It caused some `^/\n` and had some objection about its readability improvement.
Philip Reames [Fri, 24 Jun 2022 20:08:39 +0000 (13:08 -0700)]
[RISCV] Simplify 16 bit index handling in lowerVECTOR_REVERSE [nfc]
getRealMaxVLen returns an upper bound on the value of VLEN. We can use this upper bound (which unless explicitly set at command line is going to result in a e8 MaxVLMax of much greater than 256) instead of explicitly handling the unknown case separately from the bounded by number greater than 256 case.
Note as well that this code already implicitly depends on a capped value for VLEN. If infinite VLEN were possible, than 16 bit indices wouldn't be enough.
Philip Reames [Fri, 24 Jun 2022 19:59:06 +0000 (12:59 -0700)]
[RISCV] Replace two calls to getMinRVVVectorSizeInBits in fixed length lowering [nfc]
Both of these are only reached if useRVVForFixedLengthVectors is true. Given that, we know that getRealMinVLen() == getMinRVVVectorSizeInBits().
Wei Yi Tee [Fri, 24 Jun 2022 19:39:23 +0000 (21:39 +0200)]
[clang][dataflow] Store flow condition constraints in a single `FlowConditionConstraints` map.
A flow condition is represented with an atomic boolean token, and it is bound to a set of constraints: `(FC <=> C1 ^ C2 ^ ...)`. \
This was internally represented as `(FC v !C1 v !C2 v ...) ^ (C1 v !FC) ^ (C2 v !FC) ^ ...` and tracked by 2 maps:
- `FlowConditionFirstConjunct` stores the first conjunct `(FC v !C1 v !C2 v ...)`
- `FlowConditionRemainingConjuncts` stores the remaining conjuncts `(C1 v !FC) ^ (C2 v !FC) ^ ...`
This patch simplifies the tracking of the constraints by using a single `FlowConditionConstraints` map which stores `(C1 ^ C2 ^ ...)`, eliminating the use of two maps.
Reviewed By: gribozavr2, sgatev, xazax.hun
Differential Revision: https://reviews.llvm.org/D128357
Alexander Yermolovich [Fri, 24 Jun 2022 19:37:01 +0000 (12:37 -0700)]
[BOLT][DWARF] Add support for DW_AT_call_pc/DW_AT_call_return_pc
DWARF 5 added two new attributes DW_AT_call_pc and DW_AT_call_return_pc.
Adding support for them.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D128526
Thomas Raoux [Fri, 24 Jun 2022 19:11:36 +0000 (19:11 +0000)]
[mlir][vector] Fix bug when swapping scf.for and vector warp op
When creating a scf.for without argument a scf.yield is automatically
created. Make sure we don't create a second one.
Differential Revision: https://reviews.llvm.org/D128405
Philip Reames [Fri, 24 Jun 2022 19:03:33 +0000 (12:03 -0700)]
[RISCV] Replace two calls to getMinRVVVectorSizeInBits with getRealMinVLen [nfc]
This doesn't change behavior, it just makes it slightly more obvious what's
going on. Note that getRealMinVLen is always >= getMinRVVVectorSizeInBits.
The first case is a bit tricky, as you have to know that
getMinRVVVectorSizeInBits returns 0 when not set, and thus is equivalent
to the else value clause. The new code structure makes it more obvious we
return 0 unless using RVV for fixed length vectors.
Valentin Clement [Fri, 24 Jun 2022 19:06:05 +0000 (21:06 +0200)]
[flang][OpenACC] Lower parallel loop
Lower the `parallel loop` contrsuct and refactor some of the code
of parallel and loop lowering to be reused.
Also add tests for loop and parallel since they were not upstreamed.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D128510
Valentin Clement [Fri, 24 Jun 2022 19:04:24 +0000 (21:04 +0200)]
[flang][lowering] handle MERGE with different FSOURCE and TSOURCE types
In merge FSOURCE and TSOURCE must have the same Fortran dynamic types,
but this does not imply that FSOURCE and TSOURCE will be lowered to the
same MLIR types. For instance, TSOURCE may be a character expression
with a compile type constant length (!fir.char<1,4>) while FSOURCE may
have dynamic length (!fir.char<1,?>).
Cast FSOURCE to TSOURCE MLIR types to handle these cases.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D128507
Co-authored-by: Jean Perier <jperier@nvidia.com>
Mitch Phillips [Fri, 24 Jun 2022 17:48:18 +0000 (10:48 -0700)]
Add no_sanitize('hwaddress') (and 'memtag', but that's a no-op).
Currently, `__attribute__((no_sanitize('hwaddress')))` is not possible. Add this piece of plumbing, and now that we properly support copying attributes between an old and a new global variable, add a regression test for the GlobalOpt bug that previously lost the attribute.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D127544
Mitch Phillips [Fri, 24 Jun 2022 17:47:34 +0000 (10:47 -0700)]
[HWASan] Use new IR attribute for communicating unsanitized globals.
Globals that shouldn't be sanitized are currently communicated to HWASan
through the use of the llvm.asan.globals IR metadata. Now that we have
an on-GV attribute, use it.
Reviewed By: pcc
Differential Revision: https://reviews.llvm.org/D127543
Valentin Clement [Fri, 24 Jun 2022 19:03:00 +0000 (21:03 +0200)]
[flang] Explicitly map host associated symbols
Explicitly map host associated symbols in DoConcurrent with shared
locality-spec, clauses in OpenMP/OpenACC. The mapping of host-assoc
symbols is set to their parent SymbolBox. This is achieved through
a new interface function in the AbstractConverter.
This was already upstream for OpenMP.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D128518
Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>