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.
Florian Hahn [Tue, 22 Nov 2022 16:55:08 +0000 (16:55 +0000)]
[AArch64] Add zext test with scalable vectors.
Mark de Wever [Tue, 15 Nov 2022 18:53:30 +0000 (19:53 +0100)]
[libc++][format] Fixes visit_format_arg.
The Standard specifies which types are stored in the basic_format_arg
"variant" and which types are stored as a handle. Libc++ stores
additional types in the "variant". During a reflector discussion
@jwakely mention this is user observable; visit_format_arg uses the type
instead of a handle as argument.
This optimization is useful and will probably be used for other small
types in the future. To be conferment the visitor creates a handle and
uses that as argument. There is a second visitor so the formatter can
still directly access the 128-bit integrals.
The test for the visitor and get has been made public too, there is no
reason not too. The 128-bit integral types are required by the Standard,
when they are available.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D138052
Matthias Springer [Tue, 22 Nov 2022 16:26:19 +0000 (17:26 +0100)]
[mlir][tensor] Add dim(expand_shape/collapse_shape) folding
Differential Revision: https://reviews.llvm.org/D138487
Timm Bäder [Fri, 18 Nov 2022 13:13:18 +0000 (14:13 +0100)]
[clang][Parse] Remove constant expression from if condition
MaybeTypeCast here is not a variable, it's an enum member with value 1.
Differential Revision: https://reviews.llvm.org/D138289
bixia1 [Mon, 21 Nov 2022 05:57:30 +0000 (21:57 -0800)]
[mlir][sparse] Fix a bug in concatenate operator rewriting.
When calculating the dynamic dimensions for the concatenate result, we
shouldn't accumulate the sizes for the non-concatenating dimensions.
Reviewed By: aartbik, Peiming
Differential Revision: https://reviews.llvm.org/D138436
Matt Arsenault [Sun, 20 Nov 2022 17:08:34 +0000 (09:08 -0800)]
clang/HIP: Add new header test for math IR gen
The current header testing is pretty thin. This is in
preparation for a series of patches to replace many
builtin implementations.
I did try to stress everything in this header, but skipped
a few things. Mostly I didn't understand why we have
various language version checks which skip defining some
things. It doesn't seem right to have any of these if guards
on __cplusplus, __HIPCC_RTC__, and __OPENMP_AMDGCN__.
Matt Arsenault [Mon, 21 Nov 2022 03:07:01 +0000 (19:07 -0800)]
LoopDeletion: Fix missing newlines in debug printing
Yitzhak Mandelbaum [Thu, 3 Nov 2022 00:36:58 +0000 (00:36 +0000)]
[clang][dataflow] Add widening API and implement it for built-in boolean model.
* Adds API support for widening of lattice elements and environments,
* Updates the algorithm to apply widening where appropriate,
* Implements widening for boolean values. In the process, moves the unsoundness
of comparison from the default implementation of
`Environment::ValueModel::compare` to model-specific handling inside
`DataflowEnvironment::equivalentTo`. This change is intended to clarify
the source and location of unsoundess.
This patch is a replacement for, and was based substantially on, https://reviews.llvm.org/D131645.
Differential Revision: https://reviews.llvm.org/D137948
Matthias Springer [Tue, 22 Nov 2022 16:03:32 +0000 (17:03 +0100)]
[mlir][bufferize][NFC] Minor code and comment cleanups
Differential Revision: https://reviews.llvm.org/D135056
Kelvin Li [Tue, 22 Nov 2022 15:09:47 +0000 (10:09 -0500)]
[Flang] Removing Float Bessel functions for AIX
AIX libc only provides bessel functions j0,j1,jn and y0,y1,yn but
does not have their float equivalents j0f,j1f,jnf and y0f,y1f,ynf.
Committed on behalf of madanial
Differential Revision: https://reviews.llvm.org/D136128
David Spickett [Mon, 21 Nov 2022 17:01:11 +0000 (17:01 +0000)]
[libcxx] Add BOT_OWNERS.txt
Buildkite doesn't provide a way to list bot owners so currently
we are pinging people on Discord and Phabricator.
Which works ok until that person is on vacation. This file gives us
a place to list multiple people, or group contacts for each bot.
I've stuck to the CODE_OWNERS.txt format because there's no great
reason to change it.
Reviewed By: #libc, EricWF, ldionne
Differential Revision: https://reviews.llvm.org/D138445
Vy Nguyen [Fri, 18 Nov 2022 20:21:23 +0000 (15:21 -0500)]
[lld-macho] Fix bug in CUE folding that resulted in wrong unwind table.
PR/59070
Differential Revision: https://reviews.llvm.org/D138320
Yaxun (Sam) Liu [Thu, 17 Nov 2022 17:04:57 +0000 (12:04 -0500)]
[HIP] Fix lld failure when devie object is empty
When -fgpu-rdc is used for linking relocatable objects, clang driver launches
clang-offload-bundler to extract a device relocatable object from each input
relocatable object file and passes the extracted files to lld. The input relocatable
object file could either come from HIP program or C++ program. The relocatable
object file from C++ program does not contain device relocatable objects, therefore
clang-offload-bundler extracts an empty file and passes it to lld. lld treates
empty file as linker script. When there is no object input file to lld, lld
will emit error:
target emulation unknown: -m or at least one .o file required
This patch adds "elf64_amdgpu" to lld so that lld always know the target
no matter whether there are object input files or not.
Reviewed by: Artem Belevich, Fangrui Song
Differential Revision: https://reviews.llvm.org/D138221
Stefan Pintilie [Tue, 22 Nov 2022 14:41:14 +0000 (08:41 -0600)]
[PowerPC] Add handling for WACC register spilling.
This patch adds spilling for the new WACC registers.
In order to get the spilling test to work the MMA instructions from Power 10 are
now supported for Future CPU except that they are all using the new WACC
registers instead of the ACC registers from Power 10.
Reviewed By: amyk, saghir
Differential Revision: https://reviews.llvm.org/D136728
Sanjay Patel [Tue, 22 Nov 2022 14:28:55 +0000 (09:28 -0500)]
[VectorCombine] switch on opcode to compile faster
This follows
87debdadaf18 to further eliminate wasting time
calling helper functions only to early return to the main
run loop.
Once again, this results in significant savings based on
experimental data:
https://llvm-compile-time-tracker.com/compare.php?from=
01023bfcd33f922ed8c934ce563e54abe8bfe246&to=
3dce4f70b73e48ccb045decb634c185e6b4c67d5&stat=instructions:u
This is NFCI other than making the pass faster. The total
cost of VectorCombine runs in an -O3 build appears to be
well under 0.1% of compile-time now, so there's not much
left to do AFAICT.
There's a TODO about making the code cleaner, but it
probably doesn't change timing much. I didn't include those
changes here because it requires updating much more code.
Pavel Labath [Sun, 6 Nov 2022 08:43:27 +0000 (09:43 +0100)]
[lldb] rm include/lldb/Host/posix/Fcntl.h
File is unused.
Pavel Labath [Sun, 6 Nov 2022 08:45:17 +0000 (09:45 +0100)]
Add include guards for PlatformQemuUser.h
Oleksandr "Alex" Zinenko [Tue, 22 Nov 2022 15:08:47 +0000 (16:08 +0100)]
[mlir] fix incorrect summary/description in doc
Summary is the short one.
Paul Walker [Fri, 11 Nov 2022 21:01:59 +0000 (21:01 +0000)]
[SVE] Fix incorrect predicate for fixed length int/fp conversion.
When performing shrinking int/fp conversions the predicate should
be created to match the original fixed length vector type so the
unused lanes don't trigger side effects.
This patch also includes related refactoring to better detect such
issues and streamline the code a little.
Differential Revision: https://reviews.llvm.org/D138351
Philip Pfaffe [Tue, 22 Nov 2022 14:29:19 +0000 (14:29 +0000)]
[lldb] Allow plugins to extend DWARF expression parsing for vendor extensions
Parsing DWARF expressions currently does not support DW_OPs that are vendor
extensions. With this change expression parsing calls into SymbolFileDWARF for
unknown opcodes, which is the semantically "closest" plugin that we have right
now. Plugins can then extend SymbolFileDWARF to add support for vendor
extensions.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D137247
Pierre van Houtryve [Tue, 22 Nov 2022 14:14:46 +0000 (14:14 +0000)]
[AMDGPU][NFC] Remove isLegalVOP3PShuffleMask
Unused function since D134967
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D138493