Benjamin Kramer [Mon, 7 Jun 2021 19:57:55 +0000 (21:57 +0200)]
[mlir] Expose a function to populate tensor constant bufferization patterns
This makes it easier to use it from other bufferization passes.
Differential Revision: https://reviews.llvm.org/D103838
Joachim Protze [Sat, 21 Nov 2020 23:23:35 +0000 (00:23 +0100)]
[OpenMP][Tools] Fix Archer handling of task dependencies
The current handling of dependencies in Archer has two flaws:
- annotation of dependency synchronization is not limited to sibling tasks
- annotation of in/out dependencies is based on the assumption, that dependency
variables will rarely be byte-sized variables.
This patch introduces a map in the generating task to manage the dependency
variables for the child tasks. The map is only accesses from the generating
task, so no locking is necessary. This also limits the dependency-based
synchronization to sibling tasks.
This patch also introduces proper handling for new dependency types such as
mutexinoutset and inoutset.
Differential Revision: https://reviews.llvm.org/D103608
Joachim Protze [Thu, 19 Nov 2020 22:27:43 +0000 (23:27 +0100)]
[OpenMP][Tools] Cleanup memory pool used in Archer
The main motivation for reusing objects is that it helps to avoid creating and
leaking synchronization clocks in TSan. The reused object will reuse the
synchronization clock in TSan.
Before, new and delete operators were overloaded to get and return memory for
the object from/to the object pool.
This patch replaces the operator overloading with explicit static New/Delete
functions.
Objects for parallel regions and implicit tasks will always be recruited and
returned to the thread-local object pool. Only for explicit task, there is a
chance that an other thread completes the task and will free the object. This
patch optimizes the thread-local New/Delete calls by avoiding locks and only
lock if the pool is empty. Remote threads return the object into a separate
queue.
The chunk size for allocations is now decided based on page size. The objects
will also be aligned to cache lines avoiding false sharing.
This is the first patch in a series to provide better tasking support.
Differential Revision: https://reviews.llvm.org/D103606
Joachim Protze [Sat, 21 Nov 2020 23:08:39 +0000 (00:08 +0100)]
[OpenMP][Tools] Fix Archer for MACOS
Archer uses weak symbol overloads of TSan functions to enable loading the tool
even if the application is not built with TSan. For MACOS the tool collects
the function pointer at runtime.
When adding the function entry/exit markers, we missed to add the functions
in the MACOS codepath.
This patch also replaces the repeated function lookup by a single initial
function lookup and fixes the disabling logic in RunningOnValgrind.
Differential Revision: https://reviews.llvm.org/D103607
Meera Nakrani [Wed, 2 Jun 2021 14:17:08 +0000 (14:17 +0000)]
[AArch64LoadStoreOptimizer] Generate more STPs by renaming registers earlier
Our initial motivating case was memcpy's with alignments > 16. The
loads/stores, to which small memcpy's expand, are kept together in
several places so that we get a sequence like this for a 64 bit copy:
LD w0
LD w1
ST w0
ST w1
The load/store optimiser can generate a LDP/STP w0, w1 from this because
the registers read/written are consecutive. In our case however, the
sequence is optimised during ISel, resulting in:
LD w0
ST w0
LD w0
ST w0
This instruction reordering allows reuse of registers. Since the registers
are no longer consecutive (i.e. they are the same), it inhibits LDP/STP
creation. The approach here is to perform renaming:
LD w0
ST w0
LD w1
ST w1
to enable the folding of the stores into a STP. We do not yet generate
the LDP due to a limitation in the renaming implementation, but plan to
look at that in a follow-up so that we fully support this case. While
this was initially motivated by certain memcpy's, this is a general
approach and thus is beneficial for other cases too, as can be seen
in some test changes.
Differential Revision: https://reviews.llvm.org/D103597
Fraser Cormack [Mon, 7 Jun 2021 07:39:22 +0000 (08:39 +0100)]
[ValueTypes][RISCV] Cap RVV fixed-length vectors by size
This patch changes RVV's policy for its supported list of fixed-length
vector types by capping by vector size rather than element count. Now
all 1024-byte vectors (of supported element types) are supported, rather
than all 256-element vectors.
This is a more natural fit for the architecture, and allows us to, for
example, improve the support for vector bitcasts.
This change necessitated the adding of some new simple types to avoid
"regressing" on the number of currently-supported vectors. We round out
the 1024-byte types by adding `v512i8`, `v1024i8`, `v512i16` and
`v512f16`.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D103884
Aaron Ballman [Wed, 9 Jun 2021 11:15:15 +0000 (07:15 -0400)]
Correct the behavior of va_arg checking in C++
Clang checks whether the type given to va_arg will automatically cause
undefined behavior, but this check was issuing false positives for
enumerations in C++. The issue turned out to be because
typesAreCompatible() in C++ checks whether the types are *the same*, so
this uses custom logic if the type compatibility check fails.
This issue was found by a user on code like:
typedef enum {
CURLINFO_NONE,
CURLINFO_EFFECTIVE_URL,
CURLINFO_LASTONE = 60
} CURLINFO;
...
__builtin_va_arg(list, CURLINFO); // false positive warning
Given that C++ defers to C for the rules around va_arg, the behavior
should be the same in both C and C++ and not diagnose because int and
CURLINFO are "compatible enough" types for va_arg.
Matheus Izvekov [Tue, 8 Jun 2021 23:00:48 +0000 (01:00 +0200)]
[clang] NFC: rename SK_CastDerivedToBaseRValue to SK_CastDerivedToBasePRValue
This is a follow up to the "rvalue-to-prvalue" rename at D103720.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Depends on D103720
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D103933
Nico Weber [Wed, 9 Jun 2021 10:32:58 +0000 (06:32 -0400)]
Revert "[SROA] Avoid splitting loads/stores with irregular type"
This reverts commit
905f4eb537c118783969fded19e96fe6504c2956.
Breaks check-llvm on most (all?) bots, see https://reviews.llvm.org/D99435
Matheus Izvekov [Fri, 4 Jun 2021 21:15:23 +0000 (23:15 +0200)]
[clang] NFC: Rename rvalue to prvalue
This renames the expression value categories from rvalue to prvalue,
keeping nomenclature consistent with C++11 onwards.
C++ has the most complicated taxonomy here, and every other language
only uses a subset of it, so it's less confusing to use the C++ names
consistently, and mentally remap to the C names when working on that
context (prvalue -> rvalue, no xvalues, etc).
Renames:
* VK_RValue -> VK_PRValue
* Expr::isRValue -> Expr::isPRValue
* SK_QualificationConversionRValue -> SK_QualificationConversionPRValue
* JSON AST Dumper Expression nodes value category: "rvalue" -> "prvalue"
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D103720
Simon Pilgrim [Wed, 9 Jun 2021 10:09:19 +0000 (11:09 +0100)]
JSONNodeDumper.cpp - VisitIntegerLiteral - avoid APSInt::toString std::string wrapper. NFCI
Pulled out of D103888 - use the underlying SmallString version directly
Simon Pilgrim [Wed, 9 Jun 2021 10:06:23 +0000 (11:06 +0100)]
Interp.h - AddSubMulHelper - avoid APSInt::toString std::string wrapper. NFCI
Pulled out of D103888 - use the underlying SmallString version directly
LemonBoy [Wed, 9 Jun 2021 09:47:17 +0000 (11:47 +0200)]
[SROA] Avoid splitting loads/stores with irregular type
Upon encountering loads/stores on types whose size is not a multiple of 8 bits the SROA pass would either trip an assertion or use logic that was not meant to work with such irregularly-sized types.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D99435
Jim Lin [Wed, 9 Jun 2021 09:36:17 +0000 (17:36 +0800)]
[docs] Fix load instructions in chapter 7 of the tutorial
Loads in the first half of the chapter are missing the type argument.
Patched By: klao (Mihaly Barasz)
Reviewed By: Jim
Differential Revision: https://reviews.llvm.org/D90326
Lang Hames [Wed, 9 Jun 2021 08:56:30 +0000 (18:56 +1000)]
[JITLink][MachO] Handle muliple symbols at same offset when splitting C-strings.
The C-string section splitting support added in
f9649d123db triggered an assert
("Duplicate canonical symbol at address") when multiple symbols were defined at
the the same offset within a C-string block (this triggered on arm64, where we
always add a block start symbol). The bug was caused by a failure to update the
record of the last canonical symbol address. The fix was to maintain this record
correctly, and move the auto-generation of the block-start symbol above the
handling for symbols defined in the object itself so that all symbols
(auto-generated and defined) are processed in address order.
Florian Hahn [Wed, 9 Jun 2021 08:22:35 +0000 (09:22 +0100)]
[LTO] Support new PM in ThinLTOCodeGenerator.
This patch adds initial support for using the new pass manager when
doing ThinLTO via libLTO.
Reviewed By: steven_wu
Differential Revision: https://reviews.llvm.org/D102627
Javier Setoain [Thu, 22 Apr 2021 08:29:02 +0000 (09:29 +0100)]
[mlir][ArmSVE] Add basic mask generation operations
These `arm_sve.cmp` functions are needed to generate scalable vector
masks as long as scalable vectors are not part of the standard types.
Once in standard, these can be removed and `std.cmp` can be used
instead.
Differential Revision: https://reviews.llvm.org/D103473
Fraser Cormack [Wed, 9 Jun 2021 08:45:05 +0000 (09:45 +0100)]
[RISCV] Fix failing RVV MC tests
I believe these failures were introduced by D103790's changes to the
VType formatting found in vsetvli/vsetivli instructions.
David Spickett [Wed, 2 Jun 2021 11:06:15 +0000 (11:06 +0000)]
[compiler-rt] Mark symbolize_stack_fp test unsupported on Arm Thumb
The new test `symbolize_stack_fp.cpp` added in
https://reviews.llvm.org/D102046 assumes that
we can fall back to the fast unwinder.
This is not the case for Thumb and the test is currently
failing on our v7 thumb bot:
https://lab.llvm.org/buildbot/#/builders/26/builds/2096
Skip the test if we're building for a Thumb target.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D103512
Fraser Cormack [Tue, 8 Jun 2021 10:21:31 +0000 (11:21 +0100)]
[ValueTypes] Add missing enum names for MVTs
These types are (presumably) never used in the generated TableGen files.
The `default` switch case silences any compiler warnings for these
missing types so it's easy to miss.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D103883
Jingu Kang [Tue, 8 Jun 2021 17:24:38 +0000 (18:24 +0100)]
[LoopBoundSplit] Ignore phi node which is not scevable
There was a bug in LoopBoundSplit. The pass should ignore phi node which is not
scevable.
Differential Revision: https://reviews.llvm.org/D103913
David Spickett [Wed, 9 Jun 2021 08:41:59 +0000 (09:41 +0100)]
Revert "[lldb] Set return status to failed when adding a command error"
This reverts commit
e05b03cf4f45ac5ee63c59a3464e7d484884645c.
While I investigate a register test failure:
http://green.lab.llvm.org/green/blue/organizations/jenkins/lldb-cmake/detail/lldb-cmake/32693/pipeline/
Jan Kratochvil [Wed, 9 Jun 2021 08:39:42 +0000 (10:39 +0200)]
Revert "[llvm] Sync DebugInfo.h with DebugInfoFlags.def"
This reverts commit
093750dd0be6b0729f8e817766c3d5849545e10c.
It broke buildbots, goint to investigate it more.
Diana Picus [Mon, 7 Jun 2021 11:48:32 +0000 (11:48 +0000)]
[flang] Define the API for CPU_TIME
CPU_TIME takes a single real scalar INTENT(OUT) argument. We can
therefore return a double and let lowering handle casting that to the
precision used for the default real kind.
Differential Revision: https://reviews.llvm.org/D103805
Florian Hahn [Wed, 9 Jun 2021 08:01:33 +0000 (09:01 +0100)]
[ScalarEvolution] Add test for preserving add overflow flags.
Fraser Cormack [Tue, 8 Jun 2021 13:55:31 +0000 (14:55 +0100)]
[RISCV] Support CONCAT_VECTORS on scalable masks
This patch is a simple fix which registers CONCAT_VECTORS as
custom-lowered for scalable mask vectors. This follows the pattern of
all other scalable-vector types, as the default expansion of
CONCAT_VECTORS cannot handle scalable types, and even if it did it'd go
through the stack and generate worse code.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D103896
Jan Kratochvil [Wed, 9 Jun 2021 08:11:23 +0000 (10:11 +0200)]
[llvm] Sync DebugInfo.h with DebugInfoFlags.def
Command to see the differences:
diff -u <(sed -n 's#^HANDLE_DI_FLAG *([^,]*, *\([^()]*\)) *\(//.*\)\?$#\1#p' <llvm/include/llvm/IR/DebugInfoFlags.def | grep -vw Largest) <(sed -n 's#^ *LLVMDIFlag\([^ ]*\) *= (\?[0-9].*$#\1#p' <llvm/include/llvm-c/DebugInfo.h)
OCaml binding is more seriously out of sync but I have not tried to sync it.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D103910
Fabian Schuiki [Wed, 9 Jun 2021 08:03:18 +0000 (10:03 +0200)]
[MLIR] Make DictionaryAttr::getAs take name as && reference
As a follow-up to the discussion in https://reviews.llvm.org/D103822,
make the templated `DictionaryAttr::getAs` take the name by `&&`
reference and properly forward the argument to the underlying `get`.
serge-sans-paille [Fri, 14 May 2021 09:45:10 +0000 (11:45 +0200)]
Prevent generation of dependency on _cxa_guard for static initialization
This fixes an issue introduced by https://reviews.llvm.org/D70662
Function-scope static initialization are guarded in C++, so we should probably
not use it because it introduces a dependency on __cxa_guard* symbols.
In the context of clang, libasan is linked statically, and it currently needs to
the odd situation where compiling C code with clang and asan requires -lstdc++
Differential Revision: https://reviews.llvm.org/D102475
Esme-Yi [Wed, 9 Jun 2021 07:23:51 +0000 (07:23 +0000)]
Fix the 4203-Buildbot failure in LLVM Buildbot on llvm-clang-win-x-aarch64
Failure in llvm/test/tools/llvm-objdump/XCOFF/section-headers.test:
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes
in position 24-25: truncated \xXX escape
Guillaume Chatelet [Tue, 8 Jun 2021 12:50:34 +0000 (12:50 +0000)]
[NFC] Reformat MachineValueType
This is a follow up patch based on https://reviews.llvm.org/D103251#2804016.
Differential Revision: https://reviews.llvm.org/D103893
Jim Lin [Wed, 9 Jun 2021 07:19:43 +0000 (15:19 +0800)]
[Docs] Fix incorrect return type for example code
Tobias Gysi [Wed, 9 Jun 2021 06:31:53 +0000 (06:31 +0000)]
[mlir][linalg] Prepare fusion on tensors for scalar operands.
Adapt fusion on tensors to support structured ops taking scalar operands.
Differential Revision: https://reviews.llvm.org/D103889
Petr Hosek [Wed, 9 Jun 2021 05:44:53 +0000 (22:44 -0700)]
[CMake] Don't use libc++ by default on Windows yet
libc++ has issues when used with -fno-exceptions and vcruntime,
don't use it on Windows by default until we address those issues.
Differential Revision: https://reviews.llvm.org/D103941
Kai Luo [Wed, 9 Jun 2021 06:24:14 +0000 (06:24 +0000)]
[PowerPC] Make sure the first probe is full size or is the last probe when stack is realigned
When `-fstack-clash-protection` is enabled and stack has to be realigned, some parts of redzone is written prior the probe, so probe might overwrite content already written in redzone. To avoid it, we have to make sure the first probe is at full probe size or is the last probe so that we can skip redzone.
It also fixes violation of ABI under PPC where `r1` isn't updated atomically.
This fixes https://bugs.llvm.org/show_bug.cgi?id=49903.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D100290
Christian Sigg [Fri, 4 Jun 2021 11:52:34 +0000 (13:52 +0200)]
[mlir] Fix body-less async.execute printing
Reviewed By: ezhulenev
Differential Revision: https://reviews.llvm.org/D103686
Esme-Yi [Wed, 9 Jun 2021 05:35:52 +0000 (05:35 +0000)]
Remove white space in llvm-objdump/XCOFF/section-headers.test
Chris Bowler [Tue, 8 Jun 2021 21:46:47 +0000 (17:46 -0400)]
Fix LIT test failure encountered on AIX
```
fatal error: error in backend: getLangStandardForKind() on unspecified kind
```
Clang :: Modules/preprocess-module.cpp
Clang :: Modules/no-module-map.cpp
Clang :: Modules/preprocess-build-diamond.m
Clang :: Modules/preprocess-decluse.cpp
Clang :: Modules/string_names.cpp
Fix to prior commit
f38eff777e46f42884d82815d0b39766520ac2bf, D103707
Sterling Augustine [Tue, 8 Jun 2021 23:57:26 +0000 (16:57 -0700)]
Add Twine support for std::string_view.
With Twine now ubiquitous after rG92a79dbe91413f685ab19295fc7a6297dbd6c824,
it needs support for string_view when building clang with newer C++ standards.
This is similar to how StringRef is handled.
Differential Revision: https://reviews.llvm.org/D103935
Jim Lin [Tue, 8 Jun 2021 07:40:56 +0000 (15:40 +0800)]
[RISCV][NFC] Add a single space after comma for VType
In most of cases, it has a single space after comma in assembly operands.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D103790
Esme-Yi [Wed, 9 Jun 2021 03:11:33 +0000 (03:11 +0000)]
[NFC][XCOFF] Use yaml2obj in llvm-objdump/XCOFF/section-headers.test instead of binary files.
Summary: This a minor patch to refactor the test file,
llvm-objdump/XCOFF/section-headers.test, to use yaml2obj
for this testing rather than a canned binary.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D103146
Kai Luo [Wed, 9 Jun 2021 02:22:48 +0000 (02:22 +0000)]
[PowerPC][Dwarf] Assign MMA register's dwarf register number to negative value
According to ELF V2 ABI, `0` should be the dwarf number of `r0`. Currently MMA's register also uses `0` as its dwarf number, this confuses `RegisterInfoEmitter` and generates wrong dwarf -> llvm mapping.
```
extern const MCRegisterInfo::DwarfLLVMRegPair PPCDwarfFlavour1Dwarf2L[] = {
{ 0U, PPC::VSRp31 },
```
This leads to wrong cfi output in https://reviews.llvm.org/D100290.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D103761
Brendon Cahoon [Tue, 8 Jun 2021 20:54:42 +0000 (16:54 -0400)]
Reland "[AMDGPU] Add gfx1013 target"
This reverts commit
211e584fa2a4c032e4d573e7cdbffd622aad0a8f.
Fixed a use-after-free error that caused the sanitizers to fail.
David Blaikie [Wed, 9 Jun 2021 00:53:24 +0000 (17:53 -0700)]
ORTRT: Add tests for string_view equality and inequality operators
David Blaikie [Wed, 9 Jun 2021 00:53:14 +0000 (17:53 -0700)]
Add a couple of missing includes
David Blaikie [Wed, 9 Jun 2021 00:52:06 +0000 (17:52 -0700)]
Rename compiler-rt/lib/orc/endian.h to endianness.h to avoid conflict with system headers
Mehdi Amini [Wed, 9 Jun 2021 00:46:02 +0000 (00:46 +0000)]
Revert "Add a static assertions for custom Op<> to not defined data members (NFC)"
This reverts commit
c0edcec630eb26e12d66dae2f0e1fbf5258cb6ac.
The windows bot was broken by this change.
Mehdi Amini [Wed, 9 Jun 2021 00:42:21 +0000 (00:42 +0000)]
Add llvm_unreacheable to silence warning "not all control paths return a value" (NFC)
Joseph Huber [Tue, 8 Jun 2021 20:43:59 +0000 (16:43 -0400)]
[OpenMP] Add an information flag for device data transfers
This patch adds an information flag that indicated when data is being copied to
and from the device. This will be helpful for finding redundant or unnecessary
data transfers in applications.
Reviewed By: jdoerfert, grokos
Differential Revision: https://reviews.llvm.org/D103927
Lang Hames [Tue, 8 Jun 2021 23:01:35 +0000 (09:01 +1000)]
[JITLink][MachO] Split C-string literal sections on null-terminators.
MachO C-string literal sections should be split on null-terminator boundaries,
rather than the usual symbol boundaries. This patch updates
MachOLinkGraphBuilder to do that.
Siva Chandra Reddy [Wed, 9 Jun 2021 00:14:05 +0000 (00:14 +0000)]
[libc][NFC][Obvious] Compare against size_t values in ArrayRef tests.
Different platforms treat size_t differently so we should compare sizes
of ArrayRef objects with size_t values (instead of the current unsigned
long values.)
Siva Chandra Reddy [Tue, 8 Jun 2021 23:30:21 +0000 (23:30 +0000)]
[libc] Add a macro to include/exclude subprocess tests.
This is useful when bringing up LLVM libc on a new OS on which we do not
yet have the subprocess related helper functions.
Siva Chandra Reddy [Tue, 8 Jun 2021 23:04:11 +0000 (23:04 +0000)]
[libc][NFC] Use add_library instead of add_llvm_library for a few libraries.
These libraries do not depend on LLVM libraries anymore so they do not
have to be added using add_llvm_library.
Suraj Sudhir [Tue, 8 Jun 2021 22:58:06 +0000 (15:58 -0700)]
[mlir][tosa] Temporarily support 2D and 3D tensor types in matmul
Temporarily support 2D and 3D while the TOSA Matmul op is updated to support batched operations.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D103854
Quinn Pham [Tue, 8 Jun 2021 22:55:53 +0000 (17:55 -0500)]
[NFC] In the future, all intrinsics defined for compatibility with the XL
compiler will be placed in this collection.
This patch has no functional changes.
Differential revision: https://reviews.llvm.org/D103921
Sami Tolvanen [Tue, 8 Jun 2021 21:57:32 +0000 (14:57 -0700)]
LTO: Export functions referenced by non-canonical CFI jump tables
LowerTypeTests pass adds functions with a non-canonical jump table
to cfiFunctionDecls instead of cfiFunctionDefs. As the jump table
is in the regular LTO object, these functions will also need to be
exported. This change fixes the non-canonical jump table case and
adds a test similar to the existing one for canonical jump tables.
Reviewed By: pcc
Differential Revision: https://reviews.llvm.org/D103120
Whitney Tsang [Tue, 8 Jun 2021 21:47:56 +0000 (21:47 +0000)]
Revert "Revert "[LoopNest] Fix Wdeprecated-copy warnings""
This reverts commit
07ef5805abe5d4576eb5528eab63e75505bfd0bd.
The broke of the sanitizer-windows bot:
https://lab.llvm.org/buildbot/#/builders/127/builds/12064
is not caused by the original commit.
Differential Revision: https://reviews.llvm.org/D103752
patacca [Tue, 8 Jun 2021 21:45:34 +0000 (23:45 +0200)]
[Polly][Isl] Removing nullptr constructor from C++ bindings. NFC.
[Polly][Isl] Removing nullptr constructor from C++ bindings. NFC.
This is part of an effort to reduce the differences between the custom C++ bindings used right now by polly in `lib/External/isl/include/isl/isl-noxceptions.h` and the official isl C++ interface.
Changes made:
- Removed `std::nullptr_t` constructor from all the classes in the isl C++ bindings.
- `isl-noexceptions.h` has been generated by this https://github.com/patacca/isl/commit/
a7e00bea38f251a4bcf5c2c6ce5fa7ee5f661528
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D103751
Kevin Athey [Tue, 8 Jun 2021 19:45:48 +0000 (12:45 -0700)]
Update and improve compiler-rt tests for -mllvm -asan_use_after_return=(never|[runtime]|always).
In addition:
- optionally add global flag to capture compile intent for UAR:
__asan_detect_use_after_return_always.
The global is a SANITIZER_WEAK_ATTRIBUTE.
for issue: https://github.com/google/sanitizers/issues/1394
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D103304
Jonas Paulsson [Tue, 1 Jun 2021 16:38:00 +0000 (11:38 -0500)]
[SystemZ] Return true from convertSetCCLogicToBitwiseLogic for scalar integer.
Review: Ulrich Weigand
Shafik Yaghmour [Tue, 8 Jun 2021 21:02:55 +0000 (14:02 -0700)]
[LLDB][NFC] Remove parameter names from forward declarations from hand written expressions used in heap.py
heap.py has a lot of large hand written expressions and each name in the
expression will be looked up by clang during expression parsing. For
function parameters this will be in Sema::ActOnParamDeclarator(...) in order to
catch redeclarations of parameters. The names are not needed and we have seen
some rare cases where since we don't have symbols we end up in
SymbolContext::FindBestGlobalDataSymbol(...) which may conflict with other global
symbols.
There may be a way to make this lookup smarter to avoid these cases but it is
not clear how well tested this path is and how much work it would be to fix it.
So we will go with this fix while we investigate more.
Ref: rdar://
78265641
Sanjay Patel [Tue, 8 Jun 2021 20:45:29 +0000 (16:45 -0400)]
[InstCombine] fix nsz (fast-math) propagation from fneg-of-select
As discussed in the post-commit comments for:
3cdd05e519dd
It seems to be safe to propagate all flags from the final fneg
except for 'nsz' to the new select:
https://alive2.llvm.org/ce/z/J_APDc
nsz has unique FMF semantics: it is not poison, it is only
"insignificant" in the calculation according to the LangRef.
Sanjay Patel [Tue, 8 Jun 2021 20:06:10 +0000 (16:06 -0400)]
[InstCombine] add FMF tests for fneg-of-select; NFC
As noted in the post-commit comments for
3cdd05e519d,
we need to be more careful about FMF propagation.
Daniel Michael [Mon, 7 Jun 2021 16:10:46 +0000 (09:10 -0700)]
[scudo] Add Scudo support for Trusty OS
trusty.cpp and trusty.h define Trusty implementations of map and other
platform-specific functions. In addition to adding Trusty configurations
in allocator_config.h and size_class_map.h, MapSizeIncrement and
PrimaryEnableRandomOffset are added as configurable options in
allocator_config.h.
Background on Trusty: https://source.android.com/security/trusty
Differential Revision: https://reviews.llvm.org/D103578
Jonas Devlieghere [Tue, 8 Jun 2021 17:46:43 +0000 (10:46 -0700)]
[lldb] Don't print script output twice in HandleCommand
When executing a script command in HandleCommand(s) we currently print
its output twice
You can see this issue in action when adding a breakpoint command:
(lldb) b main
Breakpoint 1: where = main.out`main + 13 at main.cpp:2:3, address = 0x0000000100003fad
(lldb) break command add 1 -o "script print(\"Hey!\")"
(lldb) r
Process 76041 launched: '/tmp/main.out' (x86_64)
Hey!
(lldb) script print("Hey!")
Hey!
Process 76041 stopped
The issue is caused by HandleCommands using a temporary
CommandReturnObject and one of the commands (`script` in this case)
setting an immediate output stream. This causes the result to be printed
twice: once directly to the immediate output stream and once when
printing the result of HandleCommands.
This patch fixes the issue by introducing a new option to suppress
immediate output for temporary CommandReturnObjects.
Differential revision: https://reviews.llvm.org/D103349
David Green [Tue, 8 Jun 2021 20:54:59 +0000 (21:54 +0100)]
[DSE] Add another multiblock loop DSE test. NFC
As reported in D100464, the stores in these loops should not be removed.
Louis Dionne [Tue, 8 Jun 2021 20:32:53 +0000 (16:32 -0400)]
[libc++] NFC: Rewrite the documentation for the debug mode
Whitney Tsang [Tue, 8 Jun 2021 20:44:57 +0000 (20:44 +0000)]
Revert "[LoopNest] Fix Wdeprecated-copy warnings"
This reverts commit
dee1f0cb348b0a56375d9b563fb4d6918c431ed1.
It appears that this change broke the sanitizer-windows bot:
https://lab.llvm.org/buildbot/#/builders/127/builds/12064
Differential Revision: https://reviews.llvm.org/D103752
Petr Hosek [Tue, 8 Jun 2021 20:40:30 +0000 (13:40 -0700)]
[CMake][Fuchsia] Disable vcruntime for first stage as well
Using vcruntime is breaking libc++ headers so don't use it.
Differential Revision: https://reviews.llvm.org/D103926
Jonas Paulsson [Fri, 28 May 2021 22:08:51 +0000 (00:08 +0200)]
[SystemZ] Return true from isMaskAndCmp0FoldingBeneficial().
Return true if the mask is a constant uint of 2 bytes, in which case TMLL is
available.
Review: Ulrich Weigand
Brendon Cahoon [Tue, 8 Jun 2021 20:27:49 +0000 (16:27 -0400)]
Revert "[AMDGPU] Add gfx1013 target"
This reverts commit
ea10a86984ea73fcec3b12d22404a15f2f59b219.
A sanitizer buildbot reports an error.
David Green [Tue, 8 Jun 2021 20:23:08 +0000 (21:23 +0100)]
Revert "[DSE] Remove stores in the same loop iteration"
Apparently non-dead stores are being removed, as noted in D100464.
This reverts commit
222aeb4d51a46c5a81c9e4ccb16d1d19dd21ec95.
Petr Hosek [Tue, 8 Jun 2021 19:51:32 +0000 (12:51 -0700)]
David Green [Tue, 8 Jun 2021 19:51:33 +0000 (20:51 +0100)]
[ARM] Generate VDUP(Const) from constant buildvectors
If we cannot otherwise use a VMOVimm/VMOVFPimm/VMVNimm, fall back to
producing a VDUP(const) as opposed to a constant pool load. This will at
least be smaller codesize and can allow the VDUP to be folded into other
instructions.
Differential Revision: https://reviews.llvm.org/D103808
Eric Astor [Tue, 8 Jun 2021 19:30:11 +0000 (15:30 -0400)]
[ms] [llvm-ml] Disambiguate size directives and variable declarations
MASM allows statements of the form:
<VAR> DWORD 5
to declare a variable with name <VAR>, while:
call dword ptr [<value>]
is a valid instruction. To disambiguate, we recognize size directives by the trailing "ptr" token.
As discussed in https://lists.llvm.org/pipermail/llvm-dev/2021-May/150774.html
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D103257
Michael Liao [Tue, 8 Jun 2021 18:35:36 +0000 (14:35 -0400)]
[amdgpu] Add `-enable-ocl-mangling-mismatch-workaround`.
- Add `-enable-ocl-mangling-mismatch-workaround` to work around the
mismatch on OCL name mangling so far.
Reviewed By: yaxunl, rampitec
Differential Revision: https://reviews.llvm.org/D103920
Leonard Chan [Tue, 8 Jun 2021 19:37:04 +0000 (12:37 -0700)]
Fix for failing test mentioned in https://reviews.llvm.org/D103564.
This updates the path shown in the stack trace.
Alex Langford [Thu, 3 Jun 2021 19:14:20 +0000 (12:14 -0700)]
[lldb][NFC] Refactor name to index maps in Symtab
The various maps in Symtab lead to some repetative code. This should
improve the situation somewhat.
Differential Revision: https://reviews.llvm.org/D103652
Sanjay Patel [Tue, 8 Jun 2021 19:12:41 +0000 (15:12 -0400)]
[CodeGen] remove instcombine from codegen tests; NFC
The FileCheck lines in these files are auto-generated and complete,
so there's very little upside (less CHECK lines) from running
-instcombine on them and violating the expected test layering
(optimizer developers shouldn't have to be aware of clang tests).
Running opt passes like this makes it harder to make changes such as:
D93817
Petr Hosek [Tue, 8 Jun 2021 18:38:40 +0000 (11:38 -0700)]
[CMake][Fuchsia] Use PIC for Fuchsia runtimes
Disabling PIC globally also disabled PIC for runtimes which was
undesirable, manually override it.
Differential Revision: https://reviews.llvm.org/D103919
Nico Weber [Tue, 8 Jun 2021 19:21:03 +0000 (15:21 -0400)]
[gn build] (semi-manually) port
944b3c53aec5
Leonard Chan [Mon, 7 Jun 2021 22:35:28 +0000 (15:35 -0700)]
[NFC][compiler-rt][hwasan] Move allocation functions into their own file
This removes the `__sanitizer_*` allocation function definitions from
`hwasan_interceptors.cpp` and moves them into their own file. This way
implementations that do not use interceptors at all can just ignore
(almost) everything in `hwasan_interceptors.cpp`.
Also remove some unused headers in `hwasan_interceptors.cpp` after the move.
Differential Revision: https://reviews.llvm.org/D103564
Abhina Sreeskantharajan [Tue, 8 Jun 2021 18:44:45 +0000 (14:44 -0400)]
[SystemZ][z/OS] Pass OpenFlags when creating tmp files
This patch https://reviews.llvm.org/D102876 caused some lit regressions on z/OS because tmp files were no longer being opened based on binary/text mode. This patch passes OpenFlags when creating tmp files so we can open files in different modes.
Reviewed By: amccarth
Differential Revision: https://reviews.llvm.org/D103806
Matt Arsenault [Mon, 7 Jun 2021 22:57:03 +0000 (18:57 -0400)]
GlobalISel: Avoid use of G_INSERT in insertParts
G_INSERT legalization is incomplete and doesn't work very
well. Instead try to use sequences of G_MERGE_VALUES/G_UNMERGE_VALUES
padding with undef values (although this can get pretty large).
For the case of load/store narrowing, this is still performing the
load/stores in irregularly sized pieces. It might be cleaner to split
this down into equal sized pieces, and rely on load/store merging to
optimize it.
Matt Arsenault [Mon, 7 Jun 2021 21:01:03 +0000 (17:01 -0400)]
GlobalISel: Hide virtual register creation in MIRBuilder
David Green [Tue, 8 Jun 2021 18:39:45 +0000 (19:39 +0100)]
[ARM] A couple of extra VMOVimm tests, useful for showing BE codegen. NFC
Mehdi Amini [Tue, 8 Jun 2021 18:28:39 +0000 (18:28 +0000)]
Add a static assertions for custom Op<> to not defined data members (NFC)
A common mistake for newcomers to MLIR is to try to store extra member
on the Op class. However these are intended to be thing wrapper around
an Operation*, all the storage is meant to be encoded in attribute on
the underlying Operation. This can be confusing to debug, so better
catch it at build time.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D103869
Artur Pilipenko [Tue, 8 Jun 2021 18:26:27 +0000 (11:26 -0700)]
Add an option to hide "cold" blocks from CFG graph
Introduce a new cl::opt to hide "cold" blocks from CFG DOT graphs.
Use BFI to get block relative frequency. Hide the block if the
frequency is below the threshold set by the command line option value.
Reviewed By: davidxl, hoy
Differential Revision: https://reviews.llvm.org/D103640
Petr Hosek [Tue, 8 Jun 2021 18:01:58 +0000 (11:01 -0700)]
[CMake][Fuchsia] Include llvm-otool in Fuchsia toolchain
We want to use llvm-otool in our build.
Differential Revision: https://reviews.llvm.org/D103918
Craig Topper [Tue, 8 Jun 2021 18:13:18 +0000 (11:13 -0700)]
[RISCV] Remove dead code from fixed-vectors-abs.ll test cases. NFC
We had two pointer arguments and a dead load presumably copied
from a binary operation test and modified into unary abs.
Justin Bogner [Tue, 8 Jun 2021 18:14:33 +0000 (11:14 -0700)]
[FuzzMutate] Fix getWeight of InstDeleterIRStrategy
The comment states the following, for calculating the Line variable:
> Draw a line starting from when we only have 1k left and increasing
> linearly to double the current weight.
However, the value was not calculated as described. Instead, it would
result in a negative value, which resulted in the function always
returning 0 afterwards.
```
// Invariant: CurrentSize <= MaxSize - 200
// Invariant: CurrentWeight >= 0
int Line = (-2 * CurrentWeight) * (MaxSize - CurrentSize + 1000);
// {Line <= 0}
```
This commit fixes the issue and linearly interpolates as described.
Patch by Loris Reiff. Thanks!
Differential Revision: https://reviews.llvm.org/D96207
Nathan Sidwell [Wed, 5 May 2021 15:55:02 +0000 (08:55 -0700)]
[clang] p1099 using enum part 2
This implements the 'using enum maybe-qualified-enum-tag ;' part of
1099. It introduces a new 'UsingEnumDecl', subclassed from
'BaseUsingDecl'. Much of the diff is the boilerplate needed to get the
new class set up.
There is one case where we accept ill-formed, but I believe this is
merely an extended case of an existing bug, so consider it
orthogonal. AFAICT in class-scope the c++20 rule is that no 2 using
decls can bring in the same target decl ([namespace.udecl]/8). But we
already accept:
struct A { enum { a }; };
struct B : A { using A::a; };
struct C : B { using A::a;
using B::a; }; // same enumerator
this patch permits mixtures of 'using enum Bob;' and 'using Bob::member;' in the same way.
Differential Revision: https://reviews.llvm.org/D102241
Petr Hosek [Tue, 8 Jun 2021 17:47:23 +0000 (10:47 -0700)]
[CMake] Only include LTO on Apple targets
We only need libLTO when using ld64.
Differential Revision: https://reviews.llvm.org/D103916
Nick Desaulniers [Tue, 8 Jun 2021 15:57:12 +0000 (08:57 -0700)]
reland [IR] make -stack-alignment= into a module attr
Relands commit
433c8d950cb3a1fa0977355ce0367e8c763a3f13 with fixes for
MIPS.
Similar to D102742, specifying the stack alignment via CodegenOpts means
that this flag gets dropped during LTO, unless the command line is
re-specified as a plugin opt. Instead, encode this information as a
module level attribute so that we don't have to expose this llvm
internal flag when linking the Linux kernel with LTO.
Looks like external dependencies might need a fix:
* https://github.com/llvm-hs/llvm-hs/issues/345
* https://github.com/halide/Halide/issues/6079
Link: https://github.com/ClangBuiltLinux/linux/issues/1377
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D103048
Daniel McIntosh [Tue, 8 Jun 2021 17:59:11 +0000 (13:59 -0400)]
[libcxx] Remove VLA from libcxx locale header
The buffer size (`__nbuf`) in `num_put::do_put` is currently not an
integral/core constant expression. As a result, `__nar` is a Variable Length
Array (VLA). VLAs are a GNU extension and not part of the base C++ standard, so
unless there is good reason to do so they probably shouldn't be used in any of
the standard library headers. The call to `__iob.flags()` is the only thing
keeping `__nbuf` from being a compile time constant, so the solution here is to
simply err on the side of caution and always allocate a buffer large enough to
fit the base prefix.
Note that, while the base prefix for hex (`0x`) is slightly longer than the
base prefix for octal (`0`), this isn't a concern. The difference in the space
needed for the value portion of the string is enough to make up for this.
(Unless we're working with small, oddly sized types such as a hypothetical
`uint9_t`, the space needed for the value portion in octal is at least 1 more
than the space needed for the value portion in hex).
This PR also adds `constexpr` to `__nbuf` to enforce compile time const-ness
going forward.
Reviewed By: Mordante, #libc, Quuxplusone, ldionne
Differential Revision: https://reviews.llvm.org/D103558
Louis Dionne [Wed, 2 Jun 2021 21:07:57 +0000 (17:07 -0400)]
[libc++] Add a CI configuration for the modular build
Differential Revision: https://reviews.llvm.org/D103559
Justin Bogner [Tue, 2 Mar 2021 22:46:03 +0000 (14:46 -0800)]
[GlobalISel] Handle non-multiples of the base type in narrowScalarAddSub
When narrowing G_ADD and G_SUB, handle types that aren't a multiple of
the type we're narrowing to. This allows us to handle types like s96
on 64 bit targets.
Note that the test here has a couple of dead instructions because of
the way the setup legalizes. I wasn't able to come up with a way to
write this test that avoids that easily.
Differential Revision: https://reviews.llvm.org/D97811
Justin Bogner [Tue, 2 Mar 2021 17:49:15 +0000 (09:49 -0800)]
[GlobalISel] Handle non-multiples of the base type in narrowScalarInsert
When narrowing G_INSERT, handle types that aren't a multiple of the
type we're narrowing to. This comes up if we're narrowing something
like an s96 to fit in 64 bit registers and also for non-byte multiple
packed types if they come up.
This implementation handles these cases by extending the extra bits to
the narrow size and truncating the result back to the destination
size.
Differential Revision: https://reviews.llvm.org/D97791
Mehdi Amini [Tue, 8 Jun 2021 17:08:30 +0000 (17:08 +0000)]
Add missing header <atomic> in lib/IR/Verifier.cpp (NFC)
Fix the build on some platform.
Petr Hosek [Tue, 8 Jun 2021 08:03:26 +0000 (01:03 -0700)]
[Fuchsia] Update some of the Fuchsia toolchain flags
This should make the build more self-contained.
Differential Revision: https://reviews.llvm.org/D103875