Stefan Gränitz [Wed, 23 Nov 2022 10:19:13 +0000 (11:19 +0100)]
[ObjC][ARC] Fix UB in ObjCARCOpt with -enable-objc-arc-opts=false
When ObjCARCOpt::run() returned early, Changed and CFGChanged were never initialized. CFGChanged is read unconditionally afterwards. This came up in the course of D137942.
Benjamin Kramer [Wed, 23 Nov 2022 09:45:15 +0000 (10:45 +0100)]
[bazel] Add missing dependencies after
7a69a9d7ae
Alex Richardson [Mon, 20 Jun 2022 14:44:57 +0000 (15:44 +0100)]
[libc++] Fix __regex_word value when using newlib/picolibc
The ctype mask for newlib/picolibc is fully saturated, so __regex_word
has to overlap with one of the values. This commit uses the same workaround
as bionic did (uint16_t for char_class_type inside regex_traits). It
should be possible to have libc++ provide the default rune table instead,
but that will require a new mechanism to detect newlib inside __config
since the header defining the newlib/picolibc macros has not been included
yet inside __config. Doing it this way also avoids duplicating the ctype
table for newlib, reducing the global data size.
Differential Revision: https://reviews.llvm.org/D138195
Alex Richardson [Mon, 21 Nov 2022 12:46:00 +0000 (12:46 +0000)]
[SelectionDAG] Remove deprecated MemSDNode->getAlignment()
I noticed a an assertion error when building MIPS code that loaded from
NULL. Loading from NULL ends up being a load with maximum alignment, and
due to integer truncation the value maximum was interpreted as 0 and the
assertion in MipsDAGToDAGISel::Select() failed. This previously happened
to work, but the maximum alignment was increased in
df84c1fe78130a86445d57563dea742e1b85156a, so it no longer fits into a 32
bit integer.
Instead of just fixing the one MIPS case, this patch removes all uses of
the deprecated getAlignment() call and replaces them with getAlign().
Differential Revision: https://reviews.llvm.org/D138420
Alex Richardson [Tue, 22 Nov 2022 10:01:18 +0000 (10:01 +0000)]
[ASTContext][NFC] Remove getTargetAddressSpace(Qualifiers Q)
This simply calls getTargetAddressSpace(Q.getAddressSpace()) and there
are only two callers, so adjust those caller instead.
Kito Cheng [Mon, 21 Nov 2022 14:18:54 +0000 (22:18 +0800)]
[clang][RISCV][NFC] Prevent data race in RVVType::computeType
Introduce a RVVTypeCache to hold the cache instead of using a local
static variable to maintain a cache.
Also made construct of RVVType to private, make sure that could be only
created by a cache manager.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D138429
Akshay Baviskar [Wed, 23 Nov 2022 08:16:18 +0000 (13:46 +0530)]
Add RegionBranchOpInterface for AffineIf Op
Adds RegionBranchOpInterface for AffineIf Op and tests it
using buffer deallocation pass.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D130962
Matthias Springer [Wed, 23 Nov 2022 08:19:00 +0000 (09:19 +0100)]
[mlir][tensor/memref] Disallow Collapse/ExpandShapeOps that do not reduce/increase the rank
CollapseShapeOp/ExpandShapeOp that do not change the rank (or increase/reduce it) are invalid.
Differential Revision: https://reviews.llvm.org/D138498
Nicolas Vasilache [Tue, 22 Nov 2022 10:55:58 +0000 (02:55 -0800)]
[NFC][mlir] VectorUtils / IndexingUtils simplifications and cleanups
This revision refactors and cleans up a bunch of infra related to vector, shapes and indexing into more reusable APIs.
Differential Revision: https://reviews.llvm.org/D138501
Max Kazantsev [Wed, 23 Nov 2022 07:38:24 +0000 (14:38 +0700)]
[SCEV][NFC] Fix typo in comment
WuXinlong [Tue, 22 Nov 2022 09:35:36 +0000 (17:35 +0800)]
Add MC support of RISCV Zcf Extension
This patch add the instructions of Zcf extension.
Zcf is a subset of C Ext which include the single-precision floating-point instructions.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D134176
Tom Stellard [Wed, 23 Nov 2022 06:56:55 +0000 (22:56 -0800)]
libclc: Use cmake files instead of llvm-config
Reviewed By: mgorny
Differential Revision: https://reviews.llvm.org/D137854
Michał Górny [Sat, 19 Nov 2022 19:54:54 +0000 (20:54 +0100)]
[cmake] Fix Findzstd.cmake to handle OpenBSD shared libraries
Fix Findzstd CMake to handle shared libraries on OpenBSD correctly.
This userland does not use shared library symlinks without SOVERSION,
so the result of find_library() does not ever end with
zstd_SHARED_LIBRARY_SUFFIX. To work around this, reverse the logic
to compare the result against zstd_STATIC_LIBRARY_SUFFIX and assume
shared library otherwise.
While at it, fix the conditions not to fall back to "result is static
library" path if it actually was recognized as a shared library but
zstd_shared target already existed.
Fixes #59056
Differential Revision: https://reviews.llvm.org/D138361
Fangrui Song [Wed, 23 Nov 2022 04:09:15 +0000 (20:09 -0800)]
[ELF] createSyntheticSections: simplify config->relocatable. NFC
We can add .riscv.attributes synthetic section here in the future.
Philip Reames [Wed, 23 Nov 2022 02:51:23 +0000 (18:51 -0800)]
[RISCV] Add callback plumbing for getArithmeticInstrCost [nfc]
Most of the code for this was taken from https://reviews.llvm.org/D133552, with one bug fix by me. I'm landing the plumbing so that we can focus on the cost model pieces in the review.
Daniel Rodríguez Troitiño [Wed, 23 Nov 2022 02:27:23 +0000 (18:27 -0800)]
[MachO][ObjCopy] Handle exports trie in LC_DYLD_INFO and LC_DYLD_EXPORTS_TRIE
The exports trie used to be pointed by the information in LC_DYLD_INFO,
but when chained fixups are present, the exports trie is pointed by
LC_DYLD_EXPORTS_TRIE instead.
Modify ObjCopy code to calculate the right offset and size needed
depending on the existence of LC_DYLD_INFO or LC_DYLD_EXPORTS_TRIE, read
the exports from either of those places, and write the export
information as pointed to either of those places.
Depends on D134571.
Reviewed By: alexander-shaposhnikov
Differential Revision: https://reviews.llvm.org/D137879
Matt Arsenault [Wed, 23 Nov 2022 02:02:20 +0000 (21:02 -0500)]
GlobalIFunc: Make ifunc respect function address spaces
Matt Arsenault [Fri, 11 Nov 2022 19:54:55 +0000 (11:54 -0800)]
InstCombine: Fold some identities for canonicalize
Equality is directly stated as true in the LangRef,
and I believe this works for every compare type.
Matt Arsenault [Fri, 11 Nov 2022 19:24:09 +0000 (11:24 -0800)]
InstCombine: Add baseline tests for canonicalize identities
Haohai Wen [Wed, 23 Nov 2022 01:40:50 +0000 (09:40 +0800)]
[CostModel][X86] Add CostKinds test coverage for shufflevector instruction
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D138485
Ruiling Song [Mon, 21 Nov 2022 07:33:18 +0000 (15:33 +0800)]
[AMDGPU][InsertWaits] No wait for WAW for global/scratch_load
global/scratch_load will return in order they are issued. No
need to insert a s_waitcnt for WAW hazard.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D138476
Daniel Rodríguez Troitiño [Tue, 22 Nov 2022 23:12:27 +0000 (15:12 -0800)]
[MachO] Support exports trie in both LC_DYLD_INFO and LC_DYLD_EXPORTS_TRIE
The exports trie used to be pointed by the information in LC_DYLD_INFO,
but when chained fixups are present, the exports trie is pointed by
LC_DYLD_EXPORTS_TRIE instead.
Modify the Object library to give access to the information pointed by
each of the load commands, and to fallback from one into the other when
the exports are requested.
Modify ObjectYAML to support dumping the export trie when pointed by
LC_DYLD_EXPORTS_TRIE and to parse the existence of a export trie also
when the load command is present.
This is a split of D134250 with improvements on top.
Reviewed By: alexander-shaposhnikov
Differential Revision: https://reviews.llvm.org/D134571
Phoebe Wang [Wed, 23 Nov 2022 01:05:59 +0000 (09:05 +0800)]
[X86] Use lock add/sub/or/and/xor for cases that we only care about the EFLAGS (negated cases)
This fixes #58685
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D138428
Xiang Li [Wed, 23 Nov 2022 01:34:45 +0000 (17:34 -0800)]
[NFC][DirectX backend] Update header to fix build error.
Fix build error caused by createPrintModulePass moving to diffrent
header.
Ben Shi [Thu, 17 Nov 2022 12:35:55 +0000 (20:35 +0800)]
[AVR] Fix wrong ABI of AVRTiny.
A scalar which exceeds 4 bytes should be returned via stack, other
than via registers, on an AVRTiny device.
Reviewed By: aykevl
Differential Revision: https://reviews.llvm.org/D138201
Nico Weber [Fri, 18 Nov 2022 21:02:34 +0000 (16:02 -0500)]
[bolt] Stop setting config.llvm_plugin_ext in lit.site.cfg.py.in
config.llvm_plugin_ext is used by lit to set the %pluginext
substitution. bolt's tests don't use %pluginext, so they don't
need to set config.llvm_plugin_ext.
Differential Revision: https://reviews.llvm.org/D138325
chenglin.bi [Wed, 23 Nov 2022 01:27:26 +0000 (09:27 +0800)]
[DAGCombiner] fold or (xor x, y),? patterns
or (xor x, y), x --> or x, y
or (xor x, y), y --> or x, y
or (xor x, y), (and x, y) --> or x, y
or (xor x, y), (or x, y) --> or x, y
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D138401
Fangrui Song [Wed, 23 Nov 2022 01:01:39 +0000 (17:01 -0800)]
[PPC] Undefine __ppc64__ to match GCC
GCC only defines `__ppc64__` for darwin while the darwin support has been
removed from llvm-project. The existence of `__ppc64__` makes some software
think we are compiling for big-endian PowerPC Mac; also it lures users to write
code which is not portable to GCC.
It is straightforward if a distro wants to keep the macro: add
`-D__ppc64__=1` to a Clang configuration file.
Reviewed By: thesamesam, nemanjai
Differential Revision: https://reviews.llvm.org/D137511
Peiming Liu [Wed, 23 Nov 2022 00:43:10 +0000 (00:43 +0000)]
[mlir][sparse] fix compiler warning when using release build.
Differential Revision: https://reviews.llvm.org/D138533
Mehdi Amini [Thu, 17 Nov 2022 10:40:56 +0000 (10:40 +0000)]
Apply clang-tidy fixes for readability-simplify-boolean-expr in CSE.cpp (NFC)
Mehdi Amini [Thu, 17 Nov 2022 10:15:21 +0000 (10:15 +0000)]
Apply clang-tidy fixes for llvm-include-order in FileUtilities.cpp (NFC)
Fangrui Song [Wed, 23 Nov 2022 00:47:33 +0000 (16:47 -0800)]
[asan] Don't demangle __odr_asan_gen_* symbols
This relands the ODR indicator part of D138095 (reverted by
06c74b5e7367b41e9b4ea3d74c971aace5681fb8):
a `__odr_asan_gen_*` symbol should use a mangled name as its associated symbol does.
Alexander Yermolovich [Wed, 23 Nov 2022 00:28:11 +0000 (16:28 -0800)]
[BOLT][DWARF] Re-enable DWARF5 for asm-func-debug tests
Now that BOLT supports DWARF5 re-enabling it for these two tests. This is update
to https://reviews.llvm.org/D125366
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D138338
Fangrui Song [Wed, 23 Nov 2022 00:29:24 +0000 (16:29 -0800)]
Revert D138095 Use InernalAlloc in DemangleCXXABI
Broke 2/3 tests on macOS which seem to be related to
`free(demangled_name)` in DemangleCXXABI.
Roman Lebedev [Wed, 23 Nov 2022 00:21:25 +0000 (03:21 +0300)]
[SROA] `isVectorPromotionViable()`: avoid allowing overly large vectors
Otherwise, `compiler-rt/test/asan/TestCases/pr33372.cpp` fails with an assertion:
```
clang-16: /repositories/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:11988: void llvm::SelectionDAG::createOperands(llvm::SDNode *, ArrayRef<llvm::SDValue>): Assertion `SDNode::getMaxNumOperands() >= Vals.size() && "too many operands to fit into SDNode"' failed.
```
I'm not sure if this should be even more conservative,
or if we have a named constant for this in middle-end.
Ayke van Laethem [Mon, 7 Nov 2022 17:46:38 +0000 (18:46 +0100)]
[AVR][Clang] Implement __AVR_HAVE_*__ macros
These macros are defined in avr-gcc and are useful when working with
assembly. For example, startup code needs to copy the contents of .data
from flash to RAM, but should use elpm (instead of lpm) on devices with
more than 64kB flash. Without __AVR_HAVE_ELPM__, there is no way to know
whether the elpm instruction is supported.
This partially fixes https://github.com/llvm/llvm-project/issues/56157.
Differential Revision: https://reviews.llvm.org/D137572
Peiming Liu [Thu, 17 Nov 2022 01:46:15 +0000 (01:46 +0000)]
[mlir][sparse] make resolve cycle works with affine expressions.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D138173
Peiming Liu [Thu, 17 Nov 2022 01:23:57 +0000 (01:23 +0000)]
[mlir][sparse] support affine expression on sparse dimensions (codegen implementation)
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D138172
Peiming Liu [Thu, 17 Nov 2022 01:20:11 +0000 (01:20 +0000)]
[mlir][sparse] support affine expression on sparse dimensions (analysis implementation)
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D138171
Zequan Wu [Tue, 22 Nov 2022 23:46:49 +0000 (15:46 -0800)]
Fix lto AddStream callsite in gold plugin.
Roman Lebedev [Tue, 22 Nov 2022 22:28:32 +0000 (01:28 +0300)]
[SROA] `isVectorPromotionViable()`: memory intrinsics operate on vectors of bytes
Now, there's a big caveat here - these bytes
are abstract bytes, not the i8 we have in LLVM,
so strictly speaking this is not exactly legal,
see e.g. https://github.com/AliveToolkit/alive2/issues/860
^ the "bytes" "could" have been a pointer,
and loading it as an integer inserts an implicit ptrtoint.
But at the same time,
InstCombine's `InstCombinerImpl::SimplifyAnyMemTransfer()`
would expand a memtransfer of 1/2/4/8 bytes
into integer-typed load+store,
so this isn't exactly a new problem.
Note that in memory, poison is byte-wise,
so we really can't widen elements,
but SROA seems to be inconsistent here.
Fixes #59116.
Roman Lebedev [Tue, 22 Nov 2022 22:25:49 +0000 (01:25 +0300)]
[NFC][AMDGPU] Rewrite two test files to avoid completely simplifying away after next patch
Roman Lebedev [Mon, 21 Nov 2022 22:05:49 +0000 (01:05 +0300)]
[NFC][SROA] Autogenerate check lines in some tests being affected by upcoming change
Roman Lebedev [Mon, 21 Nov 2022 22:01:25 +0000 (01:01 +0300)]
[NFC][SROA] Add some more tests for vector promotion
David Blaikie [Wed, 3 Aug 2022 17:13:42 +0000 (17:13 +0000)]
[libcxx] Add _LIBCPP_NODEBUG to std::conditional related typedfs
Looks like std::conditional wasn't included in
14d4869209cc8ff9a53aaa5a59d6409fbc1c5f5d
(& maybe other typedefs that should be using this technique either got
missed or have regressed since that change was made)
This was noticed by a 1.4% clang.dwp regression due to
f4fb72e6d4cee1097e6606e66232fe55e793cd86 introducing more instantiations
of std::conditional - this change reduces that regression to 0.6% at
least.
I'm also looking at other instantiations caused by that change that
might be able to be addressed - but a quick grep shows ~200 "type"
typedefs missing _LIBCPP_NODEBUG, so maybe a systematic application of
the typedef might be suitable?
Differential Revision: https://reviews.llvm.org/D131082
James Y Knight [Tue, 22 Nov 2022 18:35:43 +0000 (13:35 -0500)]
Refactor AsmPrinterHandler callbacks. NFCI.
The existing behaviors and callbacks were overlapping and had very
confusing semantics: beginBasicBlock/endBasicBlock were not always
called, beginFragment/endFragment seemed like they were meant to mean
the same thing, but were slightly different, etc. This resulted in
confusing semantics, virtual method overloads, and control flow.
Remove the above, and replace with new beginBasicBlockSection and
endBasicBlockSection callbacks. And document them.
These are always called before the first and after the last blocks in
a function, even when basic-block-sections are disabled.
Sami Tolvanen [Thu, 18 Aug 2022 23:53:09 +0000 (23:53 +0000)]
Add generic KCFI operand bundle lowering
The KCFI sanitizer emits "kcfi" operand bundles to indirect
call instructions, which the LLVM back-end lowers into an
architecture-specific type check with a known machine instruction
sequence. Currently, KCFI operand bundle lowering is supported only
on 64-bit X86 and AArch64 architectures.
As a lightweight forward-edge CFI implementation that doesn't
require LTO is also useful for non-Linux low-level targets on
other machine architectures, add a generic KCFI operand bundle
lowering pass that's only used when back-end lowering support is not
available and allows -fsanitize=kcfi to be enabled in Clang on all
architectures.
This relands commit
eb2a57ebc7aaad551af30462097a9e06c96db925 with
fixes.
Reviewed By: nickdesaulniers, MaskRay
Differential Revision: https://reviews.llvm.org/D135411
Zequan Wu [Tue, 22 Nov 2022 22:59:43 +0000 (14:59 -0800)]
Fix lto AddStreamFn in gold plugin.
Peiming Liu [Wed, 16 Nov 2022 23:18:16 +0000 (23:18 +0000)]
[mlir][sparse] support constant affine expression on dense dimension
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D138170
David Tenty [Fri, 18 Nov 2022 23:33:12 +0000 (18:33 -0500)]
[lit][AIX] Add LIBPATH to pass through env vars
AIX uses LIBPATH to specify the library search path in addition to
LD_LIBRARY_PATH, and a lot of users / tooling will use it
preferentially. In lit we currently pass through LD_LIBRARY_PATH but not
LIBPATH in the env on AIX, this patch corrects this inconsistency.
Differential Revision: https://reviews.llvm.org/D138510
Jeffrey Tan [Fri, 30 Sep 2022 18:38:02 +0000 (11:38 -0700)]
Add runToBinaryEntry option for lldb-vscode
This patch adds a new runToBinaryEntry option which sets a one-shot breakpoint
at program entry. This option is useful for synchronizing module loading with
dynamic loader to measure debugger startup performance: when program entry
one-short breakpoint hits most of the dependency modules should have been
loaded so this provides a good sample point for debugger startup time.
More explicitly for lldb-vscode, when this option is enabled, "Initialized" DAP
event is synchronously sent after most dependency modules are loaded.
Differential Revision: https://reviews.llvm.org/D135798
Zequan Wu [Tue, 22 Nov 2022 21:46:42 +0000 (13:46 -0800)]
Reland "[LTO][COFF] Use bitcode file names in lto native object file names."
This reverts commit
34108082947c964ae9bbfcd9808f2fd31c0d672f with fixes.
Zequan Wu [Tue, 22 Nov 2022 21:42:54 +0000 (13:42 -0800)]
Fix localCache in gold plugin.
Roman Lebedev [Tue, 22 Nov 2022 21:39:11 +0000 (00:39 +0300)]
Revert "Reland "[LTO][COFF] Use bitcode file names in lto native object file names.""
Breaks build of LLVMgold here:
```
/repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1108:19: error: no matching function for call to 'localCache'
Cache = check(localCache("ThinLTO", "Thin", options::cache_dir, AddBuffer));
^~~~~~~~~~
/repositories/llvm-project/llvm/include/llvm/Support/Caching.h:72:21: note: candidate function not viable: no known conversion from '(lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1102:20)' to 'llvm::AddBufferFn' (aka 'function<void (unsigned int, const llvm::Twine &, std::unique_ptr<MemoryBuffer>)>') for 4th argument
Expected<FileCache> localCache(
^
/repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1110:18: error: no viable conversion from '(lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' to 'llvm::AddStreamFn' (aka 'function<Expected<std::unique_ptr<CachedFileStream>> (unsigned int, const llvm::Twine &)>')
check(Lto->run(AddStream, Cache));
^~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:375:7: note: candidate constructor not viable: no known conversion from '(lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' to 'std::nullptr_t' for 1st argument
function(nullptr_t) noexcept
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:386:7: note: candidate constructor not viable: no known conversion from '(lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' to 'const std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream>> (unsigned int, const llvm::Twine &)> &' for 1st argument
function(const function& __x)
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:404:7: note: candidate constructor not viable: no known conversion from '(lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' to 'std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream>> (unsigned int, const llvm::Twine &)> &&' for 1st argument
function(function&& __x) noexcept
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:435:2: note: candidate template ignored: requirement '_Callable<(lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20) &, (lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20), std::__invoke_result<(lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20) &, unsigned int, const llvm::Twine &>>::value' was not satisfied [with _Functor = (lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20) &]
function(_Functor&& __f)
^
/repositories/llvm-project/llvm/include/llvm/LTO/LTO.h:278:25: note: passing argument to parameter 'AddStream' here
Error run(AddStreamFn AddStream, FileCache Cache = nullptr);
^
```
This reverts commit
387620aa8cea33174b6c1fb80c1af713fee732ac.
Fangrui Song [Tue, 22 Nov 2022 21:33:34 +0000 (13:33 -0800)]
[libc++] Replace __ppc64__ with __powerpc64__ and fix is_iec559 for non-ibm128
The lowercase `__ppc64__` is not defined by non-darwin powerpc64 GCC, therefore
it lures users to write code which is not portable to GCC. Migrate to
`__powerpc64__` in preparation for undefining `__ppc64__`. `__powerpc64__` is
much more common than `__PPC64__`.
Update alignment_of.pass.cpp to use 1 unconditionally:
on powerpc-unknown-linux-gnu `alignof(bool) = _Alignof(bool) = __alignof(bool) = 1`.
The value 4 might be derived from an ancient Clang.
Change is_iec559 to true when long double uses uses IEEE 754 quadruple or double
precision (i.e. not ibm128).
Reviewed By: #libc, thesamesam, ldionne
Differential Revision: https://reviews.llvm.org/D137513
Louis Dionne [Tue, 22 Nov 2022 21:26:43 +0000 (16:26 -0500)]
[libc++][NFC] Add missing #ifdef for TEST_HAS_NO_WIDE_CHARACTERS
Nancy Wang [Tue, 22 Nov 2022 19:31:51 +0000 (14:31 -0500)]
XFAIL hidden-duplicates.m for AIX and zOS
as this is failing on the build bots:
https://lab.llvm.org/buildbot/#/builders/214/builds/4442/steps/6/logs/FAIL__Clang__hidden-duplicates_m
and is being investigate under https://reviews.llvm.org/D130327.
Roman Lebedev [Tue, 22 Nov 2022 21:04:06 +0000 (00:04 +0300)]
[SROA] `isVectorPromotionViable()`: integer-ify non-pointer non-common types
This rectifies a FIXME that dates all the way back
to 2014 about not doing so due to the backend issues.
Presumably sufficient amount of time has passes
and all the known issues have been addressed,
or at least we will find out of there are some left...
Roman Lebedev [Tue, 22 Nov 2022 16:54:39 +0000 (19:54 +0300)]
[SROA] `isVectorPromotionViable()`: pointer-ness is sticky
As it has been established previously by precedent,
if we see a pointer type, then that is the type we must use.
Essentially, we don't want to introduce `inttoptr`'s.
Jay Foad [Tue, 22 Nov 2022 18:40:22 +0000 (18:40 +0000)]
[AMDGPU] More cleanup after D117544. NFC.
Fangrui Song [Tue, 22 Nov 2022 20:59:45 +0000 (12:59 -0800)]
[ELF] -r: don't define _TLS_MODULE_BASE_
_TLS_MODULE_BASE_ is supposed to be defined by the final link. Defining it in a
relocatable link may render the final link value incorrect.
GNU ld i386/x86-64 have the same issue: https://sourceware.org/bugzilla/show_bug.cgi?id=29820
Yingchi Long [Fri, 11 Nov 2022 14:45:08 +0000 (22:45 +0800)]
[Sema] check InitListExpr format strings like {"foo"}
Adds InitListExpr case in format string checks.
e.g.
int sprintf(char *__restrict, const char * __restrict, ...);
int foo()
{
char data[100];
constexpr const char* fmt2{"%d"}; // no-warning
sprintf(data, fmt2, 123);
}
Fixes: https://github.com/llvm/llvm-project/issues/58900
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D137839
Fangrui Song [Tue, 22 Nov 2022 20:37:51 +0000 (12:37 -0800)]
[ELF] -r: don't define __global_pointer$
This symbol is supposed to be defined by the final executable link. The new
behavor matches GNU ld.
Davide Italiano [Tue, 22 Nov 2022 20:29:44 +0000 (12:29 -0800)]
[X86] Don't lower f16->f80 fpext to libcall on darwin.
We don't provide __extendhfxf2, and only have the soft-float
__extendhfsf2 in compiler-rt. This only changed recently with
655ba9c8a1d2, so this patch reverts back to the previous behavior.
However, the f80->f16 fptrunc is not easily implementable without
the compiler-rt __truncxfhf2, but that has always been true, and
isn't an immediate regression.
Patch by Ahmed Bougacha.
rdar://
102194995
Michael Maitland [Tue, 22 Nov 2022 00:02:47 +0000 (16:02 -0800)]
[llvm-mca] Fix class dominance warnings for parseCodeRegions
Fixes issue [59091](https://github.com/llvm/llvm-project/issues/59091).
`CodeRegionGenerator::parseCodeRegions` is implemented by `AsmCodeRegionGenerator`.
If it were to be implemented in `AnalysisRegionGenerator` or `InstrumentRegionGenerator`,
then `parseCodeRegions` from an `AsmAnalysisRegionGenerator` or `AsmInstrumentRegionGenerator`
object would be ambiguous. To solve this, `AsmAnalysisRegionGenerator` and
`AsmInstrumentRegionGenerator` qualify their call to `AsmCodeRegionGenerator::parseCodeRegions`.
Differential Revision: https://reviews.llvm.org/D138462
Shoaib Meenai [Mon, 21 Nov 2022 23:59:42 +0000 (15:59 -0800)]
[libcxxabi] Always use thread_local for cxa_exception_storage
This was previously guarded by HAS_THREAD_LOCAL, which was never set by
CMake and had to be specified manually. Android has been setting this to
solve https://github.com/android/ndk/issues/1200 [1], but every compiler
and platform libc++abi supports should have thread_local by now, so we
can just get rid of the fallback implementation and simplify things
significantly (including removing the now unused fallback calloc).
[1] https://android-review.googlesource.com/c/toolchain/llvm-project/+/1285596
Reviewed By: #libc_abi, MaskRay, ldionne
Differential Revision: https://reviews.llvm.org/D138461
Ikhlas Ajbar [Tue, 22 Nov 2022 20:19:36 +0000 (12:19 -0800)]
[Hexagon] Add missing patterns for select
Fixes https://github.com/llvm/llvm-project/issues/59077.
Benjamin Kramer [Tue, 22 Nov 2022 20:12:42 +0000 (21:12 +0100)]
[VectorCombine] Don't touch instruction after foldSingleElementStore, it might be deleted
Use after free found by asan.
Mitch Phillips [Tue, 22 Nov 2022 18:27:46 +0000 (10:27 -0800)]
Make -fsanitize=scudo use scudo_standalone. Delete check-scudo.
Leaves the implementation and tests files in-place for right now, but
deletes the ability to build the old sanitizer-common based scudo. This
has been on life-support for a long time, and the newer scudo_standalone
is much better supported and maintained.
Also patches up some GWP-ASan wording, primarily related to the fact
that -fsanitize=scudo now is scudo_standalone, and therefore the way to
reference the GWP-ASan options through the environment variable has
changed.
Future follow-up patches will delete the original scudo, and migrate all
its tests over to be part of the scudo_standalone test suite.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D138157
Stefan Gränitz [Tue, 22 Nov 2022 19:51:09 +0000 (20:51 +0100)]
Revert "[CGObjC] Add run line for release mode in test arc-exceptions-seh.mm (NFC)"
This reverts commit
01023bfcd33f922ed8c934ce563e54abe8bfe246. The extended test now triggers undefined behavior:
```
/b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp:577:41: runtime error: load of value 180, which is not a valid value for type 'bool'
#0 0xaaaae3333a30 in hasCFGChanged /b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp:577:41
#1 0xaaaae3333a30 in llvm::ObjCARCOptPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /b/sanitizer-aarch64-linux-bootstrap-ubsan/build/llvm-project/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp:2494:26
...
```
Fangrui Song [Tue, 22 Nov 2022 19:38:57 +0000 (11:38 -0800)]
[ELF] addRelIpltSymbols: make it explicit some passes are for non-relocatable links. NFC
and prepare for __global_pointer$ and _TLS_MODULE_BASE_ fix.
Rong Xu [Tue, 22 Nov 2022 19:22:38 +0000 (11:22 -0800)]
[CHR] Add a threshold for the code duplication
ControlHeightReduction (CHR) clones the code region to reduce the
branches in the hot code path. The number of clones is linear to the
depth of the region.
Currently it does not have control over the code size increase. We are
seeing one ~9000 BB functions get expanded to ~250000 BBs, an 25x
increase. This creates a big compile time issue for the downstream
optimizations.
This patch adds a cap for number of clones for one region.
Differential Revision: https://reviews.llvm.org/D138333
Nikolas Klauser [Fri, 4 Nov 2022 19:08:56 +0000 (20:08 +0100)]
[libc++][math.h][NFC] Refactor enable_ifs
Reviewed By: ldionne, Mordante, #libc
Spies: EricWF, libcxx-commits
Differential Revision: https://reviews.llvm.org/D137501
Nikolas Klauser [Fri, 4 Nov 2022 16:01:22 +0000 (17:01 +0100)]
[libc++][math.h] Remove some code duplication
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D137500
Nikolas Klauser [Fri, 4 Nov 2022 15:56:51 +0000 (16:56 +0100)]
[libc++][math.h] Remove __libcpp_<func> functions and instead call builtins directly
Reviewed By: ldionne, Mordante, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D137499
Nikolas Klauser [Fri, 4 Nov 2022 15:45:35 +0000 (16:45 +0100)]
[libc++] Assume that builtins for math.h functions are available
All supported compilers support the builtins, so this removes dead code and simplifies a lot of the functions through that.
Reviewed By: ldionne, #libc, EricWF
Spies: EricWF, michaelplatings, libcxx-commits
Differential Revision: https://reviews.llvm.org/D135781
Nikolas Klauser [Fri, 28 Oct 2022 01:11:44 +0000 (03:11 +0200)]
[libc++] Remove duplication in math_h.pass.cpp and improve coverage
Reviewed By: ldionne, huixie90, #libc
Spies: mstorsjo, EricWF, libcxx-commits
Differential Revision: https://reviews.llvm.org/D136908
Krzysztof Parzyszek [Fri, 18 Nov 2022 22:31:04 +0000 (14:31 -0800)]
[Hexagon] Use V6_vmpyuhvs for 16-bit mulhu on HVX v69+
Zequan Wu [Tue, 22 Nov 2022 19:00:56 +0000 (11:00 -0800)]
Reland "[LTO][COFF] Use bitcode file names in lto native object file names."
This reverts commit
eef5405f74ae208e3e2eb7daacecac923d7338f2.
Paul Kirth [Tue, 22 Nov 2022 19:12:58 +0000 (19:12 +0000)]
Revert "[clang-doc] Move file layout to the generators."
This reverts commit
f8a469fc572778d05b72f34a772082cf3abd3cda.
The test in single-file-public.cpp breaks on Mac, due to an unknown
regextype in the find command.
Benjamin Kramer [Tue, 22 Nov 2022 19:05:12 +0000 (20:05 +0100)]
[mlir] Add tablegen types for fp8 types
For consistency and allowing users easy access to these types.
Differential Revision: https://reviews.llvm.org/D138516
Vitaly Buka [Tue, 22 Nov 2022 18:50:40 +0000 (10:50 -0800)]
Revert "[AArch64] Add GPR rr instructions to isAssociativeAndCommutative"
Breaks msan on aarch64.
This reverts commit
5f7f484ee54ebbf702ee4c5fe9852502dc237121.
Zequan Wu [Tue, 22 Nov 2022 18:54:46 +0000 (10:54 -0800)]
Revert "[LTO][COFF] Use bitcode file names in lto native object file names."
This reverts commit
531ed6d5aa65f41c6dfe2e74905d5c6c88fc95a7.
Mariya Podchishchaeva [Tue, 22 Nov 2022 16:44:54 +0000 (11:44 -0500)]
[Driver][Test] Fix pic.c when CLANG_DEFAULT_PIE_ON_LINUX set to OFF
Brett Wilson [Tue, 15 Nov 2022 20:51:45 +0000 (12:51 -0800)]
[clang-doc] Move file layout to the generators.
Previously file naming and directory layout was handled on a per Info
object basis by ClangDocMain and the generators blindly wrote to the
files given. This means all generators must use the same file layout and
caused problems where multiple objects mapped to the same file. The
object collision problem happens most easily with template
specializations because the template parameters are not part of the
"name".
This patch moves the responsibility for output file organization to the
generators. Currently HTML and MD use the same structure as before. But
they now collect all objects that map to a given file and combine them,
avoiding the corruption problems.
Converts the YAML generator to naming files based on USR in one
directory. This is easier for downstream tools to manage and avoids
the naming problems with template specializations. Since this change
requires backward-incompatible output changes to referenced files anyway
(since each one is now an array), this is a good time to introduce this
change.
Differential Revision: https://reviews.llvm.org/D138073
Zequan Wu [Thu, 17 Nov 2022 21:31:40 +0000 (13:31 -0800)]
[LLDB][Minidump] Merge executable module's architecture into target's architecture.
This allows minidump process ABI to match the PE/COFF file ABI.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D137873
Sami Tolvanen [Tue, 22 Nov 2022 18:09:22 +0000 (18:09 +0000)]
[Clang][Driver] Add KCFI to SupportsCoverage
Allow `-fsanitize=kcfi` to be enabled with `-fsanitize-coverage=` modes
such as `trace-{pc,cmp}`.
Link: https://github.com/ClangBuiltLinux/linux/issues/1743
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D138458
Zequan Wu [Wed, 2 Nov 2022 00:06:01 +0000 (17:06 -0700)]
[LTO][COFF] Use bitcode file names in lto native object file names.
Currently the lto native object files have names like main.exe.lto.1.obj. In
PDB, those names are used as names for each compiland. Microsoft’s tool
SizeBench uses those names to present to users the size of each object files.
So, names like main.exe.lto.1.obj is not user friendly.
This patch makes the lto native object file names more readable by using
the bitcode file names as part of the file names. For example, if the input
bitcode file has path like "path/to/foo.obj", its corresponding lto native
object file path would be "path/to/main.exe.lto.foo.obj". Since the lto native
object file name only bothers PDB, this patch only changes the lld-linker's
behavior.
Reviewed By: tejohnson, MaskRay, #lld-macho
Differential Revision: https://reviews.llvm.org/D137217
Simon Pilgrim [Tue, 22 Nov 2022 18:16:09 +0000 (18:16 +0000)]
[DAG] isGuaranteedNotToBeUndefOrPoison - handle FrameIndex/TargetFrameIndex
Fixes #58904
dbakunevich [Mon, 14 Nov 2022 09:26:55 +0000 (16:26 +0700)]
[Utils] Improved chunk-print-before-all.py script
As part of this patch, the ability to work with dump files
containing ir after passes received using the -print-after-all
option was added to script chunk-print-before-all.py.
The names of the output files have also been changed.
Before: chunk-NUM.ll
Now: NUM-STAGE-PASS_NAME.ll
NUM - sequence number of the pass operation.
STAGE - stage of the pass operation (for example: before, after, dump).
PASS_NAME - the name of the pass.
Alexander Timofeev [Tue, 18 Oct 2022 13:34:49 +0000 (15:34 +0200)]
[AMDGPU] Avoid SCC clobbering before S_CSELECT_B32
Frame lowering inserts scalar addition to compute the offset to the
stack objects. This instructions inserted in arbitrary place and may clobber
SCC between its definition and S_CSELECT_B32 instruction. This change
workarounds this particular code pattern. It queries the scavenger for SGPR and
if available saves SCC to it and restore its value after frame lowering code
insertion.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D136169
Hassnaa Hamdi [Fri, 18 Nov 2022 13:26:53 +0000 (13:26 +0000)]
[AArch64][SME]: Generate streaming-compatible code for fp_arith and fp-fma
1-To generate code compatible to streaming mode:
- enable custom lowering for FADD, FDIV, FMA, FNEG, FSQRT, FSUB, and FABS.
Differential Revision: https://reviews.llvm.org/D138290
Hassnaa Hamdi [Fri, 18 Nov 2022 13:20:40 +0000 (13:20 +0000)]
[AArch64][SME]: Add precursory tests for D138290
Add testing files:
- fp-arith.ll
- fp-fma.ll
Kazu Hirata [Tue, 22 Nov 2022 17:57:22 +0000 (09:57 -0800)]
[ADT] Define None as std::nullopt (NFC)
This patch defines NoneType and None as std::nullopt_t and
std::nullopt, respectively.
This patch effectively makes None and std::nullopt interchangeable, so
we can gradually replace None with std::nullopt all while we continue
to use llvm::Optional.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Differential Revision: https://reviews.llvm.org/D138468
Simon Pilgrim [Tue, 22 Nov 2022 17:56:07 +0000 (17:56 +0000)]
[X86] Cleanup WriteBlend classes to match (V)PLENDW instruction
Minor cleanup toward fixing the unnecessary scheduler overrides warnings from D138359
Krzysztof Parzyszek [Tue, 22 Nov 2022 17:11:17 +0000 (09:11 -0800)]
[Hexagon] Make local array static in getIntrinsicForHexagonNonClangBuiltin
It should not be created on every call, the omission of `static` was a bug
in the patch that introduced it.
Kirill Stoimenov [Fri, 18 Nov 2022 23:46:54 +0000 (23:46 +0000)]
[Sanitizer][NFC] Rearranged prototype definitions in lsan_common.h to group them by implementation file.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D138335
Guozhi Wei [Tue, 22 Nov 2022 17:18:29 +0000 (17:18 +0000)]
[AArch64] Correctly recognize -reserve-regs-for-regalloc=X30,X29
In AArch64 backend X30 is named as LR, X29 is named as FP. So the code in AArch64Subtarget::AArch64Subtarget can't recognize these 2 registers.
for (unsigned i = 0; i < 31; ++i) {
if (ReservedRegNames.count(TRI->getName(AArch64::X0 + i)))
ReserveXRegisterForRA.set(i);
}
This patch add code to explicitly handle these 2 registers.
Differential Revision: https://reviews.llvm.org/D137810
Jay Foad [Tue, 22 Nov 2022 17:06:53 +0000 (17:06 +0000)]
[AMDGPU] Remove RegStrictDom variable. NFC.
D117544 removed the only substantive use of RegStrictDom. Now we can
simplify by using StrictDom for everything.
Jay Foad [Tue, 22 Nov 2022 16:59:53 +0000 (16:59 +0000)]
[AMDGPU] Define and use new allZeroWaitcnt helper. NFC.