Commit Graph

371275 Commits

Author SHA1 Message Date
Florian Hahn be0578f0b4 [GVN] Fix MemorySSA update when replacing assume(false) with stores.
When replacing an assume(false) with a store, we have to be more careful
with the order we insert the new access. This patch updates the code to
look at the accesses in the block to find a suitable insertion point.

Alterantively we could check the defining access of the assume, but IIRC
there has been some discussion about making assume() readnone, so
looking at the access list might be more future proof.

Fixes PR48072.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D90784
2020-11-05 12:09:32 +00:00
Sven van Haastregt 8ac9bcc746 [OpenCL] Support vec_step in C++ for OpenCL mode
Enable the vec_step builtin in C++ for OpenCL mode for compatibility
with OpenCL C.

Differential Revision: https://reviews.llvm.org/D90766
2020-11-05 12:02:59 +00:00
Simon Pilgrim 546d002d7a [GlobalISel] ComputeKnownBits - use common KnownBits shift handling (PR44526)
Convert GISelKnownBits.computeKnownBitsImpl shift handling to use the common KnownBits implementations, which makes use of the known leading/trailing bits for shifted values in cases where we don't know the shift amount value, as detailed in https://blog.regehr.org/archives/1709

Differential Revision: https://reviews.llvm.org/D90527
2020-11-05 11:52:26 +00:00
Adhemerval Zanella d025df3c1d [lsan] Disable some LSAN tests for arm-linux-gnueabi{hf}
The tests do not report the expected leak when issued with use_stack
or use_tls option equal to 0 on arm-linux-gnueabihf (ubuntu 18.04,
glibc 2.27).

This issue is being tracked by https://bugs.llvm.org/show_bug.cgi?id=48052
2020-11-05 08:32:53 -03:00
Adhemerval Zanella 0ad3cb8c26 [sanitizer] Assume getrandom might not be supported by the kernel
It was added on kernel 3.17.
2020-11-05 08:32:53 -03:00
Joachim Protze 7b0ca32b62 [OpenMP] avoid warning: equality comparison with extraneous parentheses
The macros are used in several places with an if(macro) pattern. This results
in several warnings about extraneous parenteses in equality comparison.

Having the constant at the lhs of the comparison, avoids this warning.

Differential Revision: https://reviews.llvm.org/D90756
2020-11-05 12:13:08 +01:00
Sander de Smalen d57bba7cf8 [SVE] Return StackOffset for TargetFrameLowering::getFrameIndexReference.
To accommodate frame layouts that have both fixed and scalable objects
on the stack, describing a stack location or offset using a pointer + uint64_t
is not sufficient. For this reason, we've introduced the StackOffset class,
which models both the fixed- and scalable sized offsets.

The TargetFrameLowering::getFrameIndexReference is made to return a StackOffset,
so that this can be used in other interfaces, such as to eliminate frame indices
in PEI or to emit Debug locations for variables on the stack.

This patch is purely mechanical and doesn't change the behaviour of how
the result of this function is used for fixed-sized offsets. The patch adds
various checks to assert that the offset has no scalable component, as frame
offsets with a scalable component are not yet supported in various places.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D90018
2020-11-05 11:02:18 +00:00
Simon Pilgrim b25765792b Revert rGbbeb08497ce58 "Revert "[GlobalISel] GISelKnownBits::computeKnownBitsImpl - Replace TargetOpcode::G_MUL handling with the common KnownBits::computeForMul implementation""
Updated the GISel KnownBits tests as KnownBits::computeForMul allows more accurate computation.
2020-11-05 10:39:53 +00:00
Simon Pilgrim 6c1a31858d [UnitTests] Add exhaustive tests for KnownBits shl/lshr/ashr
Thanks to @foad for the suggestion.
2020-11-05 10:13:16 +00:00
Simon Pilgrim 4b2be681f4 [InstCombine] Remove orphan InstCombinerImpl method declarations. NFCI. 2020-11-05 10:13:16 +00:00
Eduardo Caldas 23657d9cc3 [SyntaxTree] Add reverse links to syntax Nodes.
Rationale:
Children of a syntax tree had forward links only, because there was no
need for reverse links.

This need appeared when we started mutating the syntax tree.
On a forward list, to remove a target node in O(1) we need a pointer to the node before the target. If we don't have this "before" pointer, we have to find it, and that requires O(n).
So in order to remove a syntax node from a tree, we would similarly need to find the node before to then remove. This is both not ergonomic nor does it have a good complexity.

