Simon Pilgrim [Tue, 29 Mar 2022 21:24:02 +0000 (22:24 +0100)]
[X86] combineADC - fold ADC(C1,C2,Carry) -> ADC(0,C1+C2,Carry)
If we're not relying on the flag result, we can fold the constants together into the RHS immediate operand and set the LHS operand to zero, simplifying for further folds.
We could do something similar if the flag result is in use and the constant fold doesn't affect it, but I don't have any real test cases for this yet.
As suggested by @davezarzycki on Issue #35256
Differential Revision: https://reviews.llvm.org/D122482
Simon Pilgrim [Fri, 25 Mar 2022 11:09:40 +0000 (11:09 +0000)]
[CostModel][X86] Reduce cost of v2i64 icmp base cost on SSE2 targets
Based off the script from D103695, we were exaggerating the cost of the v2i64 comparison expansion using instruction count instead of effective throughput
Ingo Müller [Mon, 28 Mar 2022 09:07:58 +0000 (09:07 +0000)]
[mlir][docs] Convert block comments to line comments.
The op documentation of the ops of the scf dialect used /**/ style block
comments which doesn't seem to exists (anymore?).
Reviewed By: nicolasvasilache, ingomueller-net
Differential Revision: https://reviews.llvm.org/D122565
Fraser Cormack [Tue, 29 Mar 2022 06:43:30 +0000 (07:43 +0100)]
[RISCV] Trim RVV isel pats matchable via DAG post-process
In D122512, several masked patterns were added to support lowering of
vector-predicated float-to-int and int-to-float conversions. With the
introduction of these patterns, all of the old "unmasked" patterns are
matchable via the DAG post-process introduced in D118810, once the relevant
opcode entries are set up in the helper table.
Locally this reduces the generated isel table by 4%.
Reviewed By: arcbbb
Differential Revision: https://reviews.llvm.org/D122637
Nikita Popov [Tue, 29 Mar 2022 16:21:39 +0000 (18:21 +0200)]
[MLIR] Avoid some pointer element type accesses
Determine the element type from the MLIR LLVMPointerType, rather
than the LLVM PointerType.
Nikita Popov [Fri, 25 Mar 2022 09:50:13 +0000 (10:50 +0100)]
[IR] Require intrinsic struct return type to be anonymous
This is an alternative to D122376. Rather than working around the
problem, this patch requires that struct return types in intrinsics
are anonymous/literal and adds auto-upgrade code to convert
existing uses of intrinsics with named struct types.
This ensures that the mapping between intrinsic name and
intrinsic function type is actually bijective, as it is supposed
to be.
This also fixes https://github.com/llvm/llvm-project/issues/37891.
Differential Revision: https://reviews.llvm.org/D122471
LLVM GN Syncbot [Wed, 30 Mar 2022 07:33:49 +0000 (07:33 +0000)]
[gn build] Port
1410a4860eb2
Pavel Labath [Wed, 30 Mar 2022 07:28:19 +0000 (09:28 +0200)]
[lldb] Remove vasprintf windows-compat implementation
We already have a VASprintf function for this purpose, so I'm switching
the remaining few users to that.
Markus Böck [Wed, 30 Mar 2022 07:25:33 +0000 (09:25 +0200)]
[clang][DR] Add test for DR1227 and mark it as complete
DR: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1227
This DR has been implemented in Clang as far back as I could check. This patch simply adds a test and comment to mark it as complete.
Differential Revision: https://reviews.llvm.org/D122682
Pavel Labath [Wed, 30 Mar 2022 07:12:59 +0000 (09:12 +0200)]
[lldb] Use =default in the ValueList class
Danny Mösch [Wed, 30 Mar 2022 06:03:32 +0000 (08:03 +0200)]
[clang-tidy] Make test work on architectures which do not provide a `__int128_t`
See
f10cee91ae07022e602d6a47e504e86796d49a7d. The test did still not run successful since the
`CHECK-MESSAGE` line is still read and considered even though the `#ifdef` removes the code if
`__int128_t` is not available. Now there is a fallback type in this case.
Serge Pavlov [Wed, 30 Mar 2022 04:23:49 +0000 (11:23 +0700)]
Mapping of FP operations to constrained intrinsics
A new function 'getConstrainedIntrinsic' is added, which for any gived
instruction returns id of the corresponding constrained intrinsic. If
there is no constrained counterpart for the instruction or the instruction
is already a constrained intrinsic, the function returns zero.
Differential Revision: https://reviews.llvm.org/D69562
Michael Kruse [Wed, 30 Mar 2022 04:08:13 +0000 (23:08 -0500)]
[docs] Update LoopTerminology.
Includes 2 corrections:
* Update irreducible control flow and add references to CycleTerminology;
Natural loop is not the only definition of something looping in LLVM anymore.
* Mention mustprogress loop and function attributes to be used
instead of the llvm.sideeffect intrinsic.
Liqin Weng [Wed, 30 Mar 2022 02:51:26 +0000 (02:51 +0000)]
[RISCV][NFC] Add immediate tests for the icmp instruction
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D122651
Chenbing Zheng [Wed, 30 Mar 2022 01:50:28 +0000 (09:50 +0800)]
[DAGCombine] add tests for bitreverse-shift optimization
This patch add some tests to show some optimization opportunities
for bitreverse-shift.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D121507
Zakk Chen [Wed, 30 Mar 2022 00:28:28 +0000 (17:28 -0700)]
[RISCV] Use maskedoff to decide mask policy for masked compare and vmsbf/vmsif/vmsof.
masked compare and vmsbf/vmsif/vmsof are always tail agnostic, we could
check maskedoff value to decide mask policy rather than have a addtional
policy operand.
Reviewed By: craig.topper, arcbbb
Differential Revision: https://reviews.llvm.org/D122456
Zakk Chen [Wed, 30 Mar 2022 00:28:13 +0000 (17:28 -0700)]
Revert "[RISCV] Add policy operand for masked compare and vmsbf/vmsif/vmsof IR"
This reverts commit
10fd2822b77e12215b4ea82fc6d0a052961eb9d9.
I have a better implementation for those operations without the
additional policy operand.
masked compare and vmsbf/vmsif/vmsof are always tail agnostic so we could
assume undef maskedoff is mask agnostic.
Differential Revision: https://reviews.llvm.org/D122455
Dominic Chen [Wed, 30 Mar 2022 00:52:09 +0000 (17:52 -0700)]
Revert "[scudo] Wrap clang pragma to avoid GCC error"
Revert "[scudo] Add noreturn/pragma to suppress compiler warnings"
This reverts commit
686dcbe8b018759b5443c05bfeeb7abf4d9cf09c.
This reverts commit
030d8262a6e8055660ae74bdb7e4f22c741a1e17.
Dominic Chen [Wed, 16 Mar 2022 20:35:51 +0000 (13:35 -0700)]
[scudo] Provide allocator declaration
Ensure that extern allocator declaration is visible before definition
Differential Revision: https://reviews.llvm.org/D121848
Dominic Chen [Wed, 30 Mar 2022 00:36:33 +0000 (17:36 -0700)]
[scudo] Wrap clang pragma to avoid GCC error
Fixes: [scudo] Add noreturn/pragma to suppress compiler warnings
Differential Revision: https://reviews.llvm.org/D121853
Roland McGrath [Fri, 25 Sep 2020 18:53:12 +0000 (11:53 -0700)]
[lsan] On Fuchsia, don't use atexit hook for leak checks
This is a re-land of https://reviews.llvm.org/D86171 with fix.
Fuchsia's system libraries are instrumented and use the lsan
allocator for internal purposes. So leak checking needs to run
after all atexit hooks and after the system libraries' internal
exit-time hooks. The <zircon/sanitizer.h> hook API calls the
__sanitizer_process_exit_hook function at exactly the right time.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D88248
Michael Jones [Tue, 29 Mar 2022 23:33:58 +0000 (16:33 -0700)]
[libc][obvious] Add mfma to log2f
In the previous patch adding -mfma to functions that need it for windows
builds I missed log2f.
Differential Revision: https://reviews.llvm.org/D122693
Michael Jones [Tue, 29 Mar 2022 22:04:03 +0000 (15:04 -0700)]
[libc] Add mfma option to functions that use fma
On Windows the functions that use fma don't properly include the fma
intrinsics unless -mfma is added to the compile options. This patch adds
the compile option to all of the functions that need it.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D122689
Michael Jones [Tue, 29 Mar 2022 21:52:54 +0000 (14:52 -0700)]
[libc][obvious] fix sqrt when long double is double
Previously, the "fsqrt" instruction was used on all x86_64 platforms
for finding the square root of long doubles. On long double is double
platforms (e.g. windows) this created errors. This patch changes square
root function for long doubles to be the same as the one for doubles if
long doubles are doubles.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D122688
Akira Hatanaka [Tue, 29 Mar 2022 22:53:35 +0000 (15:53 -0700)]
Remove -O1 from command line of nrvo.cpp
Also, check that NRVO currently isn't performed in test25. The checks
were accidentally removed when https://reviews.llvm.org/D122425 disabled
inlining.
Jonas Devlieghere [Tue, 29 Mar 2022 00:14:44 +0000 (17:14 -0700)]
[lldb] Make ModuleSpecList iterable (NFC)
Chris Bieneman [Tue, 29 Mar 2022 20:47:49 +0000 (15:47 -0500)]
[HLSL] Fix MSFT Attribute parsing, add numthreads
HLSL uses Microsoft-style attributes `[attr]`, which clang mostly
ignores. For HLSL we need to handle known Microsoft attributes, and to
maintain C/C++ as-is we ignore unknown attributes.
To utilize this new code path, this change adds the HLSL `numthreads`
attribute.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D122627
Vince Bridgers [Fri, 25 Mar 2022 22:30:59 +0000 (17:30 -0500)]
[analyzer] Fix "RhsLoc and LhsLoc bitwidth must be same"
clang: <root>/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:727:
void assertEqualBitWidths(clang::ento::ProgramStateRef,
clang::ento::Loc, clang::ento::Loc): Assertion `RhsBitwidth ==
LhsBitwidth && "RhsLoc and LhsLoc bitwidth must be same!"'
This change adjusts the bitwidth of the smaller operand for an evalBinOp
as a result of a comparison operation. This can occur in the specific
case represented by the test cases for a target with different pointer
sizes.
Reviewed By: NoQ
Differential Revision: https://reviews.llvm.org/D122513
Yonghong Song [Tue, 29 Mar 2022 06:30:10 +0000 (23:30 -0700)]
BPF: support inlining __builtin_memcmp intrinsic call
Delyan Kratunov reported an issue where __builtin_memcmp is
not inlined into simple load/compare instructions.
This is a known issue. In the current state, __builtin_memcmp
will be converted to memcmp call which won't work for
bpf programs.
This patch added support for expanding __builtin_memcmp with
actual loads and compares up to currently maximum 128 total loads.
The implementation is identical to PowerPC.
Differential Revision: https://reviews.llvm.org/D122676
Shraiysh Vaishay [Tue, 29 Mar 2022 21:41:14 +0000 (03:11 +0530)]
[mlir][OpenMP] Fix memory leak by deleting unused value
Reviewed By: ftynse, rriddle
Differential Revision: https://reviews.llvm.org/D122633
Florian Hahn [Tue, 29 Mar 2022 21:52:42 +0000 (22:52 +0100)]
[LV] Handle zero cost loops in selectInterleaveCount.
In some case, like in the added test case, we can reach
selectInterleaveCount with loops that actually have a cost of 0.
Unfortunately a loop cost of 0 is also used to communicate that the cost
has not been computed yet. To resolve the crash, bail out if the cost
remains zero after computing it.
This seems like the best option, as there are multiple code paths that
return a cost of 0 to force a computation in selectInterleaveCount.
Computing the cost at multiple places up front there would unnecessarily
complicate the logic.
Fixes #54413.
Zixu Wang [Fri, 25 Mar 2022 22:15:08 +0000 (15:15 -0700)]
[clang][extract-api] Add Objective-C protocol support
Add support for Objective-C protocol declarations in ExtractAPI.
Depends on D122446
Differential Revision: https://reviews.llvm.org/D122511
Vitaly Buka [Tue, 29 Mar 2022 21:09:35 +0000 (14:09 -0700)]
[msan] Add link to the lifetime definition
Differential Revision: https://reviews.llvm.org/D122685
James Y Knight [Tue, 29 Mar 2022 21:32:52 +0000 (17:32 -0400)]
Fix memory leak in [Clang] Implement __builtin_source_location.
Fixes:
d61487490022
Zixu Wang [Fri, 25 Mar 2022 01:19:30 +0000 (18:19 -0700)]
[clang][extract-api] Add Objective-C interface support
Add support for Objective-C interface declarations in ExtractAPI.
Depends on D122495
Differential Revision: https://reviews.llvm.org/D122446
Dominic Chen [Wed, 16 Mar 2022 20:42:49 +0000 (13:42 -0700)]
[scudo] Add noreturn/pragma to suppress compiler warnings
Differential Revision: https://reviews.llvm.org/D121853
Dominic Chen [Tue, 29 Mar 2022 04:49:46 +0000 (21:49 -0700)]
[scudo] Add missing include for extern variable declaration
Add include to resolve compiler warning about no previous extern declaration for non-static HashAlgorithm
Differential Revision: https://reviews.llvm.org/D122630
Dominic Chen [Tue, 29 Mar 2022 04:52:04 +0000 (21:52 -0700)]
[scudo] Fix definition of canCache() function
The called member function has boolean type, change this function to match
Differential Revision: https://reviews.llvm.org/D122631
Dominic Chen [Tue, 29 Mar 2022 04:54:43 +0000 (21:54 -0700)]
[scudo] Initialize local variable to avoid compiler warning
Compiler warns about HeaderPos possibly being uninitialized which should not be possible, but just initialize it anyway
Differential Revision: https://reviews.llvm.org/D122632
Benjamin Kramer [Mon, 28 Mar 2022 12:10:26 +0000 (14:10 +0200)]
[linalg] When removing noop linalg.generics, check that inserting a cast is valid
linalg.generic can also take scalars instead of tensors, which
tensor.cast doesn't support. We don't have an easy way to cast between
scalars and tensors so just keep the linalg.generic in those cases.
Differential Revision: https://reviews.llvm.org/D122575
Eli Friedman [Fri, 25 Mar 2022 22:40:46 +0000 (15:40 -0700)]
[MC] Make MCAsmInfo::isAcceptableChar reflect MCAsmInfo::doesAllowAtInName
On targets which don't allow "@" in unquoted identifiers, make sure we
don't emit them; otherwise, we can't parse our own output.
Differential Revision: https://reviews.llvm.org/D122516
Vitaly Buka [Tue, 29 Mar 2022 20:29:07 +0000 (13:29 -0700)]
[NFC] clang-format sanitizer_interface_internal.h
Chris Bieneman [Tue, 29 Mar 2022 19:46:24 +0000 (14:46 -0500)]
NFC. Fixing warnings from adding DXContainer
Adds DXContainer to switch statements in Clang and LLDB to silence
warnings.
Chris Bieneman [Sat, 19 Mar 2022 19:33:39 +0000 (14:33 -0500)]
Add DXContainer
DXIL is wrapped in a container format defined by the DirectX 11
specification. Codebases differ in calling this format either DXBC or
DXILContainer.
Since eventually we want to add support for DXBC as a target
architecture and the format is used by DXBC and DXIL, I've termed it
DXContainer here.
Most of the changes in this patch are just adding cases to switch
statements to address warnings.
Reviewed By: pete
Differential Revision: https://reviews.llvm.org/D122062
Florian Hahn [Tue, 29 Mar 2022 19:27:59 +0000 (20:27 +0100)]
[LV] Move code to place pointer induction increment to VPlan post-processing.
This patch moves the code to set the correct incoming block for the
backedge value to VPlan::execute.
When generating the phi node, the backedge value is temporarily added
using the pre-header as incoming block. The invalid phi node will be
fixed up during VPlan::execute after main VPlan code generation.
At the same time, the backedge value is also moved to the latch.
This change removes the requirement to create the latch block up-front
for VPWidenInductionPHIRecipe::execute, which in turn will enable
modeling the pre-header in VPlan.
Depends on D121617.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D121618
Sanjay Patel [Tue, 29 Mar 2022 18:53:41 +0000 (14:53 -0400)]
[x86] consolidate tests and auto-gen complete check lines; NFC
The same test was duplicated in 2 files.
Markus Böck [Tue, 29 Mar 2022 18:45:41 +0000 (20:45 +0200)]
[clang][DR] Test and mark DR1305 as complete
DR: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1305
This DR has always been implemented in all clang versions as far back as I could go. This patch basically just adds a test with the needed comments to mark it as complete.
Differential Revision: https://reviews.llvm.org/D122674
wangyihan [Tue, 29 Mar 2022 18:38:29 +0000 (11:38 -0700)]
[Clang][CodeGen]Remove anonymous tag locations
Remove anonymous tag locations, powered by 'PrintingPolicy',
@aaron.ballman once suggested removing this extra information in
https://reviews.llvm.org/D122248
struct:
struct S {
int a;
struct /* Anonymous*/ {
int x;
} b;
int c;
};
Before:
struct S {
int a = 0
struct S::(unnamed at ./builtin_dump_struct.c:20:3) {
int x = 0
}
int c = 0
}
After:
struct S {
int a = 0
struct S::(unnamed) {
int x = 0
}
int c = 0
}
Differntial Revision: https://reviews.llvm.org/D122670
Chris Bieneman [Tue, 29 Mar 2022 17:57:49 +0000 (12:57 -0500)]
NFC. Fixing rebase error
Somehow managed to get a double-assignment in there. Thanks @erichkeane
for pointing it out!
Stanislav Mekhanoshin [Wed, 23 Mar 2022 18:59:08 +0000 (11:59 -0700)]
[AMDGPU] gfx940 VALU hazard recognizer
Differntial Revision: https://reviews.llvm.org/D122339
Mehdi Amini [Tue, 29 Mar 2022 17:39:05 +0000 (17:39 +0000)]
Revert "[Support/BLAKE3] Re-enable building with the simd-optimized implementations"
This reverts commit
23519d3000b4703f17e639534a38b4f221fa4f63.
This breaks the build with clang-5:
/usr/bin/clang-5.0 -DBUILD_EXAMPLES -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support/BLAKE3 -Illvm/lib/Support/BLAKE3 -Iinclude -Illvm/include -fPIC -O3 -DNDEBUG -MD -MT lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o -MF lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o.d -o lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o -c llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S
...
llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S:54:9: error: instruction requires: AVX-512 ISA
kmovw k1, r9d
^
Chris Bieneman [Mon, 28 Mar 2022 21:33:16 +0000 (16:33 -0500)]
[ADT] add initializer list specialization for is_contained
Adding an initializer list specialization for is_contained allows for
compile-time evaluation when called with a constant or runtime
evaluation for non-constant values.
This patch doesn't add any uses of this template, but that is coming in
a subsequent patch.
Reviewed By: pete
Differential Revision: https://reviews.llvm.org/D122079
wangyihan [Tue, 29 Mar 2022 17:30:34 +0000 (10:30 -0700)]
[Clang][doc][NFC]Remove duplicate items in ReleaseNotes
Remove duplicate items in ReleaseNotes for __builtin_dump_struct, the
code changes int patch https://reviews.llvm.org/D122248
Differential Revision: https://reviews.llvm.org/D122668
Zixu Wang [Fri, 25 Mar 2022 18:43:44 +0000 (11:43 -0700)]
[clang][extract-api] Use correct language info from inputs
The current way of getting the `clang::Language` from `LangOptions` does
not handle Objective-C correctly because `clang::Language::ObjC` does
not correspond to any `LangStandard`. This patch passes the correct
`Language` from the frontend input information.
Differential Revision: https://reviews.llvm.org/D122495
Arjun P [Tue, 29 Mar 2022 16:57:14 +0000 (17:57 +0100)]
[MLIR][Presburger] Simplify std::{all,any}_of -> llvm::{all,any}_of (NFC)
Also simplify [](const F &f){ return f.foo(); } -> std::mem_fn(&F::foo)
Zequan Wu [Mon, 28 Mar 2022 23:42:53 +0000 (16:42 -0700)]
[llvm-pdbutil] Fix a crash due to Expected not checked before destruction
Reviewed By: aganea
Differential Revision: https://reviews.llvm.org/D122622
Mogball [Tue, 29 Mar 2022 16:54:41 +0000 (16:54 +0000)]
[mlir][ods] Allow null to be passed as default-valued attributes
Allow default-valued attributes to be passed as null to builders, which will not add the attribute if not present, so the default value will be returned by getters.
Fangrui Song [Tue, 29 Mar 2022 16:51:41 +0000 (09:51 -0700)]
[ELF] --emit-relocs: adjust offsets of .rel[a].eh_frame relocations
Two code paths may reach the EHFrame case in SectionBase::getOffset:
* .eh_frame reference
* relocation copy for --emit-relocs
The first may be used by clang_rt.crtbegin.o and GCC crtbeginT.o to get the
start address of the output .eh_frame. The relocation has an offset of 0 or
(x86-64 PC-relative leaq for clang_rt.crtbegin.o) -4. The current code just
returns `offset`, which handles this case well.
The second is related to InputSection::copyRelocations on .eh_frame (used by
--emit-relocs). .eh_frame pieces may be dropped due to GC/ICF, so we should
convert the input offset to the output offset. Use the same way as
MergeInputSection with a special case handling outSecOff==-1 for an invalid
piece (see eh-frame-marker.s).
This exposes an issue in mips64-eh-abs-reloc.s that we don't reliably
handle anyway. Just add --no-check-dynamic-relocations to paper over it.
Differential Revision: https://reviews.llvm.org/D122459
Aaron Ballman [Tue, 29 Mar 2022 16:26:38 +0000 (12:26 -0400)]
Fix a test failure.
This amends
3c84e4a0dbd08fc03bbcdd8354a984e0efcf7672 which had an
unsaved change when committed.
Simon Pilgrim [Tue, 29 Mar 2022 16:15:25 +0000 (17:15 +0100)]
[X86] combineCarryThroughADD - remove unused peek through of SEXT/AEXT nodes.
Aaron Ballman [Tue, 29 Mar 2022 16:13:54 +0000 (12:13 -0400)]
[C11] Improve the diagnostic when accessing a member of an atomic struct
Member access for an atomic structure or union is unconditional
undefined behavior (C11 6.5.2.3p5). However, we would issue a confusing
error message about the base expression not being a structure or union
type.
GCC issues a warning for this case. Clang now warns as well, but the
warning is defaulted to an error because the actual access is still
unsafe.
This fixes Issue 54563.
Ron Lieberman [Tue, 29 Mar 2022 14:53:27 +0000 (14:53 +0000)]
[libomptarget] x86 offloading fails map_back_race.cpp intermittently
Differential Revision: https://reviews.llvm.org/D122658
Pavel Labath [Mon, 21 Mar 2022 13:52:22 +0000 (14:52 +0100)]
[lldb] Remove usages of case-insensitive c-string functions
They are not portable (which meant we had a hand-rolled implementation
for windows), and llvm::StringRef provides equivalent functionality.
Danny Mösch [Tue, 29 Mar 2022 15:58:05 +0000 (17:58 +0200)]
[clang-tidy] Fix test failing on 32-bit architectures due to missing `__int128_t`
This was caused by
ff60af91ac0bbab12dd5ff5dc9b78bc1636f2d86. The reason for the failure is that
the type `__int128_t` is not available on 32-bit architectures. So just exclude the test case if
128-bit integers are not available.
Fangrui Song [Tue, 29 Mar 2022 15:56:21 +0000 (08:56 -0700)]
[ELF] --emit-relocs: fix missing STT_SECTION when the first input section is synthetic
addSectionSymbols suppresses the STT_SECTION symbol if the first input section
is non-SHF_MERGE synthetic. This is incorrect when the first input section is synthetic
while a non-synthetic input section exists:
* `.bss : { *(COMMON) *(.bss) }`
(
abc388ed3cf0ef7e617ebe243d3b0b32d29e69a5 regressed the case because
COMMON symbols precede .bss in the absence of a linker script)
* Place a synthetic section in another section: `.data : { *(.got) *(.data) }`
For `%t/a1` in the new test emit-relocs-synthetic.s, ld.lld produces incorrect
relocations with symbol index 0.
```
0000000000000000 <_start>:
0: 8b 05 33 00 00 00 movl 51(%rip), %eax # 0x39 <bss>
0000000000000002: R_X86_64_PC32 *ABS*+0xd
6: 8b 05 1c 00 00 00 movl 28(%rip), %eax # 0x28 <common>
0000000000000008: R_X86_64_PC32 common-0x4
c: 8b 05 06 00 00 00 movl 6(%rip), %eax # 0x18
000000000000000e: R_X86_64_GOTPCRELX *ABS*+0x4
```
Fix the issue by checking every input section.
Reviewed By: ikudrin
Differential Revision: https://reviews.llvm.org/D122463
Louis Dionne [Thu, 24 Mar 2022 13:27:03 +0000 (09:27 -0400)]
[libc++] Use __builtin_expect and __builtin_assume in _LIBCPP_ASSERT
Since we expect the condition to be true most of the time, we might
as well tell the compiler. And when assertions are disabled, we
might as well tell the compiler that it's allowed to assume that
the condition holds.
Differential Revision: https://reviews.llvm.org/D122397
Louis Dionne [Tue, 29 Mar 2022 15:45:49 +0000 (11:45 -0400)]
[libc++][NFC] Fix typo in comment
Hirochika Matsumoto [Tue, 29 Mar 2022 14:51:59 +0000 (10:51 -0400)]
[InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2
https://alive2.llvm.org/ce/z/94yRMN
Fixes #54177
Differential Revision: https://reviews.llvm.org/D122077
Johannes Doerfert [Mon, 21 Mar 2022 21:02:42 +0000 (16:02 -0500)]
[OpenMP] Regenerate the check lines for 2 tests
Somehow those check lines were mostly untested prefixes and the ones we
were looking for have been removed. Simple cleanup.
Ivan Butygin [Mon, 28 Mar 2022 08:09:00 +0000 (11:09 +0300)]
[mlir][spirv] Mark SPV_UndefOp NoSideEffect
Differential Revision: https://reviews.llvm.org/D122561
Nikita Popov [Tue, 29 Mar 2022 14:51:55 +0000 (16:51 +0200)]
[InstCombine] Remove call to getPointerElementType()
This was erroneously re-introduced as part of
bb0b23174e4ab963df427393fbf21bddede499bf.
Chris Bieneman [Tue, 29 Mar 2022 14:42:57 +0000 (09:42 -0500)]
[ADT] Flesh out HLSL raytracing environments
Fleshing this out now allows me to rely on enum math to translate
values rather than having to translate the off cases.
I should have added this in the first pass, but wasn't thinking about
it.
Nathan Sidwell [Tue, 29 Mar 2022 11:43:16 +0000 (04:43 -0700)]
[demangler] Update node match calls
Each demangler node's match function needs to call the provided
functor with constructor arguments. That was omitted from D120905.
This adds the new Precedence argument where necessary (and a missing
boolean for a module node).
The two visitors need updating with a printer for that type, and this
adds a stub to cxa_demangle's version. blaikie added one to llvm's.
I'll fill out those printers in a followup, rather than wait, so that
downstream consumers are unbroken.
Louis Dionne [Mon, 28 Mar 2022 17:10:14 +0000 (13:10 -0400)]
[libc++][libc++abi] Serialize the enable_assertions Lit parameter in the generated config
This means that re-running with llvm-lit in that configuration will
work as expected. This also enables assertions in libc++abi in the
Generic-assertions CI job, which was disabled previously.
Differential Revision: https://reviews.llvm.org/D122597
Simon Pilgrim [Tue, 29 Mar 2022 11:24:46 +0000 (12:24 +0100)]
[X86] Regenerate x86-interleaved-access.ll with AVX1OR2 common check-prefix to reduce duplication
Thomas Preud'homme [Tue, 29 Mar 2022 09:12:35 +0000 (10:12 +0100)]
Clarify invariants of software pipelining hooks
PowerPC backend relies on each pair of prologue/epilogue of a software
pipelined loop to correspond to a single iteration a the loop through
its use of the BDZ instruction to skip inner prologues/epilogues and
loop kernel. However the interface does not make it clear that it is a
valid way to check that the trip count is big enough to execute inner
prologues/epilogues and kernel loop.
The API also does not specify in which order of prologues the
createTripCountGreaterCondition() hook is being called. Knowing that it
starts with the last/innermost prologues can help recording some
information when createTripCountGreaterCondition() is first executed and
reuse it in setPreheader() or adjustTripCount().
This commit documents both aspects.
Reviewed By: jmolloy
Differential Revision: https://reviews.llvm.org/D122642
Javier Setoain [Thu, 24 Mar 2022 16:07:19 +0000 (16:07 +0000)]
[mlir][vector][nfc] Rename index optimizations option
We are using "enable-index-optimizations" and "indexOptimizations" as
names for an optimization that consists of using i32 for indices within
a vector. For instance, when building a vector comparison for mask
generation. The name is confusing and suggests a scope beyond these
vector indices. This change makes the function of the option explicit
in its name.
Differential Revision: https://reviews.llvm.org/D122415
serge-sans-paille [Mon, 28 Mar 2022 13:59:47 +0000 (15:59 +0200)]
[doc] Rely on tblgen to dump supported options value when generating doc
It was already the case for CLI help, also support it for rst output. As a side
effect remove redundant (and sometime inconsistent!) value help from HelpText in
clang/Driver/Options.td.
Differential Revision: https://reviews.llvm.org/D122378
Jay Foad [Tue, 29 Mar 2022 10:05:07 +0000 (11:05 +0100)]
[AMDGPU] Generate checks in atomic_optimizations_*.ll
This had already been done for some of these files but not all.
Sven van Haastregt [Tue, 29 Mar 2022 09:16:27 +0000 (10:16 +0100)]
[OpenCL] opencl-c.h: remove a/b/c/i/p/n/v arg names
This simplifies completeness comparisons against OpenCLBuiltins.td and
also makes the header no longer "claim" any single-letter identifiers.
Continues the direction set out in D119560.
David Green [Tue, 29 Mar 2022 09:12:44 +0000 (10:12 +0100)]
[AArch64] Ensure fixed point fptoi_sat has correct saturation width
D113200 introduced an error where it was converting FP_TO_SI_SAT with
multiply to a fixed point floating point convert. The saturation
bitwidth needs to be equal to the floating point width, or else the
routine would truncate the result as opposed to saturating it.
Fixes #54601
Florian Hahn [Tue, 29 Mar 2022 08:59:03 +0000 (09:59 +0100)]
[ConstraintElimination] Move ConstraintInfo after ConstraintTy. (NFC)
Code movement to it slightly easier to use ConstraintTy & co in
ConstraintInfo directly, for follow-up patches.
Guillaume Chatelet [Fri, 25 Mar 2022 13:21:20 +0000 (13:21 +0000)]
[NFC][libc] Disable benchmarks when the LLVM benchmark target is not available
Fixes https://github.com/llvm/llvm-project/issues/53686
Differential Revision: https://reviews.llvm.org/D122481
Chenbing Zheng [Tue, 29 Mar 2022 08:34:52 +0000 (16:34 +0800)]
[DAGCombine] add tests for bswap-shift optimization
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D121504
Uday Bondhugula [Tue, 29 Mar 2022 07:18:54 +0000 (12:48 +0530)]
[MLIR][NFC] Remove dead FlatAffineConstraints constructor
NFC. Remove dead FlatAffineConstraints constructor.
Differential Revision: https://reviews.llvm.org/D122638
Zi Xuan Wu [Tue, 29 Mar 2022 07:42:06 +0000 (15:42 +0800)]
[CSKY] Add CSKYTargetObjectFile to support exception handling
Initialize TargetLoweringObjectFileELF and EH header.
Zi Xuan Wu [Tue, 29 Mar 2022 07:05:49 +0000 (15:05 +0800)]
[CSKY] Add missing codegen pattern for 16-bit instruction
In generic cpu model, there are only low 16 registers and little 32-bit instruction. CK801 is the cpu
family with least basic features like generic model.
Add test run and check for generic cpu model in original test case to cover basic LLVM IR functionality.
Liqin Weng [Tue, 29 Mar 2022 07:44:44 +0000 (15:44 +0800)]
[RISCV][NFC] Improve encoding/decoding tests for Zbb/Zbp/Zbt instructions
Reviewed By: benshi001
Differential Revision: https://reviews.llvm.org/D122282
Jean Perier [Mon, 28 Mar 2022 17:05:36 +0000 (19:05 +0200)]
[flang] prevent undefined behavior in character MAXLOC folding
When folding MAXLOC/MINLOC, the current element being compared was moved twice
in row in case it became the new extremum. With numeric and logical types, it
made no difference (std::move is a no-op for them), but for characters
where the string storage is actually moved, it caused the new extremum to
be set to the empty string, leading to wrong results.
Note: I could have left the first std::move relating to logical Findloc, but it
brings nothing and makes the code less auditable, so I also removed it.
Differential Revision: https://reviews.llvm.org/D122590
Lian Wang [Tue, 22 Mar 2022 06:07:17 +0000 (06:07 +0000)]
[RISCV][NFC] Remove redundant check and rename functions in some IR tests
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D122204
Markus Böck [Tue, 29 Mar 2022 07:28:17 +0000 (09:28 +0200)]
[clang][DR] Test and mark DR1479 as complete
DR: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1479
Clang has implemented this DR as far back as I could go on compiler explorer (3.0). This patch simply adds a test case and needed comments for the update script to mark it as complete.
Differential Revision: https://reviews.llvm.org/D122620
Argyrios Kyrtzidis [Tue, 29 Mar 2022 04:00:58 +0000 (21:00 -0700)]
[Support/BLAKE3] Re-enable building with the simd-optimized implementations
Serguei Katkov [Fri, 25 Mar 2022 03:19:01 +0000 (10:19 +0700)]
[LSR] Fixup canonicalization formula and its checker.
According to definition of canonical form, it is a canonical
if scale reg does not contain addrec for loop L then none of bases
should contain addrec for this loop.
The critical word here is "contains".
Current checker of canonical form checks not "containing" property
but "is". So it does not check whether it contains but whether it is.
Fix the checker and canonicalizing utility to follow definition.
Without this fix in the test attached the base formula looking as
reg((-1 * {0,+,8}<nuw><nsw><%bb2>)<nsw>) + 1*reg((8 * (%arg /u 8))<nuw>)
is considered as conanocial while base contains an addrec.
And modified formula we want to insert
reg({0,+,8}<nuw><nsw><%bb2>) + 1*reg((-8 * (%arg /u 8)))
is considered as not canonical.
Reviewed By: mkazantsev
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D122457
serge-sans-paille [Mon, 28 Mar 2022 12:10:26 +0000 (14:10 +0200)]
Cleanup includes: final pass
Cleanup a few extra files, this closes the work on libLLVM dependencies on my
side.
Impact on libLLVM preprocessed output: -35876 lines
Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D122576
luxufan [Tue, 29 Mar 2022 03:03:33 +0000 (11:03 +0800)]
[RISCV][test] Make PATH empty when testing --gcc-toolchain is multilib_riscv_elf_sdk
Due to D79842, clang dirver would search possible tool name in both possible
locations, then moving to the next name. The gcc toolchain `llvm-project/clang/test/Driver/
Inputs/multilib_riscv_elf_sdk` don't have a `riscv64-unknown-elf-ld` executable in
`llvm-project/clang/test/Driver/Inputs/multilib_riscv_elf_sdk/bin/`. So when searching
`riscv64-unknown-elf-ld`, if there is a `riscv64-unknown-elf-ld` in `PATH`, the
test would fail.
This patch makes the `PATH` empty when testing it.
Differential Revision: https://reviews.llvm.org/D122588
Liqin Weng [Tue, 29 Mar 2022 06:46:17 +0000 (14:46 +0800)]
[RISCV] Optimize LI+SLT to SLTI+XORI for immediates in specific range
This transform will reduce one GPR.
Reviewed By: craig.topper, benshi001
Differential Revision: https://reviews.llvm.org/D122051
LLVM GN Syncbot [Tue, 29 Mar 2022 06:21:57 +0000 (06:21 +0000)]
[gn build] Port
90cb325abda9
Paul Kirth [Tue, 29 Mar 2022 06:20:30 +0000 (06:20 +0000)]
Revert "[misexpect] Re-implement MisExpect Diagnostics"
This reverts commit
2add3fbd976d7b80a3a7fc14ef0deb9b1ca6beee.
Paul Kirth [Tue, 29 Mar 2022 06:19:53 +0000 (06:19 +0000)]
Revert "[docs][misexpect][NFC] Fix malformed table in docs"
This reverts commit
a427e18896dee3cd00d5f565cfb9d7d2f26ebcec.
Shraiysh Vaishay [Tue, 29 Mar 2022 05:12:45 +0000 (10:42 +0530)]
[flang][OpenMP] Added parallel sections translation
This patch adds translation for parallel sections from PFT to MLIR.
Reviewed By: kiranchandramohan, NimishMishra
Differential Revision: https://reviews.llvm.org/D122464