Balazs Benics [Thu, 11 Aug 2022 14:07:52 +0000 (16:07 +0200)]
[analyzer] exploded-graph-rewriter: Fix python3 string encoding issues
This encapsulates 3 changes:
- `DotDumpVisitor` now aggregates strings instead of *bytes* for both
`python2` and `python3`. This difference caused crashes when it tried
to write out the content as *strings*, similarly described at D71746.
- `graphviz.pipe()` expects the input in *bytes* instead of unicode
strings. And it results in *bytes*. Due to string concatenations and
similar operations, I'm using unicode string as the default, and
converting to *bytes* on demand.
- `write_temp_file()` now appends the `egraph-` prefix and more
importantly, it will create the temp file in the **current working
directory** instead of in the *temp*. This change makes `Firefox` be
able to open the file even if the `security.sandbox.content.level` is
set to the (default) most restricting `4`.
See https://support.mozilla.org/si/questions/1259285
An artifact of the bad byte handling was previously in the `HTML`
produced by the script that it displayed the `b'` string at the top left
corner. Now it won't anymore :)
I've tested that the following command works on `Ubuntu 22.04`:
```
exploded-graph-rewriter my-egraph.dot
```
Both `python2` and `python3` works as expected.
PS: I'm not adding tests, as the current test infra does not support
testing HTML outputs for this script.
Check the `clang/test/Analysis/exploded-graph-rewriter/lit.local.cfg`.
We always pass the `--dump-dot-only` flag to the script.
Along with that, the default invocation will not only create this HTML
report but also try to open it. In addition to this, I'm not sure if the
buildbots have `graphviz` installed and also if this package is installed
on `pip`.
Unless we change some of these, we cannot test this change.
Given that D71746 had no tests, I'm not too worried about this either.
Reviewed By: NoQ
Differential Revision: https://reviews.llvm.org/D131553
Michael Buch [Thu, 4 Aug 2022 15:22:47 +0000 (16:22 +0100)]
[lldb][unittests] Add more test cases to CPlusPlusNameParser unit-tests
Add test cases for the possible function qualifiers that the
`CPlusPlusNameParser` supports.
Differential Revision: https://reviews.llvm.org/D131332
Anubhab Ghosh [Tue, 9 Aug 2022 17:23:43 +0000 (22:53 +0530)]
[Orc] Reorder operations in ExecutorSharedMemoryMapperService shutdown
Differential Revision: https://reviews.llvm.org/D131510
Jun Zhang [Thu, 11 Aug 2022 07:30:05 +0000 (15:30 +0800)]
Remove redundant condition check, NFC
Signed-off-by: Jun Zhang <jun@junz.org>
Emmmer [Thu, 11 Aug 2022 09:12:28 +0000 (17:12 +0800)]
[LLDB][RISCV] Fix risc-v target build
Fixed an inconsistency between D130985 and D130342
This should be a follow-up of D130985
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D131667
Tue Ly [Thu, 11 Aug 2022 06:14:13 +0000 (02:14 -0400)]
[libc] Change sinf/cosf range reduction to mod pi/32 to be shared with tanf.
Change sinf/cosf range reduction to mod pi/32 to be shared with tanf,
since polynomial approximations for tanf on subintervals of length pi/16 do not
provide enough accuracy.
Reviewed By: orex
Differential Revision: https://reviews.llvm.org/D131652
David Truby [Thu, 11 Aug 2022 13:23:35 +0000 (13:23 +0000)]
[clang][AArch64][SVE] Change SVE_VECTOR_OPERATORS macro for VLA vectors
The __ARM_FEATURE_SVE_VECTOR_OPERATORS macro should be changed to
indicate that this feature is now supported on VLA vectors as well as
VLS vectors. There is a complementary PR to the ACLE spec here
https://github.com/ARM-software/acle/pull/213
Reviewed By: peterwaller-arm
Differential Revision: https://reviews.llvm.org/D131573
David Truby [Thu, 11 Aug 2022 13:21:21 +0000 (13:21 +0000)]
[clang][AArch64][SVE] Clarify documentation for sizeof operator on SVE
Previously the table in LanguageExtensions said that sizeof worked on
SVE types but this is only correct for fixed-length vectors so a
clarification has been added.
David Green [Thu, 11 Aug 2022 13:20:36 +0000 (14:20 +0100)]
[AArch64] Add bf16 select handling
A bfloat select operation will currently crash, but is allowed from C.
This adds handling for the operation, turning it into a FCSELHrrr if
fullfp16 is present, or converting it to a FCSELSrrr if not. The
FCSELSrrr is created via using INSERT_SUBREG/EXTRACT_SUBREG to convert
the bf16 to a f32 and using the f32 pattern for FCSELSrrr. (I originally
attempted to do this via a tablegen pattern, but it appears that the
nzcv glue is places onto the wrong node, causing it to be forgotten and
incorrect scheduling to be emitted).
The FCSELSrrr can also be used for fp16 selects when +fullfp16 is not
present, which helps avoid an unnecessary promotion to f32.
Differential Revision: https://reviews.llvm.org/D131253
Simon Pilgrim [Thu, 11 Aug 2022 13:04:09 +0000 (14:04 +0100)]
[X86] lowerShuffleWithVPMOV - remove oneuse constraints on shuffle(trunc(x),undef) -> vpmov(x) lowering
These were added in rG057bdd63 but shuffle combining has gotten a lot better at folding different vector widths since then.
Sam Estep [Wed, 10 Aug 2022 17:50:14 +0000 (17:50 +0000)]
[clang][dataflow] Don't crash when caller args are missing storage locations
This patch modifies `Environment`'s `pushCall` method to pass over arguments that are missing storage locations, instead of crashing.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D131600
Dmitry Preobrazhensky [Thu, 11 Aug 2022 12:54:16 +0000 (15:54 +0300)]
[AMDGPU][MC][GFX11][NFC] Correct tests for 16-bit VOP2 opcodes which use v128 or higher VGPRs
Differential Revision: https://reviews.llvm.org/D131564
Sam Estep [Wed, 10 Aug 2022 14:01:18 +0000 (14:01 +0000)]
[clang][dataflow] Analyze constructor bodies
This patch adds the ability to context-sensitively analyze constructor bodies, by changing `pushCall` to allow both `CallExpr` and `CXXConstructExpr`, and extracting the main context-sensitive logic out of `VisitCallExpr` into a new `transferInlineCall` method which is now also called at the end of `VisitCXXConstructExpr`.
Reviewed By: ymandel, sgatev, xazax.hun
Differential Revision: https://reviews.llvm.org/D131438
Andre Vieira [Thu, 11 Aug 2022 12:34:53 +0000 (13:34 +0100)]
[TypePromotion] Update comment in testcase. RFC
Haojian Wu [Sun, 7 Aug 2022 20:23:33 +0000 (22:23 +0200)]
[pseudo] Use C++17 variant to simplify the DirectiveTree::Chunk class, NFC.
Differential Revision: https://reviews.llvm.org/D131396
David Stuttard [Tue, 9 Aug 2022 07:46:55 +0000 (08:46 +0100)]
AMDGPU: mbcnt allow for non-zero src1 for known-bits
Src1 for mbcnt can be a non-zero literal or register. Take this into account
when calculating known bits.
Differential Revision: https://reviews.llvm.org/D131478
Dmitry Preobrazhensky [Thu, 11 Aug 2022 12:10:01 +0000 (15:10 +0300)]
[AMDGPU][MC][GFX11][NFC] Remove test duplicates
Differential Revision: https://reviews.llvm.org/D131558
Dmitry Preobrazhensky [Thu, 11 Aug 2022 12:00:40 +0000 (15:00 +0300)]
[AMDGPU][MC][GFX11][NFC] Consolidate VOP tests by encoding
Differential Revision: https://reviews.llvm.org/D131559
Aaron Ballman [Thu, 11 Aug 2022 11:32:32 +0000 (07:32 -0400)]
Do not use the same identifier for a data member as a type; NFC
This should help address a build failure found after
09117b21890c652994f7ada0229d309b35b44259
../tools/clang/lib/Sema/SemaDeclCXX.cpp: In member function
\91void clang::Sema::DiagnoseStaticAssertDetails(const clang::Expr*)
\92:
../tools/clang/lib/Sema/SemaDeclCXX.cpp:16666:19: error: declaration of
\91const clang::Expr* clang::Sema::DiagnoseStaticAssertDetails(const clang::Expr*)::<unnamed struct>::Expr
\92 changes meaning of
\91Expr
\92 [-fpermissive]
16666 | const Expr *Expr;
| ^~~~
In file included from ../tools/clang/include/clang/AST/DeclCXX.h:22,
from ../tools/clang/include/clang/AST/ASTLambda.h:18,
from ../tools/clang/lib/Sema/SemaDeclCXX.cpp:15:
../tools/clang/include/clang/AST/Expr.h:109:7: note:
\91Expr
\92 declared here as
\91class clang::Expr
\92
109 | class Expr : public ValueStmt {
| ^~~~
Florian Hahn [Thu, 11 Aug 2022 11:29:01 +0000 (12:29 +0100)]
[Builtins] Do not claim most libfuncs are readnone with trapping math.
At the moment, Clang only considers errno when deciding if a builtin
is const. This ignores the fact that some library functions may raise
floating point exceptions, which may modify global state, e.g. when
updating FP status registers.
To model the fact that some library functions/builtins may raise
floating point exceptions, this patch adds a new 'g' modifier for
builtins. If a builtin is marked with 'g', it cannot be considered
const, unless FP exceptions are ignored.
So far I've not added CHECK lines for all calls in math-libcalls.c. I'll
do that once we agree on the overall direction.
A consequence seems to be that we fail to select some of the constrained
math builtins now, but I am not entirely sure what's going on there.
Reviewed By: john.brawn
Differential Revision: https://reviews.llvm.org/D129231
Haojian Wu [Thu, 11 Aug 2022 11:05:40 +0000 (13:05 +0200)]
[pseudo] Fix a bug in checking the duplicated grammar rules.
Pavel Kosov [Tue, 14 Sep 2021 15:50:18 +0000 (18:50 +0300)]
[LLDB] Disable FP test for arm 32 bit
Test was introduced in https://reviews.llvm.org/D126359
~~~
OS Laboratory. Huawei RRI. Saint-Petersburg
Simon Pilgrim [Thu, 11 Aug 2022 11:05:50 +0000 (12:05 +0100)]
[CostModel][X86] Sync masked-intrinsic-cost.ll and masked-intrinsic-cost-inseltpoison.ll
We'd lost some type test coverage in masked-intrinsic-cost-inseltpoison.ll
David Spickett [Thu, 11 Aug 2022 09:00:26 +0000 (09:00 +0000)]
[LLDB][ARM] Extend testing for vpush emulation
https://reviews.llvm.org/D131658 found a bug in
ReadPseudoRegisterValue which would mean we read out
of bounds if the s register number was high enough.
This adds a memory check to vpush-1-thumb, which
should have been doing that anyway. Then copies that
test and uses the last 4 s registers instead.
Without the mentioned fix we see random values in
the final memory, with the fix it passes.
Reviewed By: fixathon
Differential Revision: https://reviews.llvm.org/D131663
Benjamin Kramer [Thu, 11 Aug 2022 09:56:41 +0000 (11:56 +0200)]
[mlir][sparse] Refine
f695554a2a55 wording a bit and fix the double conversion I broke with aggressive copy&paste
Yeting Kuo [Sat, 16 Jul 2022 07:11:35 +0000 (15:11 +0800)]
[RISCV] Peephole optimization to fold merge.vvm and unmasked intrinsics.
The patch uses peephole method to fold merge.vvm and unmasked intrinsics to
masked intrinsics. Using peephole intead of tablegen patterns is to avoid large
auto gnerated code.
Note: The patch ignores segment loads since I don't know how to test them.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D130442
Ilya Biryukov [Thu, 11 Aug 2022 09:48:28 +0000 (11:48 +0200)]
[MC] NFC. Avoid redundant copies when constructing StructFieldInfo
Follow-up after D131595, see comments in the review thread.
The intention of having two constructors was to minimize the copies of
`vector`, but a lack of `std::move` on the call site caused the wrong
constructor to be called.
Switched to a single constructor that accepts a value.
Accepting by value allows to have a single constructor and still decide
to copy or move on the call site.
Jonas Hahnfeld [Wed, 10 Aug 2022 20:31:05 +0000 (22:31 +0200)]
[RISCV] Re-enable JIT support
Commit
8922adf646 recently made JITTargetMachineBuilder honor the
hasJIT property of the target. LLVM supports just-in-time compilation
on RISC-V, so set the flag.
Differential Revision: https://reviews.llvm.org/D131617
Marius Brehler [Wed, 10 Aug 2022 17:19:23 +0000 (17:19 +0000)]
[mlir] Fix calling the native mlir-pdll-tblgen
This sets the `MLIR_PDLL_TABLEGEN_EXE` and `MLIR_PDLL_TABLEGEN_TARGET`
as cache variables which is necessary for cross-compiling projects that
rely on MLIR and the mlir-pdll-tblgen tool.
The patch is similar to https://reviews.llvm.org/D130350.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D131596
Krasimir Georgiev [Thu, 11 Aug 2022 09:17:27 +0000 (11:17 +0200)]
[bazel] Add WindowsDriver as a dep of OrcJIT (llvmorg-16-init-1433-g7260cdd2e13a)
Martin Storsjö [Mon, 18 Jul 2022 21:18:16 +0000 (00:18 +0300)]
[COFF] Emit embedded -exclude-symbols: directives for hidden visibility for MinGW
This works with the automatic export of all symbols; in MinGW mode,
when a DLL has no explicit dllexports, it exports all symbols (except
for some that are hardcoded to be excluded, including some toolchain
libraries).
By hooking up the hidden visibility to the -exclude-symbols: directive,
the automatic export of all symbols can be controlled in an easier
way (with a mechanism that doesn't require strict annotation of every
single symbol, but which allows gradually marking more unnecessary
symbols as hidden).
The primary use case is dylib builds of LLVM/Clang. These can be done
in MinGW mode but not in MSVC mode, as MinGW builds can export all
symbols (and the calling code can use APIs without corresponding
dllimport directives). However, as all symbols are exported, it can
easily overflow the max number of exported symbols in a DLL (65536).
In the llvm-mingw distribution, only the X86, ARM and AArch64 backends
are enabled; for the LLVM 13.0.0 release, libLLVM-13.dll ended up with
58112 exported symbols. For LLVM 14.0.0, it was 62015 symbols. Current
builds of the 15.x branch end up at around 64650 symbols - i.e. extremely
close to the limit.
The msys2 packages of LLVM have had to progressively disable more
of their backends in their builds, to be able to keep building with a
dylib.
This allows improving the current mingw dylib situation significantly,
by using the same hidden visibility options and attributes as on Unix.
With those in place, a current build of LLVM git main ends up at 35142
symbols instead of 64650.
For code using hidden visibility, this now requires linking with either
a current git lld or ld.bfd. (Older lld error out on the unknown
directives, older ld.bfd will successfully link, but will print huge
amounts of warnings.)
Differential Revision: https://reviews.llvm.org/D130121
Martin Storsjö [Sun, 17 Jul 2022 21:11:37 +0000 (00:11 +0300)]
[LLD] [COFF] Add support for a new, mingw specific embedded directive -exclude-symbols:
This is an entirely new embedded directive - extending the GNU ld
command line option --exclude-symbols to be usable in embedded
directives too.
(GNU ld.bfd also got support for the same new directive, currently in
the latest git version, after the 2.39 branch.)
This works as an inverse to the regular embedded dllexport directives,
for cases when autoexport of all eligible symbols is performed.
Differential Revision: https://reviews.llvm.org/D130120
Martin Storsjö [Mon, 18 Jul 2022 20:43:02 +0000 (23:43 +0300)]
[LLD] [MinGW] Implement the --exclude-symbols option
This adds support for the existing GNU ld command line option, which
allows excluding individual symbols from autoexport (when linking a
DLL and no symbols are marked explicitly as dllexported).
Differential Revision: https://reviews.llvm.org/D130118
Andre Vieira [Thu, 11 Aug 2022 08:47:53 +0000 (09:47 +0100)]
[TypePromotion] Search from ZExt + PHI
Expand TypePromotion pass to try to promote PHI-nodes in loops that are the
operand of a ZExt, using the ZExt's result type to determine the Promote Width.
Differential Revision: https://reviews.llvm.org/D111237
Andre Vieira [Thu, 11 Aug 2022 08:41:59 +0000 (09:41 +0100)]
[TypePromotion] Hoist out Promote Width calculation
Hoist out promote width calculation to simplify runOnFunction.
Differential Revision: https://reviews.llvm.org/D131489
Andre Vieira [Thu, 11 Aug 2022 08:39:20 +0000 (09:39 +0100)]
[TypePromotion] Don't delete Insns when iterating
Differential Revision: https://reviews.llvm.org/D131488
Andre Vieira [Thu, 11 Aug 2022 08:37:42 +0000 (09:37 +0100)]
[TypePromotion] Don't insert Truncate for a no-op ZExt
Differential Revision: https://reviews.llvm.org/D131487
Marco Elver [Thu, 11 Aug 2022 08:40:57 +0000 (10:40 +0200)]
[MemorySanitizer] Support memcpy.inline and memset.inline
Other sanitizers (ASan, TSan, see added tests) already handle
memcpy.inline and memset.inline by not relying on InstVisitor to turn
the intrinsics into calls. Only MSan instrumentation currently does not
support them due to missing InstVisitor callbacks.
Fix it by actually making InstVisitor handle Mem*InlineInst.
While the mem*.inline intrinsics promise no calls to external functions
as an optimization, for the sanitizers we need to break this guarantee
since access into the runtime is required either way, and performance
can no longer be guaranteed. All other cases, where generating a call is
incorrect, should instead use no_sanitize.
Fixes: https://github.com/llvm/llvm-project/issues/57048
Reviewed By: vitalybuka, dvyukov
Differential Revision: https://reviews.llvm.org/D131577
Benjamin Kramer [Thu, 11 Aug 2022 08:38:12 +0000 (10:38 +0200)]
[mlir][sparse] Use the correct ABI on x86 and re-enable tests
c7ec6e19d5446a448f888b33f66316cf2ec6ecae made LLVM adhere to the x86
psABI and pass bf16 in SSE registers instead of GPRs. This breaks the
custom versions of runtime functions we have for bf16 conversion. A
great fix for this would be to use __bf16 types instead which carry the
right ABI, but that type isn't widely available.
Instead just pretend it's a 32 bit float on the ABI boundary and
carefully cast it to the right type.
Fixes #57042
LLVM GN Syncbot [Thu, 11 Aug 2022 08:37:36 +0000 (08:37 +0000)]
[gn build] Port
9ae5896d9673
Slava Gurevich [Thu, 11 Aug 2022 08:08:25 +0000 (01:08 -0700)]
[LLDB] Fix out-of-bounds memory access in EmulationStateArm
Functionally broken code for reading and writing registers, likely due to typos,
and could cause out-of-bounds memory access.
Differential Revision: https://reviews.llvm.org/D131658
Carlos Galvez [Thu, 2 Jun 2022 13:10:07 +0000 (13:10 +0000)]
[clang-tidy] Add cppcoreguidelines-avoid-const-or-ref-data-members check
Flags uses of const-qualified and reference data members in structs.
Implements rule C.12 of C++ Core Guidelines.
Differential Revision: https://reviews.llvm.org/D126880
Wei Yi Tee [Wed, 3 Aug 2022 14:48:49 +0000 (14:48 +0000)]
[clang][dataflow] Store DeclContext of block being analysed in Environment if available.
Differential Revision: https://reviews.llvm.org/D131065
Martin Storsjö [Tue, 2 Aug 2022 07:28:52 +0000 (10:28 +0300)]
[clang] [HLSL] Fix GCC warnings about virtual methods that are hidden
This fixes the following warnings produced by GCC 9:
In file included from ../tools/clang/include/clang/Sema/ExternalSemaSource.h:15,
from ../tools/clang/include/clang/Sema/HLSLExternalSemaSource.h:17,
from ../tools/clang/lib/Sema/HLSLExternalSemaSource.cpp:12:
../tools/clang/include/clang/AST/ExternalASTSource.h:211:16: warning: ‘virtual void clang::ExternalASTSource::CompleteType(clang::ObjCInterfaceDecl*)’ was hidden [-Woverloaded-virtual]
211 | virtual void CompleteType(ObjCInterfaceDecl *Class);
| ^~~~~~~~~~~~
In file included from ../tools/clang/lib/Sema/HLSLExternalSemaSource.cpp:12:
../tools/clang/include/clang/Sema/HLSLExternalSemaSource.h:49:8: warning: by virtual void clang::HLSLExternalSemaSource::CompleteType(clang::TagDecl*)’ [-Woverloaded-virtual]
49 | void CompleteType(TagDecl *Tag) override;
| ^~~~~~~~~~~~
Differential Revision: https://reviews.llvm.org/D130969
Martin Storsjö [Thu, 7 Jul 2022 20:38:38 +0000 (23:38 +0300)]
[libcxx] [test] Merge the experimental-lib-exports testcases into static-lib-exports
Since
bb939931a1adb9a47a2de13c359d6a72aeb277c8, the c++experimental
library is always built, so these tested files should always be built
(even if they aren't used in tests).
Differential Revision: https://reviews.llvm.org/D129399
Timm Bäder [Thu, 11 Aug 2022 07:06:41 +0000 (09:06 +0200)]
[clang] Try to fix builders
Try to fix these errors:
SemaDeclCXX.cpp:16666:19: error: declaration of ‘const clang::Expr* clang::Sema::DiagnoseStaticAssertDetails(const clang::Expr*)::<unnamed struct>::Expr’ changes meaning of ‘Expr’ [-fpermissive]
16666 | const Expr *Expr;
| ^~~~
Vitaly Buka [Thu, 11 Aug 2022 07:01:14 +0000 (00:01 -0700)]
[test][asan] Disable symbolization
Reduces runtime of the test.
Unrelated pre-merge checks often timeouts here.
Martin Storsjö [Thu, 11 Aug 2022 06:56:49 +0000 (09:56 +0300)]
[JITLink] Silence GCC warnings about parentheses around && and || operators
This silences the following warnings:
../include/llvm/ExecutionEngine/JITLink/JITLink.h:1108:56: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
1105 | assert(S == Scope::Local || llvm::count_if(AbsoluteSymbols,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1106 | [&](const Symbol *Sym) {
| ~~~~~~~~~~~~~~~~~~~~~~~~
1107 | return Sym->getName() == Name;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1108 | }) == 0 &&
| ~~~~~~~~^~
1109 | "Duplicate absolute symbol");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Praschan [Thu, 11 Aug 2022 06:32:22 +0000 (08:32 +0200)]
[clangd][test] Fix error message in SerializationTest.BinaryConversions
I noticed this when adding a new type to the index for
https://github.com/clangd/clangd/issues/529. When the assertion failed,
this actually caused a crash, because llvm::expected would complain that
we did not take the error.
Fangrui Song [Thu, 11 Aug 2022 06:45:13 +0000 (23:45 -0700)]
[PowerPC] Change a double Log2 for localentry to integral Log2. NFC
Timm Bäder [Mon, 1 Aug 2022 12:12:32 +0000 (14:12 +0200)]
[clang][sema] Print more information about failed static assertions
For failed static assertions, try to take the expression apart and print
useful information about why it failed. In particular, look at binary
operators and print the compile-time evaluated value of the LHS/RHS.
Differential Revision: https://reviews.llvm.org/D130894
Sunho Kim [Thu, 11 Aug 2022 06:40:47 +0000 (15:40 +0900)]
[ORC] Add missing std::move.
LLVM GN Syncbot [Thu, 11 Aug 2022 06:28:14 +0000 (06:28 +0000)]
[gn build] Port
7bece0f03bf6
LLVM GN Syncbot [Thu, 11 Aug 2022 06:28:12 +0000 (06:28 +0000)]
[gn build] Port
7260cdd2e13a
Sunho Kim [Thu, 11 Aug 2022 06:27:05 +0000 (15:27 +0900)]
[ORC][COFF] Introduce COFFVCRuntimeBootstrapper.
Introduces COFFVCRuntimeBootstrapper that loads/initialize vc runtime libraries. In COFF, we *must* jit-link vc runtime libraries as COFF relocation types have no proper way to deal with out-of-reach data symbols ragardless of linking mode. (even dynamic version msvcrt.lib have tons of static data symbols that must be jit-linked) This class tries to load vc runtime library files from msvc installations with an option to override the path.
There are some complications when dealing with static version of vc runtimes. First, they need static initializers to be ran that requires COFFPlatform support but orc runtime will not be usable before vc runtimes are fully initialized. (as orc runtime will use msvc stl libraries) COFFPlatform that will be introduced in a following up patch will collect static initializers and run them manually in host before boostrapping itself. So, the user will have to do the following.
1. Create COFFPlatform that addes static initializer collecting passes.
2. LoadVCRuntime
3. InitializeVCRuntime
4. COFFPlatform.bootstrap()
Second, the internal crt initialization function had to be reimplemented in orc side. There are other ways of doing this, but this is the simplest implementation that makes platform fully responsible for static initializer. The complication comes from the fact that crt initialization functions (such as acrt_initialize or dllmain_crt_process_attach) actually run all static initializers by traversing from `__xi_a` symbol to `__xi_z`. This requires symbols to be contiguously allocated in sections alphabetically sorted in memory, which is not possible right now and not practical in jit setting. We might ignore emission of `__xi_a` and `__xi_z` symbol and allocate them ourselves, but we have to take extra care after orc runtime boostrap has been done -- as that point orc runtime should be the one running the static initializers.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D130456
Emmmer [Wed, 10 Aug 2022 13:36:48 +0000 (21:36 +0800)]
[LLDB][RISCV] Add riscv software breakpoint trap code
Added:
- Take RISC-V `ebreak` instruction as breakpoint trap code, so our breakpoint works as expected now.
Further work:
- RISC-V does not support hardware single stepping yet. A software implementation may come in future PR.
- Add support for RVC extension (the trap code, etc.).
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D131566
Corentin Jabot [Thu, 11 Aug 2022 06:21:28 +0000 (08:21 +0200)]
[Clang] Update cxx_dr_status [NFC]
Update the DR status page with the C++ Standard Core
Issues List revision 109.
Emmmer [Wed, 10 Aug 2022 13:36:20 +0000 (21:36 +0800)]
[LLDB][RISCV] Add riscv register definition and read/write
This patch is based on the minimal extract of D128250.
What is implemented:
- Use the same register layout as Linux kernel and mock read/write for `x0` register (the always zero register).
- Refactor some duplicate code, and delete unused register definitions.
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D130342
Sunho Kim [Thu, 11 Aug 2022 06:12:25 +0000 (15:12 +0900)]
[JITLink][COFF][x86_64] Stub SECREL relocation to external symbol.
Stubs SECREL relocation to external symbol. In order to correctly deal with this, we want to requrest memory manager to keep track of address of first block of sepecific section and keep address to be only increased from that point. We also should give jitlink to get information about global section. The relocation is only used for debug and tls info which we don't support yet anyways, so just stubbing it for now.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D130451
Sunho Kim [Thu, 11 Aug 2022 06:12:24 +0000 (15:12 +0900)]
[JITLink][COFF][x86_64] Implement SECTION/SECREL relocation.
Implements SECTION/SECREL relocation. These are used by debug info (pdb) data.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D130275
Clement Courbet [Wed, 29 Jun 2022 08:38:14 +0000 (10:38 +0200)]
[clang][transformer] Finish plumbing `Note` all the way to the output.
Right now we can only add a single warning, notes are not possible.
Apparently some provisions were made to allow notes, but they were never
propagated all the way to the diagnostics.
Differential Revision: https://reviews.llvm.org/D128807
Yeting Kuo [Fri, 29 Jul 2022 09:21:11 +0000 (17:21 +0800)]
[RISCV][test] Precommitted test for optimization for vmerge and unmasked intrinsics.
Precommitted test cases for D130442.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D130753
esmeyi [Thu, 11 Aug 2022 05:13:05 +0000 (01:13 -0400)]
[XCOFF] ignore the cold attribute.
Summary: AIX XCOFF doesn't support the cold feature.
While it shouldn't be a function error when XCOFF catching the cold attribute.
As with the behavior of other formats, we just ignore the attribute for now.
Reviewed By: DiggerLin
Differential Revision: https://reviews.llvm.org/D131473
Jeff Niu [Thu, 11 Aug 2022 05:10:27 +0000 (01:10 -0400)]
[fir] Fix build
Craig Topper [Thu, 11 Aug 2022 04:43:52 +0000 (21:43 -0700)]
[RISCV] Rename PROC_ALIAS to TUNE_ALIAS to reflect it's usage. NFC
This is not used as general CPU alias. Only to support -mtune. Name it as such.
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D131602
aqjune [Mon, 27 Jun 2022 08:44:51 +0000 (17:44 +0900)]
[CodeGen] Generate efficient assembly for freeze(poison) version of `mm*_cast*` intel intrinsics
This patch makes the variants of `mm*_cast*` intel intrinsics that use `shufflevector(freeze(poison), ..)` emit efficient assembly.
(These intrinsics are planned to use `shufflevector(freeze(poison), ..)` after shufflevector's semantics update; relevant thread: D103874)
To do so, this patch
1. Updates `LowerAVXCONCAT_VECTORS` in X86ISelLowering.cpp to recognize `FREEZE(UNDEF)` operand of `CONCAT_VECTOR` in addition to `UNDEF`
2. Updates X86InstrVecCompiler.td to recognize `insert_subvector` of `FREEZE(UNDEF)` vector as its first operand.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D130339
Jeff Niu [Thu, 11 Aug 2022 04:34:02 +0000 (00:34 -0400)]
[mlir][LLVMIR] Clean up the definitions of ReturnOp/CallOp
Vitaly Buka [Thu, 11 Aug 2022 03:53:02 +0000 (20:53 -0700)]
[msan] Extract SetAllocaOrigin
Vitaly Buka [Thu, 11 Aug 2022 03:38:55 +0000 (20:38 -0700)]
[msan] Another try for powerpc fix after D131205
wanglei [Thu, 11 Aug 2022 02:50:11 +0000 (10:50 +0800)]
[LoongArch] Override TargetLowering::isOffsetFoldingLegal()
This patch disable GlobalAddress+Offset folding.
Differential Revision: https://reviews.llvm.org/D131491
jacquesguan [Wed, 10 Aug 2022 09:24:55 +0000 (17:24 +0800)]
[RISCV] Add cost model for mask vector extend and truncate instruction.
As extending from or truncating to mask vector do not use the same instructions as the normal cast, this path changed it to 2 which is the number of instructions we used.
Differential Revision: https://reviews.llvm.org/D131552
WANG Xuerui [Thu, 11 Aug 2022 02:21:29 +0000 (10:21 +0800)]
[LoongArch] Define the new-style reloc types
Differential Revision: https://reviews.llvm.org/D131467
Gergely Meszaros [Thu, 11 Aug 2022 02:29:58 +0000 (19:29 -0700)]
[clang-format] git-clang-format --staged should format the index
When --staged (or --cached) use the index for formatting as well, not just
for the line numbers to format. Without this change git-clang-format gets
the changed line numbers based on the index, but then formats these lines on
the working tree version of the file.
This is a problem when the working tree and index differ. One common case
would be (and is the motivation behind this patch) when applying the
suggested changes git-clang-format --staged, then forgetting to add the
applied changes. When git-clang-format --staged --diff is used in a
pre-commit hook in this scenario, then the hook would allow committing the
improperly formatted changes, as the file is correctly formatted in the work
tree.
Fixes #56797.
Differential Revision: https://reviews.llvm.org/D130108
Vitaly Buka [Thu, 11 Aug 2022 02:28:20 +0000 (19:28 -0700)]
[msan] Try to fix powerpc after D131205
WANG Xuerui [Thu, 11 Aug 2022 01:42:07 +0000 (09:42 +0800)]
[LoongArch] Add insn aliases `jr` and `ret`
Differential Revision: https://reviews.llvm.org/D131512
Phoebe Wang [Wed, 10 Aug 2022 01:13:27 +0000 (09:13 +0800)]
[compiler-rt][BF16] Provide __truncdfbf2 and __truncsfbf2 only when __bf16 is available
Differential Revision: https://reviews.llvm.org/D131147
Uday Bondhugula [Tue, 9 Aug 2022 12:05:09 +0000 (17:35 +0530)]
[MLIR][NFC] Refactor affine analysis helpers
Refactor affine analysis helpers: the existing ones were using
unnecessary or improperly named arguments. NFC.
Differential Revision: https://reviews.llvm.org/D131557
WANG Xuerui [Thu, 11 Aug 2022 00:50:50 +0000 (08:50 +0800)]
[LoongArch] Add codegen support for bitreverse
Differential Revision: https://reviews.llvm.org/D131378
Uday Bondhugula [Thu, 11 Aug 2022 00:03:23 +0000 (05:33 +0530)]
[MLIR] Add missing check for unsupported affine dependence analysis
Add missing check in affine dependence analysis when dependence analysis
isn't possible due to the ops being in different affine scopes. The
lack of such a check could lead to a crash or incorrect behavior in
several dependent utilities.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D131556
Uday Bondhugula [Thu, 11 Aug 2022 00:26:17 +0000 (05:56 +0530)]
[MLIR] Fix build breakage due to
5c5af910fefbea943a11452b63e2424e5f823470
Fix build breakage due to
5c5af910fefbea943a11452b63e2424e5f823470.
```commit
5c5af910fefbea943a11452b63e2424e5f823470
Author: Jeff Niu <jeff@modular.com>
Date: Tue Aug 9 22:07:35 2022 -0400
[mlir][LLVMIR] "Modernize" Insert/ExtractValueOp ```
results in
```lib/Conversion/LLVMCommon/MemRefBuilder.cpp:170:70: error: call of overloaded ‘makeArrayRef<int64_t>(<brace-enclosed initializer list>)’ is ambiguous
llvm::makeArrayRef<int64_t>({kStridePosInMemRefDescriptor,
pos}));
llvm/include/llvm/ADT/ArrayRef.h:505:15: note: candidate: ‘llvm::ArrayRef<T> llvm::makeArrayRef(const std::vector<T>&) [with T = long int]’
ArrayRef<T> makeArrayRef(const std::vector<T> &Vec) {
^~~~~~~~~~~~
llvm/include/llvm/ADT/ArrayRef.h:516:37: note: candidate: ‘llvm::ArrayRef<T> llvm::makeArrayRef(const llvm::ArrayRef<T>&) [with T = long int]’
template <typename T> ArrayRef<T> makeArrayRef(const ArrayRef<T> &Vec) {
^
Differential Revision: https://reviews.llvm.org/D131637
Keith Smiley [Fri, 17 Jun 2022 04:35:18 +0000 (21:35 -0700)]
[lld-macho] Add support for objc_msgSend stubs
Apple Clang in Xcode 14 introduced a new feature for reducing the
overhead of objc_msgSend calls by deduplicating the setup calls for each
individual selector. This works by clang adding undefined symbols for
each selector called in a translation unit, such as `_objc_msgSend$foo`
for calling the `foo` method on any `NSObject`. There are 2
different modes for this behavior, the default directly does the setup
for `_objc_msgSend` and calls it, and the smaller option does the
selector setup, and then calls the standard `_objc_msgSend` stub
function.
The general overview of how this works is:
- Undefined symbols with the given prefix are collected
- The suffix of each matching undefined symbol is added as a string to
`__objc_methname`
- A pointer is added for every method name in the `__objc_selrefs`
section
- A `got` entry is emitted for `_objc_msgSend`
- Stubs are emitting pointing to the synthesized locations
Notes:
- Both `__objc_methname` and `__objc_selrefs` can also exist from object
files, so their contents are merged with our synthesized contents
- The compiler emits method names for defined methods, but not for
undefined symbols you call, but stubs are used for both
- This only implements the default "fast" mode currently just to reduce
the diff, I also doubt many folks will care to swap modes
- This only implements this for arm64 and x86_64, we don't need to
implement this for 32 bit iOS archs, but we should implement it for
watchOS archs in a later diff
Differential Revision: https://reviews.llvm.org/D128108
Vitaly Buka [Wed, 10 Aug 2022 23:58:47 +0000 (16:58 -0700)]
[test][sanitizer] Fix REQUIRES of the test
getnetent is availible from API 28
Vitaly Buka [Wed, 10 Aug 2022 23:51:57 +0000 (16:51 -0700)]
[test][sanitizer] Switch test to a different group
Tom Stellard [Wed, 10 Aug 2022 23:56:05 +0000 (16:56 -0700)]
lldb: Disable unittests if llvm_gtest target does not exist
This fixes the stand-alone build configuration where LLVM_MAIN_SRC_DIR
does not exist.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D124314
Slava Zakharin [Wed, 10 Aug 2022 03:11:48 +0000 (20:11 -0700)]
[flang] Support DOT_PRODUCT in late inlining.
This change inlines DOT_PRODUCT calls for real and integer types.
Differential Revision: https://reviews.llvm.org/D131538
Vitaly Buka [Wed, 10 Aug 2022 23:28:59 +0000 (16:28 -0700)]
[test][sanitizer] Change exit code to debug llvm-avr-linux
Med Ismail Bennani [Wed, 10 Aug 2022 23:17:19 +0000 (16:17 -0700)]
[lldb/crashlog] Add `-V|--version` option
This patch introduces a new option to the crashlog command to get the
the script version.
Since `crashlog.py` is not actually versioned, this returns lldb's
version instead.
rdar://
98392669
Differential Revision: https://reviews.llvm.org/D131542
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Vitaly Buka [Wed, 10 Aug 2022 23:11:51 +0000 (16:11 -0700)]
[test][sanitizer] Fix REQUIRES in few tests
Aart Bik [Wed, 10 Aug 2022 21:38:01 +0000 (14:38 -0700)]
[mlir][sparse][bf16] disable two bf16 tests
Supposedly our ABI issues were fixed, per issue:
https://github.com/llvm/llvm-project/issues/55992
However, with a recent changes to bf16, these tests
fail again; not sure why yet:
https://reviews.llvm.org/D130832
https://lab.llvm.org/buildbot/#/builders/61/builds/30600
So we disable the tests for now. Issue is tracked in:
https://github.com/llvm/llvm-project/issues/57042
Differential Revision: https://reviews.llvm.org/D131621
Vitaly Buka [Wed, 10 Aug 2022 22:48:21 +0000 (15:48 -0700)]
[test][sanitizer] Fix getgrouplist test
Kevin Athey [Wed, 10 Aug 2022 18:18:32 +0000 (11:18 -0700)]
Remove function name from sanitize-memory-track-origins binary.
This work is being done to reduce the size of MSAN with track origins binary.
Builds upon: https://reviews.llvm.org/D131205
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D131415
Jan Svoboda [Wed, 10 Aug 2022 22:24:32 +0000 (15:24 -0700)]
[clang][deps] NFC: Move dependency consumer into header file
Slava Gurevich [Wed, 10 Aug 2022 19:52:09 +0000 (12:52 -0700)]
[LLDB][NFC] Clean up dead code
Remove unreachable code that will never execute.
Differential Revision: https://reviews.llvm.org/D131613
Slava Gurevich [Wed, 10 Aug 2022 09:48:51 +0000 (02:48 -0700)]
[LLDB][NFC] Reliability fixes for ObjectFileMachO.cpp
Static code inspection guided fixes for the following issues:
- dead code
- buffer not null-terminated
- null-dereference
- out-of-bounds access
Differential Revision: https://reviews.llvm.org/D131554
Michael Jones [Fri, 5 Aug 2022 21:51:10 +0000 (14:51 -0700)]
[libc] move to combined integer converter
The functions converting integers into decimal, hexadecimal, and octal,
are all very similar. This patch moves to a combined converter to save
code size.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D131302
Michael Jones [Wed, 10 Aug 2022 18:58:04 +0000 (11:58 -0700)]
[libc][NFC] add arrow operator to optional
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D131610
Louis Dionne [Wed, 10 Aug 2022 21:34:45 +0000 (17:34 -0400)]
[libc++] Reorganize the documentation of extensions for integral types
Evgenii Stepanov [Wed, 10 Aug 2022 21:20:57 +0000 (14:20 -0700)]
Revert "[clang][dataflow] Store DeclContext of block being analysed in Environment if available."
Use of uninitialized memory.
https://lab.llvm.org/buildbot/#/builders/74/builds/12713
This reverts commit
8a4c40bfe8e6605ffc9d866f8620618dfdde2875.
Evgenii Stepanov [Wed, 10 Aug 2022 21:20:49 +0000 (14:20 -0700)]
Revert "[clang][dataflow] Analyze constructor bodies"
https://lab.llvm.org/buildbot/#/builders/74/builds/12713
This reverts commit
000c8fef86abb7f056cbea2de99f21dca4b81bf8.
Evgenii Stepanov [Wed, 10 Aug 2022 21:20:41 +0000 (14:20 -0700)]
Revert "[clang][dataflow] Don't crash when caller args are missing storage locations"
https://lab.llvm.org/buildbot/#/builders/74/builds/12713
This reverts commit
43b298ea1282f29d448fc0f6ca971bc5fa698355.