Differential Revision: https://reviews.llvm.org/D90240
2020-11-05 09:33:53 +00:00
Alex Zinenko b715fa330d [mlir] Restructure C API tests for IR
The test file is a long list of functions, followed by equally long FileCheck
comments inside "main". Distribute FileCheck comments closer to the functions
that produce the output we are checking.

Reviewed By: mehdi_amini, stellaraccident

Differential Revision: https://reviews.llvm.org/D90743
2020-11-05 10:12:46 +01:00
Nicolas Vasilache ecca7852d9 [mlir][Linalg] Side effects interface for Linalg ops
The LinalgDependenceGraph and alias analysis provide the necessary analysis for the Linalg fusion on buffers case.

However this is not enough for linalg on tensors which require proper memory effects to play nicely with DCE and other transformations.
This revision adds side effects to Linalg ops that were previously missing and has 2 consequences:
1. one example in the copy removal pass now fails since the linalg.generic op has side effects and the pass does not perform alias analysis / distinguish between reads and writes.
2. a few examples in fusion-tensor.mlir need to return the resulting tensor otherwise DCE automatically kicks in as part of greedy pattern application.

Differential Revision: https://reviews.llvm.org/D90762
2020-11-05 09:00:28 +00:00
Alex Zinenko cc2a2bb5ce [flang] update ODS syntax to use OpBuidlerDAG instead of OpBuilder
Upstream MLIR has deprecated OpBuilder in ODS.

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D90226
2020-11-05 09:28:20 +01:00
David Green f38d1a95e9 [ARM] Make tests less dependent on scheduling. NFC 2020-11-05 08:26:55 +00:00
Artur Bialas f9dca1039a [mlir][spirv] Add VectorExtractDynamicOp and vector.extractelement lowering
VectorExtractDynamicOp in SPIRV dialect
conversion from vector.extractelement to spirv VectorExtractDynamicOp

Differential Revision: https://reviews.llvm.org/D90679
2020-11-05 08:26:54 +01:00
Artur Bialas 1938b61bda [mlir][spirv] Allow usage of vector size 8 and 16 with Vector16 capability
Per spec, vector sizes 8 and 16 are allowed when Vector16 capability is present.
This change expands the limitation of vector sizes to accept these sizes.

Differential Revision: https://reviews.llvm.org/D90683
2020-11-05 08:26:15 +01:00
Arthur Eubanks 5fd3193c88 [test] Add 'REQUIRES: bpf-registered-target' to bpf-O0.c 2020-11-04 23:19:14 -08:00
Vitaly Buka 230efefdbc [NFC] Fix cpplint warnings 2020-11-04 22:56:08 -08:00
Vitaly Buka fbf7ccec02 [LSAN] Fix compilation error on MSVC 2020-11-04 22:32:49 -08:00
Vitaly Buka e62e0b1675 Revert "[LSAN] Fix preprocessor condition for MSVC"
Missread the error message. It was not the reason.

This reverts commit 2d041554d1.
2020-11-04 22:31:36 -08:00
Vitaly Buka 2d041554d1 [LSAN] Fix preprocessor condition for MSVC 2020-11-04 22:29:09 -08:00
Arthur Eubanks ae38540042 [NewPM] Provide method to run all pipeline callbacks, used for -O0
Some targets may add required passes via
    TargetMachine::registerPassBuilderCallbacks(). We need to run those even
    under -O0. As an example, BPFTargetMachine adds
    BPFAbstractMemberAccessPass, a required pass.

    This also allows us to clean up BackendUtil.cpp (and out-of-tree Rust
    usage of the NPM) by allowing us to share added passes like coroutines
    and sanitizers between -O0 and other optimization levels.

    Tests are a continuation of those added in
    https://reviews.llvm.org/D89083.

    In order to prevent TargetMachines from adding unnecessary optimization
    passes at -O0, TargetMachine::registerPassBuilderCallbacks() will be
    changed to take an OptimizationLevel, but that will be done separately.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D89158
