Craig Topper [Mon, 25 Apr 2022 18:03:19 +0000 (11:03 -0700)]
[RISCV] Pre-commit test for D122769. NFC
Zequan Wu [Mon, 25 Apr 2022 23:06:52 +0000 (16:06 -0700)]
[LLDB][NativePDB] Fix incorrect file index of inlinees introduced by
f00cd23caed5f920495bcae2055f4c478d8383d6
Eric Schweitz [Mon, 25 Apr 2022 19:13:54 +0000 (12:13 -0700)]
[NFC] Cleanup code to get back in synch for upstreaming.
Differential Revision: https://reviews.llvm.org/D124410
Chris Bieneman [Thu, 14 Apr 2022 18:40:26 +0000 (13:40 -0500)]
Add PointerType analysis for DirectX backend
As implemented this patch assumes that Typed pointer support remains in
the llvm::PointerType class, however this could be modified to use a
different subclass of llvm::Type that could be disallowed from use in
other contexts.
This does not rely on inserting typed pointers into the Module, it just
uses the llvm::PointerType class to track and unique types.
Fixes #54918
Reviewed By: kuhar
Differential Revision: https://reviews.llvm.org/D122268
Jeremy Morse [Mon, 25 Apr 2022 22:30:15 +0000 (23:30 +0100)]
Revert "Reapply D124184, [DebugInfo][InstrRef] Add a size operand to DBG_PHI"
This reverts commit
5db925023169f8a19419e68153682d1e518f8392.
Further to the early revert, the sanitizers have found something wrong with
this.
Frederik Gossen [Mon, 25 Apr 2022 21:44:53 +0000 (17:44 -0400)]
Add missing comparison operators to SmallVector
Differential Revision: https://reviews.llvm.org/D124407
Vitaly Buka [Fri, 1 Apr 2022 04:58:44 +0000 (21:58 -0700)]
[libc++] Avoid lifetime UB in __thread_local_data()
Detected on many lld tests with -fsanitize-memory-use-after-dtor.
Also https://lab.llvm.org/buildbot/#/builders/sanitizer-x86_64-linux-fast after D122869 will report a lot of them.
Threads may outlive static variables. Even if ~__thread_specific_ptr() does nothing, lifetime of members ends with ~ and accessing the value is UB https://eel.is/c++draft/basic.life#1
```
==9214==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x557e1cec4539 in __libcpp_tls_set ../include/c++/v1/__threading_support:428:12
#1 0x557e1cec4539 in set_pointer ../include/c++/v1/thread:196:5
#2 0x557e1cec4539 in void* std::__msan::__thread_proxy<
std::__msan::tuple<...>, llvm::parallel::detail::(anonymous namespace)::ThreadPoolExecutor::ThreadPoolExecutor(llvm::ThreadPoolStrategy)::'lambda'()::operator()() const::'lambda'()> >(void*) ../include/c++/v1/thread:285:27
Memory was marked as uninitialized
#0 0x557e10a0759d in __sanitizer_dtor_callback compiler-rt/lib/msan/msan_interceptors.cpp:940:5
#1 0x557e1d8c478d in std::__msan::__thread_specific_ptr<std::__msan::__thread_struct>::~__thread_specific_ptr() libcxx/include/thread:188:1
#2 0x557e10a07dc0 in MSanCxaAtExitWrapper(void*) compiler-rt/lib/msan/msan_interceptors.cpp:1151:3
```
The test needs D123979 or -fsanitize-memory-param-retval enabled by default.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D122864
Quinn Pham [Fri, 22 Apr 2022 21:21:02 +0000 (16:21 -0500)]
[libcxx][NFC] Inclusive language: remove use of sanity check
from libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/
[NFC] As part of using inclusive language within the llvm project, this
patch rewords comments to remove sanity check.
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D124391
Jakub Chlanda [Mon, 25 Apr 2022 21:22:22 +0000 (14:22 -0700)]
[NVPTX] Support float <-> 2 x half bitcasts
Make sure NVPTX backend can handle bitcasting between `float` and `<2 x half>` types.
This was discovered through: https://github.com/intel/llvm/issues/5969
I'm not suggesting that such bitcasts make much sense, but it feels like the compiler should not hard crash on them.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D124171
Artem Belevich [Mon, 25 Apr 2022 21:28:30 +0000 (14:28 -0700)]
Change NVPTX/f16x2-instructions.ll to use unix EOL. NFC
Sanjay Patel [Mon, 25 Apr 2022 19:49:30 +0000 (15:49 -0400)]
[InstCombine] add tests for icmp with extended operands; NFC
Sanjay Patel [Mon, 25 Apr 2022 17:15:55 +0000 (13:15 -0400)]
[InstCombine] use isKnownNonNegative to reduce code duplication; NFC
We may be able to make the ValueTracking wrapper smarter
in the future (for example, analyze a simple recurrence),
so this will automatically benefit if that happens.
Quinn Pham [Fri, 22 Apr 2022 21:15:24 +0000 (16:15 -0500)]
[compiler-rt][NFC] Inclusive language: remove use of sanity check/test
from compiler-rt/lib/tsan
[NFC] As part of using inclusive language within the llvm project, this
patch rewords comments to remove sanity check and sanity test.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D124390
Matt Arsenault [Fri, 1 Apr 2022 13:59:05 +0000 (09:59 -0400)]
RegAllocGreedy: Allow last chance recolor to retry overlapping tuples
Last chance recoloring didn't try recoloring a done register with the
same class since it believed there was no point. This doesn't
necessarily apply if the members in that class overlap. Allow the
recoloring to proceed if the assigned interfering physical register
overlaps with the candidate register.
This avoids an allocation failure with overlapping tuples. This
testcase could be handled better, and I don't believe should reach
last chance recoloring. The failure only manifests with the mutually
unsatisfiable register hints to overlapping tuples. The earlier
assignment decisions probably should have figured out that using these
hints was a bad idea.
Quinn Pham [Fri, 22 Apr 2022 21:26:13 +0000 (16:26 -0500)]
[clang][NFC] Inclusive language: remove use of Whitelist in clang/lib/Analysis/
[NFC] As part of using inclusive language within the llvm project, this patch
rewords a comment to replace Whitelist with Allowlist in
`RetainSummaryManager.cpp`.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D124389
Krzysztof Drewniak [Tue, 19 Apr 2022 17:10:31 +0000 (17:10 +0000)]
[mlir] Allow data flow analysis of non-control flow branch arguments
This commit adds the visitNonControlFlowArguments method to
DataFlowAnalysis, allowing analyses to provide lattice values for the
arguments to a RegionSuccessor block that aren't directly tied to an
op's inputs. For example, integer range interface can use this method
to infer bounds for the step values in loops.
This method has a default implementation that keeps the old behavior
of assigning a pessimistic fixedpoint state to all such arguments.
Reviewed By: Mogball, rriddle
Differential Revision: https://reviews.llvm.org/D124021
Martin Storsjö [Mon, 25 Apr 2022 08:02:36 +0000 (11:02 +0300)]
[libunwind] [CMake] Remove leftover no-op cmake variable setting. NFC.
The setting and restoring of this variable became unused in
3ee0cec88effc88285732c8bec2a8f0e4e37c0b1 / D112155.
Differential Revision: https://reviews.llvm.org/D124372
Martin Storsjö [Mon, 25 Apr 2022 10:00:13 +0000 (13:00 +0300)]
[libunwind] Fix build warnings in Unwind-EHABI.cpp. NFC.
Differential Revision: https://reviews.llvm.org/D124371
Peter Klausler [Wed, 20 Apr 2022 22:58:43 +0000 (15:58 -0700)]
[flang][runtime] Fix total MAXLOC/MINLOC for non-integer data
A template argument was hard-coded as the Integer type category
rather than properly forwarding the type category of the data for
type-specific instantiations of total (no DIM=) MAXLOC and MINLOC.
This broke total MAXLOC and MINLOC reductions for real and character
data.
Differential Revision: https://reviews.llvm.org/D124303
Paul Robinson [Mon, 25 Apr 2022 19:41:37 +0000 (12:41 -0700)]
[PS5] Driver test for analyzer defaults
Peter Klausler [Tue, 19 Apr 2022 20:49:06 +0000 (13:49 -0700)]
[flang] Add semantic checks for intrinsic function REDUCE()
Support REDUCE's special semantic requirements in intrinsic
procedure semantics.
Differential Revision: https://reviews.llvm.org/D124296
Yuanfang Chen [Sun, 24 Apr 2022 02:30:00 +0000 (19:30 -0700)]
[lit] Keep stdout/stderr when using GoogleTest format
When a unit test crashes or timeout, print the shard's stdout and
stderr. When a unit test fails, attaches the test's output to the LIT
output to help debugging.
While at it, concatenating shard's environment variables using space
instead of newline to make the reproducer script user friendly.
Based on D123797. (Thanks to @lenary)
Valery N Dmitriev [Mon, 25 Apr 2022 19:25:33 +0000 (12:25 -0700)]
[SLP] Steer for the best chance in tryToVectorize() when rooting with binary ops.
tryToVectorize() method implements one of searching paths for vectorizable tree roots in SLP vectorizer,
specifically for binary and comparison operations. Order of making probes for various scalar pairs
was defined by its implementation: the instruction operands, then climb over one operand if
the instruction is its sole user and then perform same actions for another operand if previous
attempts failed. Problem with this approach is that among these options we can have more than a
single vectorizable tree candidate and it is not necessarily the one that encountered first.
Trying to build vectorizable tree for each possible combination for just evaluation is expensive.
But we already have lookahead heuristics mechanism which we use for finding best pick among
operands of commutative instructions. It calculates cumulative score for candidates in two
consecutive lanes. This patch introduces use of the heuristics for choosing the best pair among
several combinations. We only try one that looks as most promising for vectorization.
Additional benefit is that we reduce total number of vectorization trees built for probes
because we skip those looking non-profitable early.
Reviewed By: Alexey Bataev (ABataev), Vasileios Porpodas (vporpo)
Differential Revision: https://reviews.llvm.org/D124309
Sam McCall [Mon, 25 Apr 2022 19:16:31 +0000 (21:16 +0200)]
[Serialization] Remove dead TYPE_FUNCTION_PROTO abbreviation. NFC
It was added in
01b2cb47 but never used.
Peter Klausler [Sat, 23 Apr 2022 22:41:16 +0000 (15:41 -0700)]
[flang] Accept "INFINITY" as real input
Both "INF" and "INFINITY" are standard.
Differential Revision: https://reviews.llvm.org/D124401
jfurtek [Mon, 25 Apr 2022 19:00:20 +0000 (19:00 +0000)]
[mlir][tblgen] Generate builders with inferred return types and unwrapped attributes
This diff causes mlir-tblgen to generate code for an additional builder for an
operation argument with a return type that can be inferred *AND* an attribute in
the argument list can be "unwrapped." (Previously, the unwrapped build function
was only generated for builders with explicit return types in separate or
aggregate form.) As an example, this builder might be used by code that creates
operations that implement the `SameOperandsAndResultType` interface. A test case
was created.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D124043
Jeremy Furtek [Mon, 25 Apr 2022 18:51:09 +0000 (18:51 +0000)]
[mlir][ods] Extend the EnumAttr tablegen class to support BitEnum attributes
This diff allows the EnumAttr class to be used for bit enum attributes (in
addition to previously supported integer enum attributes). While integer
and bit enum attributes share many common implementation aspects, parsing
bit enum values requires a separate implementation. This is accomplished
by creating empty parser and printer strings in the EnumAttrInfo record,
and having derived classes (specific to bit and integer enums) override with
an appropriate parser/printer string.
To support existing bit enums that may use a vertical bar separator, the
parser is modified to support the | token.
Tests were added for bit enums alongside integer enums.
Future diffs for fastmath attributes in the arithmetic dialect will use these
changes.
(resubmission of earlier abaondoned diff, updated to reflect subsequent changes
in the repository)
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D123880
jfurtek [Mon, 25 Apr 2022 18:48:16 +0000 (18:48 +0000)]
[mlir][ods] Add tablegen field for concise printing of BitEnum attributes
This diff introduces a tablegen field for bit enum attributes
(`printBitEnumPrimaryGroups`) to control printing when the enum uses "group"
cases. An example would be an implementation that uses a `fastmath` enum value
as an alias for individual fastmath flags. The proposed field would allow
printing of simply `fast` for the enum value, instead of the more verbose list
that would include `fast` as well as the individual flags (e.g. `reassoc,nnan,
ninf,nsz,arcp,contract,afn,fast`).
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D123871
Ishaan Gandhi [Mon, 25 Apr 2022 18:15:15 +0000 (20:15 +0200)]
compile commands header to source heuristic lower-cases filenames before inferring file types
This leads to ".C" files being rewritten as ".c" files and being inferred to be "c" files as opposed to "c++" files.
Fixes https://github.com/clangd/clangd/issues/1108
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D124262
Rahman Lavaee [Mon, 25 Apr 2022 18:32:13 +0000 (11:32 -0700)]
[BOLT] Refactor DataAggregator::printLBRHeatMap.
This also fixes some logs that were impacted by D123067.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D124281
Mingming Liu [Mon, 25 Apr 2022 15:51:45 +0000 (15:51 +0000)]
Add a regression test to guard the 0 hot-caller threshold in SamplePGO + ThinLTO. - Add a comment near where the threshold is set.
Peter Klausler [Sat, 23 Apr 2022 17:15:02 +0000 (10:15 -0700)]
[flang][runtime] Fix KIND=16 real/complex component I/O
Don't treat KIND=16 as 80-bit extended floating-point any more on x86.
Differential Revision: https://reviews.llvm.org/D124400
Nathan Lanza [Mon, 25 Apr 2022 17:48:55 +0000 (10:48 -0700)]
[coroutines] Get an IntegerType from the value instead of defaulting to 64 bit
This AliasPtr is being created always from an Int64 even for targets
where 32 bit is the proper type. e.g. “thumbv7-none-linux-android16”.
This causes the assert in the `get` func to fail as we're getting a 32
bit from the APInt.
Fix this by simply always just getting the type from the value instead.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D123272
Sam McCall [Mon, 25 Apr 2022 17:20:39 +0000 (19:20 +0200)]
[Basic] SourceManager docs: macro expansion SLocs aren't a single token. NFC
And haven't been since 2011: https://github.com/llvm/llvm-project/commit/
eeca36fe9ad767380b2eab76a6fe5ba410a47393
Craig Topper [Mon, 25 Apr 2022 17:45:48 +0000 (10:45 -0700)]
[RISCV] Add isCommutable to ADD/ADDW/MUL/AND/OR/XOR/MIN/MAX/CLMUL
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D123970
David Green [Mon, 25 Apr 2022 17:44:35 +0000 (18:44 +0100)]
[CostModel] Add fptoi_sat costmodel tests. NFC
Vitaly Buka [Tue, 19 Apr 2022 03:39:30 +0000 (20:39 -0700)]
[libcxx] Disable long double -> int128 test with msan
On x86 long double is 80 bit with padding, which produces
uninitialized bits in the result.
This will trigger errors with -fsanitize-memory-param-retval.
Can be triggered with D123979.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D123980
Fangrui Song [Mon, 25 Apr 2022 17:21:26 +0000 (10:21 -0700)]
[LegacyPM] Remove HWAsanSanitizerLegacyPass
Using the legacy PM for the optimization pipeline was deprecated in 13.0.0.
Following recent changes to remove non-core features of the legacy
PM/optimization pipeline, remove AddressSanitizerLegacyPass...
...,
ModuleAddressSanitizerLegacyPass, and ASanGlobalsMetadataWrapperPass.
MemorySanitizerLegacyPass was removed in D123894.
AddressSanitizerLegacyPass was removed in D124216.
Reviewed By: #sanitizers, vitalybuka
Differential Revision: https://reviews.llvm.org/D124337
Louis Dionne [Mon, 25 Apr 2022 17:16:30 +0000 (11:16 -0600)]
[libc++][NFC] Use brace-init instead of parens to workaround macro expansion in badly behaved systems
David Green [Mon, 25 Apr 2022 17:13:23 +0000 (18:13 +0100)]
[NFC] Rename Instrinsic to Intrinsic
Arthur Eubanks [Mon, 25 Apr 2022 17:01:17 +0000 (10:01 -0700)]
[test] Remove legacy PM pipeline test
The legacy PM for the optimization pipeline is deprecated and in the process of being cleaned up.
Nathan Sidwell [Fri, 8 Apr 2022 13:55:31 +0000 (06:55 -0700)]
[demangler][NFC] OperatorInfo table unit test
Placing a run-once test inside the operator lookup function caused
problems with the thread sanitizer. See D122975.
Break out the operator table into a member variable, and move the test
to the unit test machinery.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D123390
Peter Klausler [Fri, 22 Apr 2022 21:06:54 +0000 (14:06 -0700)]
[flang] Avoid global name conflict when BIND(C,NAME=) is used
At the top level of program units in a source file, two subprograms
are allowed to have the same name if at least one of them has a
distinct interoperable binding name. F18's symbol table requires
(most) symbols in a scope to have distinct names, though. Solve
by using compiler-created names for the symbols of global scope
subprograms that have interoperable binding names.
Differential Revision: https://reviews.llvm.org/D124295
Peter Klausler [Fri, 22 Apr 2022 21:16:16 +0000 (14:16 -0700)]
[flang] Disambiguate F(X)=Y case where F is a function returning a pointer
F(X)=Y may be initially parsed as a statement function definition; an
existing pass will detect statement functions that should be rewritten
into assignment statemets with array element references as their
left-hand side variables. However, F() may also be a reference to a
function that returns a data pointer, and f18 did not handle this
case correctly.
The right fix is to rewrite the parse tree for F(X)=Y into an assignment
to a function reference result. The cases that are actually assignments
to array elements -- including all of the cases previously handled --
will have their left-hand sides converted to array element references
later by another existing rewriting step.
Differential Revision: https://reviews.llvm.org/D124299
Zakk Chen [Mon, 25 Apr 2022 15:44:55 +0000 (08:44 -0700)]
[RISCV] Fix incorrect policy implement for unmasked vslidedown and vslideup.
vslideup works by leaving elements 0<i<OFFSET undisturbed.
so it need the destination operand as input for correctness
regardless of policy. Add a operand to indicate policy.
We also add policy operand for unmaksed vslidedown to keep the interface consistent with vslideup
because vslidedown have only undisturbed at 0<i<vstart but user have no way to control of vstart.
Reviewed By: rogfer01, craig.topper
Differential Revision: https://reviews.llvm.org/D124186
Simon Pilgrim [Mon, 25 Apr 2022 15:51:57 +0000 (16:51 +0100)]
[X86] combineX86ShuffleChain - don't fold to truncate(concat(V1,V2)) if it was already a PACK op
Fixes #55050
Christudasan Devadasan [Mon, 25 Apr 2022 15:47:33 +0000 (21:17 +0530)]
[AMDGPU] Lit test pre-commit changes (NFC)
Run line change needed for an upcoming patch.
Christudasan Devadasan [Mon, 25 Apr 2022 15:32:28 +0000 (21:02 +0530)]
[AMDGPU] Regenerate lit test pattern (NFC).
Saleem Abdulrasool [Fri, 22 Apr 2022 14:34:25 +0000 (14:34 +0000)]
CODE_OWNERS: update information for builtins
Mark myself as the code owner for the builtins library as per the
discussion at
https://discourse.llvm.org/t/code-owner-for-compiler-rt-builtins-library.
Differential Revision: https://reviews.llvm.org/D124263
Reviewed By: aaron.ballman, lattner
Sam McCall [Mon, 25 Apr 2022 15:25:38 +0000 (17:25 +0200)]
Clear temporary file in test, buildbot appears to be reusing an old one.
https://lab.llvm.org/buildbot/#/builders/214/builds/903/steps/6/logs/FAIL__Clang__pch-with-module_m
Piotr Sobczak [Mon, 25 Apr 2022 15:18:49 +0000 (17:18 +0200)]
Revert "[AMDGPU] Use d16 flag for image.sample instructions"
This reverts commit
d1762fc454c0d7ee0bcffe87e798f67b6c43c1d2.
Reverting D124232 as the buildbot reported some errors in sanitizers.
Yitzhak Mandelbaum [Thu, 14 Apr 2022 13:42:02 +0000 (13:42 +0000)]
[clang][dataflow] Fix `Environment::join`'s handling of flow-condition merging.
The current implementation mutates the environment as it performs the
join. However, that interferes with the call to the model's `merge` operation,
which can modify `MergedEnv`. Since any modifications are assumed to apply to
the post-join environment, providing the same environment for both is
incorrect. This mismatch is a particular concern for joining the flow
conditions, where modifications in the old environment may not be propagated to
the new one.
Differential Revision: https://reviews.llvm.org/D124104
Jeremy Morse [Mon, 25 Apr 2022 14:23:57 +0000 (15:23 +0100)]
Reapply D124184, [DebugInfo][InstrRef] Add a size operand to DBG_PHI
This was applied in
fda4305e53784, reverted in
13815e8cbf8d49, the problem
was that fp80 X86 registers that were spilt to the stack aren't expected by
LiveDebugValues. It pre-allocates a position number for all register sizes
that can be spilt, and 80 bits isn't exactly common.
The solution is to scan the register classes to find any unrecognised
register sizes, adn pre-allocate those position numbers, avoiding a later
assertion.
Joseph Huber [Mon, 25 Apr 2022 12:28:30 +0000 (08:28 -0400)]
[Libomptarget] Use entry name for global info
Currently, globals on the device will have an infinite reference count
and an unknown name when using `LIBOMPTARGET_INFO` to print the mapping
table. We already store the name of the global in the offloading entry
so we should be able to use it, although there will be no source
location. To do this we need to create a valid `ident_t` string from a
name only.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D124381
Florian Hahn [Mon, 25 Apr 2022 13:26:41 +0000 (14:26 +0100)]
[SimpleLoopUnswitch] Enable freezing of conditions by default.
This fixes a series of mis-compiles by SimpleLoopUnswitch.
My measurements showed no performance regression with -O3 on AArch64
in SPEC2006, SPEC2017 and a set of internal benchmarks.
Fixes #50387, #50430
Depends on D124251.
Reviewed By: nikic, aqjune
Differential Revision: https://reviews.llvm.org/D124252
Nikolas Klauser [Mon, 25 Apr 2022 13:17:12 +0000 (15:17 +0200)]
[libc++] Fix C++03 with the unstable ABI enabled
Jeremy Morse [Mon, 25 Apr 2022 13:06:12 +0000 (14:06 +0100)]
Revert "[DebugInfo][InstrRef] Add a size operand to DBG_PHI"
This reverts commit
fda4305e5378478051be225248bfe9c1d401d938.
Green dragon has spotted a problem -- it's understood, but might be fiddly
to fix, reverting in the meantime.
Nico Weber [Mon, 25 Apr 2022 12:48:57 +0000 (08:48 -0400)]
Revert "[sanitizer] Use canonical syscalls everywhere"
This reverts commit
34b676eb60ca1fa012068d161633f268d8ea7e6c.
Speculative, might have caused test problems on Android.
Jeremy Morse [Thu, 21 Apr 2022 13:39:39 +0000 (14:39 +0100)]
[DebugInfo][InstrRef] Add a size operand to DBG_PHI
DBG_PHI instructions can refer to stack slots, to indicate that multiple
values merge together on control flow joins in that slot. This is fine --
however the slot might be merged at a later date with a slot of a different
size. In doing so, we lose information about the size the eliminated PHI.
Later analysis passes have to guess.
Improve this by attaching an optional "bit size" operand to DBG_PHI, which
only gets added for stack slots, to let us know how large a size the value
on the stack is.
Differential Revision: https://reviews.llvm.org/D124184
Sam McCall [Fri, 22 Apr 2022 09:59:38 +0000 (11:59 +0200)]
[Frontend] shrink in-memory PCH buffers to fit
After building a PCH, the vector capacity is on average ~1/3 unused.
If we're going to keep it in memory for a while, reallocate to the right size.
Take care to do this once clang is destroyed so that we can reuse its
memory rather than requesting more.
Differential Revision: https://reviews.llvm.org/D124242
Nikita Popov [Mon, 25 Apr 2022 11:18:31 +0000 (13:18 +0200)]
[InstCombine] Remove redundant unsigned underflow fold (NFCI)
This is now handled as a combination of two other folds:
(A+B) <= A & (A+B) != 0 --> (A+B)-1 < A
(A+B)-1 < A --> -B < A
Mariusz Sikora [Mon, 25 Apr 2022 11:57:27 +0000 (12:57 +0100)]
[AMDGPU] Use d16 flag for image.sample instructions
Image.sample instruction can be forced to return half type instead of
float when d16 flag is enabled.
This patch adds new pattern in InstCombine to detect if output of
image.sample is used later only by fptrunc which converts the type
from float to half. If pattern is detected then fptrunc and image.sample
are combined to single image.sample which is returning half type.
Later in Lowering part d16 flag is added to image sample intrinsic.
Differential Revision: https://reviews.llvm.org/D124232
Luo, Yuanke [Mon, 25 Apr 2022 11:47:21 +0000 (19:47 +0800)]
[X86][AMX] Add test case for D124378.
Andrzej Warzynski [Thu, 17 Mar 2022 16:24:54 +0000 (16:24 +0000)]
[flang][driver] Add support for generating executables
This patch adds 2 missing items required for `flang-new` to be able to
generate executables:
1. The Fortran_main runtime library, which implements the main entry
point into Fortran's `PROGRAM` in Flang,
2. Extra linker flags to include Fortran runtime libraries (e.g.
Fortran_main).
Fortran_main is the bridge between object files generated by Flang and
the C runtime that takes care of program set-up at system-level. For
every Fortran `PROGRAM`, Flang generates the `_QQmain` function.
Fortran_main implements the C `main` function that simply calls
`_QQmain`.
Additionally, "<driver-path>/../lib" directory is added to the list of
search directories for libraries. This is where the required runtime
libraries are currently located. Note that this the case for the build
directory. We haven't considered installation directories/targets yet.
With this change, you can generate an executable that will print `hello,
world!` as follows:
```bash
$ cat hello.f95
PROGRAM HELLO
write(*, *) "hello, world!"
END PROGRAM HELLO
$ flang-new -flang-experimental-exec hello.f95
./a.out
hello, world!
```
NOTE 1: Fortran_main has to be a static library at all times. It invokes
`_QQmain`, which is the main entry point generated by Flang for the
given input file (you can check this with `flang-new -S hello.f95 -o - |
grep "Qmain"`). This means that Fortran_main has an unresolved
dependency at build time. The linker will allow this for a static
library. However, if Fortran_main was a shared object, then the linker
will produce an error: `undefined symbol: `_QQmain`.
NOTE 2: When Fortran runtime libraries are generated as shared libraries
(excluding Fortran_main, which is always static), you will need to
tell the dynamic linker (by e.g. tweaking LD_LIBRARY_PATH) where to look
for them when invoking the executables. For example:
```bash
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<flang-build-dir>/lib/ ./a.out
```
NOTE 3: This feature is considered experimental and currently guarded
with a flag: `-flang-experimental-exec`.
Differential Revision: https://reviews.llvm.org/D122008
[1] https://github.com/flang-compiler/f18-llvm-project
CREDITS: Fortran_main was originally written by Eric Schweitz, Jean
Perier, Peter Klausler and Steve Scalpone in the fir-dev` branch in [1].
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Peter Klausler <pklausler@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Steve Scalpone <sscalpone@nvidia.com
Florian Hahn [Mon, 25 Apr 2022 11:49:07 +0000 (12:49 +0100)]
[SimpleLoopUnswitch] Run LICM for nested unswitching tests.
When enabling freeze-loop-unswitch-cond the inserted freeze instruction
may block unswitching of parent loops if they get inserted in a block in
the parent loop (as the llvm::Loop-based invariance check only checks
whether an instruction is in a loop block or not).
In the optimization pipeline, LICM is responsible to hoist out loop
invariant instructions to enable further unswitching. Also run LICM for
nested unswitching tests in preparation for flipping the default of
freeze-loop-unswitch-cond.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D124251
Simon Pilgrim [Mon, 25 Apr 2022 11:17:23 +0000 (12:17 +0100)]
[X86][AVX] Add shuffle test case for Issue #55066
Nikita Popov [Fri, 22 Apr 2022 13:14:49 +0000 (15:14 +0200)]
[InstCombine] Fold (X != 0) & (Y u>= X)
This adds the De Morgan conjugated fold for the existing
(X == 0) | (Y u< X) fold.
Proof: https://alive2.llvm.org/ce/z/3Me3JQ
Nico Weber [Mon, 25 Apr 2022 01:10:55 +0000 (21:10 -0400)]
[lld/mac] Revert libcompiler_rt.dylib version check change
This reverts D117925 since it's no longer needed after D124336.
Differential Revision: https://reviews.llvm.org/D124354
Nikita Popov [Mon, 25 Apr 2022 10:08:30 +0000 (12:08 +0200)]
[InstCombine] Fold X + Y + C u< X
This is a variation on the X + Y u< X fold with an extra constant.
Proof: https://alive2.llvm.org/ce/z/VNb8pY
Nikita Popov [Mon, 25 Apr 2022 10:47:03 +0000 (12:47 +0200)]
[InstCombine] Add additional tests for X + Y + C u< X (NFC)
We don't actually need the limitation for C == -1, so update test
naming accordingly, and also test a non-uniform vector constant.
Max Kazantsev [Mon, 25 Apr 2022 10:33:57 +0000 (17:33 +0700)]
[LoopInstSimplify] Ignore users in unreachable blocks. PR55072
Logic in this pass assumes that all users of loop instructions are
either in the same loop or are LCSSA Phis. In fact, there can also
be users in unreachable blocks that currently break assertions.
Such users don't need to go to the next round of simplifications.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D124368
Florian Hahn [Mon, 25 Apr 2022 10:32:50 +0000 (11:32 +0100)]
[LangRef] Limit readnone,read/writeonly to memory visible outside the fn
This patch unifies the wording used for readnone, readonly and writeonly
attributes. The definitions now more specifically refer to memory visible
outside the function
The motivation for the clarification is D123473.
Reviewed By: nlopes
Differential Revision: https://reviews.llvm.org/D124124
LLVM GN Syncbot [Mon, 25 Apr 2022 10:26:57 +0000 (10:26 +0000)]
[gn build] Port
042dc3c46d73
Markus Böck [Mon, 25 Apr 2022 10:23:09 +0000 (12:23 +0200)]
[mlir][LLVM] Support opaque pointers in `llvm.mlir.addressof`
The verifier of llvm.mlir.addressof did not properly account for opaque pointers, that is, the pointer type not having an element type equal to the type of the referenced global or function. This patch fixes that by skipping the test for the element type if the pointer is opaque.
Differential Revision: https://reviews.llvm.org/D124333
Hui Xie [Mon, 25 Apr 2022 10:18:54 +0000 (12:18 +0200)]
[libc++] add zip_view and views::zip for C++23
- add zip_view and views::zip for C++23
- added unit tests
- implemented section 5.6 (zip) in P2321R2
I used clang-format to format the files but they look nothing like the rest of the code base. Manually indenting each line to match the styles sounds like an impossible task. Is there any clang-format file which can format it reasonable similar to the rest of the code base so that I can manually format the rest lines that look weird?
Reviewed By: ldionne, #libc, philnik, var-const
Spies: Mordante, philnik, libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D122806
Nikita Popov [Mon, 25 Apr 2022 10:20:56 +0000 (12:20 +0200)]
[InstCombine] Add tests for X + Y - 1 u< X (NFC)
Max Kazantsev [Mon, 25 Apr 2022 10:20:08 +0000 (17:20 +0700)]
[Test] Simplify test for PR55072
Sam McCall [Fri, 22 Apr 2022 12:00:36 +0000 (14:00 +0200)]
[Serialization] write expr dependence bits as a single integer
When exprs are written unabbreviated:
- these were encoded as 5 x vbr6 = 30 bits
- now they fit exactly into a one-chunk vbr = 6 bits
clangd --check=clangd/AST.cpp reports ~1% reduction in PCH size
(
42826720->
42474460)
Differential Revision: https://reviews.llvm.org/D124250
Alex Zinenko [Mon, 25 Apr 2022 08:25:59 +0000 (10:25 +0200)]
[mlir][vector] insert `alloca`s outside of loops
After https://reviews.llvm.org/D119743 added the `AutomaticAllocationScope`
trait to loop-like constructs, the vector transfer full/partial splitting pass
started inserting allocations for temporaries within the closest loop rather
than the closest function (or other allocation scope such as `async.execute`).
While this is correct as long as the lowered code takes care of automatic
deallocation at the end of each iteration of the loop, this interferes with
downstream optimizations that expect `alloca`s to be at the function level.
Step over loops when looking for the closest allocation scope in vector
transfer full/partial splitting pass thus restoring the original behavior.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D124366
Florian Hahn [Mon, 25 Apr 2022 08:22:45 +0000 (09:22 +0100)]
[MemorySSA] Use -simple-loop-unswitch instead of -loop-unswitch in test.
Martin Storsjö [Mon, 25 Apr 2022 06:03:00 +0000 (09:03 +0300)]
[runtimes] [CMake] Rename a cmake variable missed in
b3df14b6c98702ce50401fd039852787373e4676
This was missed as this check only is executed if linking doesn't
work without it.
Max Kazantsev [Mon, 25 Apr 2022 08:18:51 +0000 (15:18 +0700)]
[Test] Add test for PR55072
Florian Hahn [Mon, 25 Apr 2022 08:02:42 +0000 (09:02 +0100)]
[MemorySSA] Generate check lines for test.
This is to ensure we produce the same code when switching to
SimpleLoopUnswitch.
Adrian Kuegel [Mon, 25 Apr 2022 07:16:16 +0000 (09:16 +0200)]
[mlir][Bazel] Add missing dependencies.
When building with layering_check enabled, there needs to be a
dependency for each header include.
Jean Perier [Mon, 25 Apr 2022 07:20:07 +0000 (09:20 +0200)]
[flang] fix LBOUND lowering with KIND and no DIM arguments
The lowering code was mistakenly assuming that the second argument
in the signature provided by semantics is the DIM argument. This
caused calls with a KIND argument but no DIM to be lowered as if the
KIND argument was DIM.
Differential Revision: https://reviews.llvm.org/D124243
Markus Böck [Mon, 25 Apr 2022 07:14:18 +0000 (09:14 +0200)]
[mlir][LLVM] Support opaque pointers in data layout entries
This is likely preferable to having it crash if one were to specify an opaque pointer type, and the actual element type is unused either way.
Differential Revision: https://reviews.llvm.org/D124334
Jun Zhang [Mon, 25 Apr 2022 04:43:49 +0000 (12:43 +0800)]
Fix an issue in comment. NFC
I think the author renamed the function but forgot to update the
comment.
Signed-off-by: Jun Zhang <jun@junz.org>
Shraiysh Vaishay [Mon, 25 Apr 2022 02:53:58 +0000 (08:23 +0530)]
[OpenMP][IRBuilder] Handle unexcuted EXPECT_FALSE
This patch addresses the comment about unexecuted test in D122371.
Reviewed By: probinson
Differential Revision: https://reviews.llvm.org/D123920
Chenbing Zheng [Mon, 25 Apr 2022 01:48:43 +0000 (09:48 +0800)]
[InstCombine] Complete folding of fneg-of-fabs
This patch add a function foldSelectWithFCmpToFabs, and do more combine for
fneg-of-fabs.
With 'nsz':
fold (X < +/-0.0) ? X : -X or (X <= +/-0.0) ? X : -X to -fabs(x)
fold (X > +/-0.0) ? X : -X or (X >= +/-0.0) ? X : -X to -fabs(x)
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D123830
Brad Smith [Mon, 25 Apr 2022 01:45:49 +0000 (21:45 -0400)]
[libcxx] random_device, use arc4random() on FreeBSD, NetBSD and DragonFlyBSD
Reviewed By: ldionne, emaste, dim
Differential Revision: https://reviews.llvm.org/D122628
sstwcw [Sun, 24 Apr 2022 22:30:22 +0000 (22:30 +0000)]
[clang-format] Refactor determineStarAmpUsage NFC
There was some duplicate code in determineStarAmpUsage and
determinePlusMinusCaretUsage
Now a `-` or `+` following `;`, `sizeof`, `co_await`, or `delete` is
regarded as a unary operator.
Now a `*` or `&` following `case` is also a unary operator.
Reviewed By: curdeius, MyDeveloperDay, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D121754
Aaron Puchert [Sun, 24 Apr 2022 20:30:25 +0000 (22:30 +0200)]
Move test/.gitattributes to clang-tools-extra/test
It was probably accidentally added there, see the discussion on change
D97625. It is certainly without effect, to quote gitattributes(5):
When deciding what attributes are assigned to a path, Git consults
[...], `.gitattributes` file in the same directory as the path in
question, and its parent directories up to the toplevel of the work
tree [...]
Running `git check-attr -a` on the files in question shows that now the
settings are indeed effective whereas before they were not.
Lastly, lit ignores the file like any dotfile, see getTestsInDirectory
of FileBasedTest in llvm/utils/lit/lit/formats/base.py. This can be
verified with `llvm-lit --show-tests clang-tools-extra/test`.
Valentin Clement (バレンタイン クレメン) [Sun, 24 Apr 2022 18:37:27 +0000 (20:37 +0200)]
[flang] Do not create arith.extui with same from/to type
In some case the lowering of `ichar` is generating an `arith.extui` operation
with the same from/to type. This operation do not accept from/to types to be
the same. If the from/to types are identical, we do not generate the extra
operation.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D124107
Jonas Toth [Sun, 24 Apr 2022 15:16:36 +0000 (17:16 +0200)]
run-clang-tidy: Fix infinite loop on windows
`find_compilation_database` checked only for "/" as exit point, but on Windows, this root is impossible.
Fixes #53642
Authored By: Febbe
Reviewed By: JonasToth
Differential Revision: https://reviews.llvm.org/D119481
Matt Arsenault [Sun, 17 Apr 2022 14:15:16 +0000 (10:15 -0400)]
llvm-reduce: Don't delete triple/datalayout
Removing these is extremely unhelpful and just adds extra hassle. This
is really finding out whether your test script uses -mtriple or
not. You can't meaningfully delete these fields, and the resulting
module defaults to the host.
Petr Hosek [Thu, 10 Mar 2022 09:47:09 +0000 (11:47 +0200)]
[runtimes] [CMake] Unify variable names
Avoid repeating CMake checks across runtimes by unifying names of
variables used for results to leverage CMake caching.
Differential Revision: https://reviews.llvm.org/D110005
Chenbing Zheng [Sun, 24 Apr 2022 09:26:15 +0000 (17:26 +0800)]
[InstCombine] Add test for fold fcmp-of-copysign. nfc
Add more tests with differert predicates.
Vince Bridgers [Fri, 8 Apr 2022 11:17:14 +0000 (06:17 -0500)]
[analyzer] Add option for AddrSpace in core.NullDereference check
This change adds an option to detect all null dereferences for
non-default address spaces, except for address spaces 256, 257 and 258.
Those address spaces are special since null dereferences are not errors.
All address spaces can be considered (except for 256, 257, and 258) by
using -analyzer-config
core.NullDereference:DetectAllNullDereferences=true. This option is
false by default, retaining the original behavior.
A LIT test was enhanced to cover this case, and the rst documentation
was updated to describe this behavior.
Reviewed By: steakhal
Differential Revision: https://reviews.llvm.org/D122841
wangpc [Sun, 24 Apr 2022 06:55:54 +0000 (14:55 +0800)]
[RISCV] Add sched to pseudo function call instructions
To fix llvm-mca's error of 'found an unsupported instruction
in the input assembly sequence.' caused by the lack of
scheduling info.
Pseudo function call instructions will be expanded to `auipc`
and `jalr`, so their scheduling info are the combination of
two.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D123578
Senran Zhang [Sun, 24 Apr 2022 02:49:58 +0000 (10:49 +0800)]
[NFC][Clang][Pragma] Remove unused variables
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D124339