2020-11-04 22:27:16 -08:00
Vitaly Buka 61e59ebfa6 [LSAN] Enabled only with __ANDROID_API__ >= 28
Code does not work as-is with emulated tls even if
lsan is disabled with runtime flag.
2020-11-04 22:18:05 -08:00
Mehdi Amini 4455f3ce72 Capture the name for mlir::OpPassManager in std::string instead of StringRef (NFC)
The previous behavior was fragile when building an OpPassManager using a
string, as it was forcing the client to ensure the string to outlive the
entire PassManager.
This isn't a performance sensitive area either that would justify
optimizing further.
2020-11-05 05:28:44 +00:00
Vy Nguyen 9f9077d7d1 [sanitizers] Add missing definition
Fix breakages from https://reviews.llvm.org/D90811

http://lab.llvm.org:8011/#/builders/37/builds/471/steps/8/logs/stdio

Differential Revision: https://reviews.llvm.org/D90818
2020-11-05 00:24:36 -05:00
Serge Pavlov 20b4f4f760 [Driver] Add callback to Command execution
Summary:
Object of type `Compilation` now can keep a callback that is called
after each execution of `Command`. This must simplify adaptation of
clang in custom distributions and allow facilities like collection of
execution statistics.

Reviewers: rsmith, rjmccall, Eugene.Zelenko

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78899
2020-11-05 12:21:40 +07:00
Max Kazantsev ab7ef35d34 Revert "[SCEV] Handle non-positive case in isImpliedViaOperations"
This reverts commit 8dc98897c4.

Commited by mistake.
2020-11-05 11:27:55 +07:00
Chen Zheng f645cea8f6 [MachineSink] add more profitable pattern.
Add more profitable sinking patterns if the target bb register pressure
is not too high.

Reviewed By: qcolombet

Differential Revision: https://reviews.llvm.org/D88126
2020-11-04 23:11:22 -05:00
Max Kazantsev 8dc98897c4 [SCEV] Handle non-positive case in isImpliedViaOperations
We already handle non-negative case there. Add support for non-positive.
2020-11-05 11:07:37 +07:00
Craig Topper 574de837d4 Recommit "[RISCV] Move some test cases from rv64i-single-softfloat.ll to a new rv64i-double-softfloat.ll. NFC""
With new test file this time.

Original message

This new test covers both with and without the F extension enabled.

This shows that the fptosi/fptoui for double->i32 use a different
libcall depending on whether the F extension is enabled. If it's
not enabled we use the 'si' library call. If it is enabled we use 'di'.
2020-11-04 19:58:11 -08:00
Craig Topper 7709d30641 Revert "[RISCV] Move some test cases from rv64i-single-softfloat.ll to a new rv64i-double-softfloat.ll. NFC"
I failed to git add the new test file.

This reverts commit 36072cc0a4.
2020-11-04 19:55:13 -08:00
Craig Topper 36072cc0a4 [RISCV] Move some test cases from rv64i-single-softfloat.ll to a new rv64i-double-softfloat.ll. NFC
This new test covers both with and without the F extension enabled.

This shows that the fptosi/fptoui for double->i32 use a different
libcall depending on whether the F extension is enabled. If it's
not enabled we use the 'si' library call. If it is enabled we use 'di'.
2020-11-04 19:51:43 -08:00
Atmn Patel cea0599aa7 [LangRef] Adds llvm.loop.mustprogress loop metadata
This patch adds the llvm.loop.mustprogress loop metadata. This is to be
added to loops where the frontend language requires that the loop makes
observable interactions with the environment. This is the loop-level
equivalent to the function attribute `mustprogress` defined in D86233.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D88464
2020-11-04 22:32:50 -05:00
Vitaly Buka 234857f730 [sanitizer] Fix -fno-emulated-tls setup
COMPILER_RT_TEST_COMPILER_CFLAGS is a string
2020-11-04 19:23:28 -08:00
Vitaly Buka 6c164d6080 [NFC] Extract InitializePlatformCommonFlags
And move some Android specifi declarations from headers

Differential Revision: https://reviews.llvm.org/D90811
2020-11-04 19:23:28 -08:00
Vy Nguyen 796650d990 [lsan] Remove unnecessary elf-tls condition
Differential Revision: https://reviews.llvm.org/D90808
2020-11-04 22:21:40 -05:00
Atmn Patel ac73b73c16 [clang] Add mustprogress and llvm.loop.mustprogress attribute deduction
Since C++11, the C++ standard has a forward progress guarantee
[intro.progress], so all such functions must have the `mustprogress`
requirement. In addition, from C11 and onwards, loops without a non-zero
constant conditional or no conditional are also required to make
progress (C11 6.8.5p6). This patch implements these attribute deductions
so they can be used by the optimization passes.

Differential Revision: https://reviews.llvm.org/D86841
2020-11-04 22:03:14 -05:00
Vitaly Buka bbd4ebffd4 [sanitizer] Quick fix for non-Linux build 2020-11-04 18:35:04 -08:00
Vitaly Buka e15f424cf9 [LSAN] Fix CAN_SANITIZE_LEAKS on Android 2020-11-04 18:35:04 -08:00
Fangrui Song bf146857bb [mlir] Change deprecated -Werror-implicit-function-declaration to -Werror=implicit-function-declaration
This -Werror- form has been deprecated since 2007 (GCC r122017).

And only enable it for CMAKE_C_FLAGS. C++ does not need it.
2020-11-04 18:33:51 -08:00
Valentin Clement 1dad9d4282 [flang][openacc] Lower wait directive
This patch upstream the lowering of Wait directive that was initially done in
https://github.com/flang-compiler/f18-llvm-project/pull/532

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D90489
2020-11-04 21:15:52 -05:00
Vy Nguyen 484ec6be30 Reland [lsan] Enable LSAN for Android
Reland: a2291a58bf.

New fixes for the breakages reported in D85927 include:
 - declare a weak decl for `dl_iterate_phdr`, because it does not exist on older  APIs
 - Do not enable leak-sanitizer if api_level is less than 29, because of  `ld.lld: error: undefined symbol: __aeabi_read_tp` for armv7, API level 16.
 - Put back the interceptor for `memalign` but still opt out intercepting `__libc_memalign` and `cfree` because both of these don't exist in Bionic.

Reviewed By: srhines, vitalybuka

Differential Revision: https://reviews.llvm.org/D89251
2020-11-04 18:00:25 -08:00
Fangrui Song 96b0b9a5e3 [X86] Enable shrink-wrapping for no-frame-pointer non-nounwind functions on platforms not using compact unwind
The current compact unwind scheme does not work when the prologue is not at the
start (the instructions before the prologue cannot be described).  (Technically
this is fixable, but it requires multiple compact unwind descriptors for one
function.)

rL255175 chose to not perform shrink-wrapping for no-frame-pointer functions not
marked as nounwind to work around PR25614. This is overly limited, as platforms
not supporting compact unwind (all non-Darwin) does not need the workaround.
This patch restricts the limitation to compact unwind platforms.

Reviewed By: qcolombet

Differential Revision: https://reviews.llvm.org/D89930
2020-11-04 16:51:48 -08:00
Vy Nguyen 678edfc1f3 [sanitizer] Allow preinit array on Android
Extracted from D89251
2020-11-04 16:46:10 -08:00
Valentin Clement 4ec7f7e45a [flang][openacc] Lower init and shutdown directive
This patch upstream the lowering of Init and Shutdown directives that was initially done in
https://github.com/flang-compiler/f18-llvm-project/pull/529

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D90488
2020-11-04 19:30:46 -05:00
Rahul Joshi 8e466f69cf [MLIR][NFC] Update syntax of global_memref in ODS description.
- The ODS description was using an old syntax that was updated during the review.
  This fixes the ODS description to match the current syntax.

Differential Revision: https://reviews.llvm.org/D90797
2020-11-04 15:58:46 -08:00
Vitaly Buka a52852f694 [NFC][sanitizer] Reformat some code
Extracted from D89251
2020-11-04 15:37:48 -08:00
Baptiste Saleil f976ba6139 [PowerPC] Add Sema checks for MMA types
The use of the new types introduced for PowerPC MMA instructions needs to be restricted.
We add a PowerPC function checking that the given type is valid in a context in which we don't allow MMA types.
This function is called from various places in Sema where we want to prevent the use of these types.

Differential Revision: https://reviews.llvm.org/D82035
2020-11-04 17:01:47 -06:00
Arthur O'Dwyer 418de7d5d8 Fix UB in one libcxx test, when deleting D through a pointer to B.
This undefined behavior was found by applying Lénárd Szolnoki's proposal
to disable implicit conversion of default_delete<D> to default_delete<B>.

The offending part of the test is circa line 243.

The wording that makes it undefined behavior is http://eel.is/c++draft/expr.delete#3 .

Differential Revision: https://reviews.llvm.org/D90536
2020-11-04 17:34:05 -05:00