Commit Graph

371515 Commits

Author SHA1 Message Date
Melanie Blower c511963d5a [clang] Fix length threshold for MicrosoftMangle md5 hash
Reviewers: rnk, dblaikie

Differential Revision: https://reviews.llvm.org/D90714
2020-11-07 07:40:24 -08:00
Melanie Blower b0de3f6787 [clang] Improve Microsoft mangling lit test with dblaikie's suggestions 2020-11-07 07:32:34 -08:00
Nikita Popov 57b3bc8c60 [CaptureTracking] Add statistics (NFC)
Add basic statistics on the number of pointers that have been
determined to maybe capture / not capture.
2020-11-07 12:57:00 +01:00
Nikita Popov f63ab188c6 [CaptureTracking] Early abort on too many uses (NFCI)
If there are too many uses, we should directly return -- there's
no point in inspecting the remaining uses in the worklist, as we
have to conservatively assume a capture anyway. This also means
that tooManyUses() gets called exactly once, rather than
potentially many times.

This restores the behavior prior to e9832dfdf3,
where this was accidentally changed while moving the AddUses logic
into a closure, thus making the return a return from the closure
rather than the whole function.
2020-11-07 11:52:08 +01:00
Nikita Popov d1fbf39b64 [CaptureTrackingTest] Add missing override marker (NFC) 2020-11-07 11:44:02 +01:00
Nikita Popov d35366bcca [CaptureTracking] Correctly handle multiple uses in one instruction
If the same value is used multiple times in the same instruction,
CaptureTracking may end up reporting the wrong use as being captured,
and/or report the same use as being captured multiple times.

Make sure that all checks take the use operand number into account,
rather than performing unreliable comparisons against the used value.

I'm not sure whether this can cause any problems in practice, but
at least some capture trackers (ArgUsesTracker, AACaptureUseTracker)
do care about which call argument is captured.
2020-11-07 11:31:20 +01:00
George Mitenkov 89eed79c1f [MLIR][SPIRVToLLVM] Added module name conversion
Since SPIR-V module has an optional name, this patch
makes a change to pass it to `ModuleOp` during conversion.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D90904
2020-11-07 12:27:44 +03:00
Nikita Popov bac97993ca [CaptureTracking] Avoid duplicate shouldExplode() check (NFCI)
We check shouldExplore() before adding uses to the worklist, so
uses that should not be explored will not reach captured() in the
first place.
2020-11-07 10:16:58 +01:00
Jonas Devlieghere 5d3332bc3c [DWARFLinker] Use union to reduce sizeof(WorklistItem) (NFC)
Reduce the size of the WorklistItem struct by using a struct.
2020-11-06 23:24:41 -08:00
Kazu Hirata 118c3f3cf2 [BranchProbabilityInfo] Simplify getEdgeProbability (NFC)
The patch simplifies BranchProbabilityInfo::getEdgeProbability by
handling two cases separately, depending on whether we have edge
probabilities.

- If we have edge probabilities, then add up probabilities for
  successors being equal to Dst.

- Otherwise, return the number of ocurrences divided by the total
  number of successors.

Differential Revision: https://reviews.llvm.org/D90980
2020-11-06 22:47:22 -08:00
Fangrui Song 8eb338a92a [test] Fix Other/new-pass-manager.ll with has different behaviors whether or not Polly is enabled
after D89158
2020-11-06 22:19:37 -08:00
Fangrui Song d2da05de7c [test] Fix Other/new-pass-manager.ll & clang/test/Misc/loop-opt-setup.c 2020-11-06 21:55:11 -08:00
Atmn Patel 04a0896487 Revert "[LoopDeletion] Allows deletion of possibly infinite side-effect free loops"
This reverts commit 0b17c6e447. This patch
causes a compile-time error in SCEV.
2020-11-07 00:32:12 -05:00
Atmn Patel d3e75d31e3 Revert "[CodeGen] Fixes sanitizer test"
This reverts commit b1878b4641. This does
fix the test but it means that ac73b73c16 is not implemented
correctly. Reverting for now, and will be reverting the commit that
causes this to fail.
2020-11-07 00:32:12 -05:00
Fangrui Song ee4769687d AsmPrinter/Dwarf*: Use llvm::Register instead of unsigned 2020-11-06 21:00:28 -08:00
Atmn Patel b1878b4641 [CodeGen] Fixes sanitizer test
By turning the loop into an infinite one, the loop can't be deleted
anymore so the test will continue to pass.
2020-11-06 23:53:38 -05:00
Fangrui Song f2e479db92 [OpenMP] Fix -Wmisleading-indentation after D84192 2020-11-06 20:09:43 -08:00
Fangrui Song 7684496035 [AsmPrinter] Rename ByteStreamer::EmitInt8 to emitInt8
to be consistent with other emit*
2020-11-06 20:02:56 -08:00
Atmn Patel 569abb530e [LoopDeletion] Fixes failing test
The commit 0b17c6e447 occasionally causes this test to
fail, this fixes it.
2020-11-06 22:45:28 -05:00
Jonas Devlieghere 3897137598 [DWARFLinker] Add CompileUnit::getInfo helper that takes a DWARFDie (NFC)
Eliminate the need to go through the DIE index by passing the DIE to
CompileUnit::getInfo directly.

Before:

  unsigned Idx = Unit->getOrigUnit().getDIEIndex(Die);
  CompileUnit::DIEInfo &Info = Unit->getInfo(Idx);

After:

  CompileUnit::DIEInfo &Info = Unit->getInfo(Die);
2020-11-06 19:37:44 -08:00
Atmn Patel 0b17c6e447 [LoopDeletion] Allows deletion of possibly infinite side-effect free loops
From C11 and C++11 onwards, a forward-progress requirement has been
introduced for both languages. In the case of C, loops with non-constant
conditionals that do not have any observable side-effects (as defined by
6.8.5p6) can be assumed by the implementation to terminate, and in the
case of C++, this assumption extends to all functions. The clang
frontend will emit the `mustprogress` function attribute for C++
functions (D86233, D85393, D86841) and emit the loop metadata
`llvm.loop.mustprogress` for every loop in C11 or later that has a
non-constant conditional.

This patch modifies LoopDeletion so that only loops with
the `llvm.loop.mustprogress` metadata or loops contained in functions
that are required to make progress (`mustprogress` or `willreturn`) are
checked for observable side-effects. If these loops do not have an
observable side-effect, then we delete them.

Loops without observable side-effects that do not satisfy the above
conditions will not be deleted.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D86844
2020-11-06 22:06:58 -05:00
cchen 0cab91140f [OpenMP5.0] map item can be non-contiguous for target update
In order not to modify the `tgt_target_data_update` information but still be
able to pass the extra information for non-contiguous map item (offset,
count, and stride for each dimension), this patch overload `arg` when
the maptype is set as `OMP_MAP_DESCRIPTOR`. The origin `arg` is for
passing the pointer information, however, the overloaded `arg` is an
array of descriptor_dim:

struct descriptor_dim {
  int64_t offset;
  int64_t count;
  int64_t stride
};

and the array size is the same as dimension size. In addition, since we
have count and stride information in descriptor_dim, we can replace/overload the
`arg_size` parameter by using dimension size.

For supporting `stride` in array section, we use a dummy dimension in
descriptor to store the unit size. The formula for counting the stride
in dimension D_n: `unit size * (D_0 * D_1 ... * D_n-1) * D_n.stride`.

Demonstrate how it works:
```
double arr[3][4][5];

D0: { offset = 0, count = 1, stride = 8 }                                // offset, count, dimension size always be 0, 1, 1 for this extra dimension, stride is the unit size
D1: { offset = 0, count = 2, stride = 8 * 1 * 2 = 16 }                   // stride = unit size * (product of dimension size of D0) * D1.stride = 4 * 1 * 2 = 8
D2: { offset = 2, count = 2, stride = 8 * (1 * 5) * 1 = 40  }            // stride = unit size * (product of dimension size of D0, D1) * D2.stride = 4 * 5 * 1 = 20
D3: { offset = 0, count = 2, stride = 8 * (1 * 5 * 4) * 2 = 320 }        // stride = unit size * (product of dimension size of D0, D1, D2) * D3.stride = 4 * 25 * 2 = 200

// X here means we need to offload this data, therefore, runtime will transfer
// data from offset 80, 96, 120, 136, 400, 416, 440, 456
// Runtime patch: https://reviews.llvm.org/D82245
// OOOOO OOOOO OOOOO
// OOOOO OOOOO OOOOO
// XOXOO OOOOO XOXOO
// XOXOO OOOOO XOXOO
```

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D84192
2020-11-06 21:04:37 -06:00
cchen 6847bcec1a [libomptarget] Add support for target update non-contiguous
This patch is the runtime support for https://reviews.llvm.org/D84192.

In order not to modify the tgt_target_data_update information but still be
able to pass the extra information for non-contiguous map item (offset,
count, and stride for each dimension), this patch overload arg when
the maptype is set as OMP_TGT_MAPTYPE_DESCRIPTOR. The origin arg is for
passing the pointer information, however, the overloaded arg is an
array of descriptor_dim:

```
struct descriptor_dim {
  int64_t offset;
  int64_t count;
  int64_t stride
};
```

and the array size is the dimension size. In addition, since we
have count and stride information in descriptor_dim, we can replace/overload the
arg_size parameter by using dimension size.

Reviewed By: grokos

Differential Revision: https://reviews.llvm.org/D82245
2020-11-06 20:55:33 -06:00
Mehdi Amini e6f3ec6ebb Don't link any LLVM/MLIR library to the C API unit-test
The tests are intended to exercise the public C API and will link to a
specific shared library exposing only the C API, this library itself may
link to libMLIR.so.
If we link some LLVM library statically in the test themselves, we end
up with duplicated cl::opt registrations in LLVM. A possible setup if
these libraries were needed could be to link libMLIR.so directly when
available and link statically when it isn't available (in which case the
libary exposing the C API would be statically link and isolated from the
cl::opt registry, hopefully).

Differential Revision: https://reviews.llvm.org/D90993
2020-11-07 01:54:31 +00:00
Atmn Patel 46a29e9c6e [Inliner] Handle `mustprogress` functions
When inlining `mustprogress` functions, if the caller or the callee has
the attribute, we drop the function attribute. The loops that have the
`llvm.loop.mustprogress` metadata keep their metadata. We do not need to
add new loop metadata to inlined functions because the patch in D86841
already adds the relevant loop metadata in all of the necessary places.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D87262
2020-11-06 20:03:46 -05:00
Fangrui Song 1ca7f055ad [test] -mtriple=x86_64-* -> -mtriple=x86_64 2020-11-06 16:49:52 -08:00
Stella Laurenzo 52d55d31d2 [mlir][Python] Fix cmake typo keeping the extension from installing. 2020-11-06 16:47:26 -08:00
Siva Chandra Reddy d50149b42e [libc] Extend WrapperGen to emit aliases.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D90985
2020-11-06 16:12:10 -08:00
Zequan Wu c75a0a1e9d [llvm-cov] Fix missing slash in -path-equivalence 2020-11-06 14:54:11 -08:00
Elvina Yakubova c9ca3a3c66 [AArch64] Add driver tests for HiSilicon's TSV110 2020-11-07 01:51:37 +03:00
Sean Silva e6e9e7eedf [mlir][Linalg] Canonicalize duplicate args.
I ran into this pattern when converting elementwise ops like
`addf %arg0, %arg : tensor<?xf32>` to linalg. Redundant arguments can
also easily arise from linalg-fusion-for-tensor-ops.

Also, fix some small bugs in the logic in
LinalgStructuredOpsInterface.td.

Differential Revision: https://reviews.llvm.org/D90812
2020-11-06 14:40:51 -08:00
Louis Dionne c1887e3f15 Revert "Allow running back-deployment testing against libc++abi"
This reverts commit 4d79ef814a, which broke a few build bots.
I'm reverting until I have time to investigate.
2020-11-06 17:26:42 -05:00
Elvina Yakubova 93b99728b1 [AArch64] Add pipeline model for HiSilicon's TSV110
This patch adds the scheduling and cost model for TSV110.

Reviewed by: SjoerdMeijer, bryanpkc

Differential Revision: https://reviews.llvm.org/D89972
2020-11-07 01:23:00 +03:00
Kazu Hirata eb2cf49ba8 [TableGen] Use llvm::is_contained (NFC) 2020-11-06 14:18:01 -08:00
Eric Astor 5afb360808 [ms] [llvm-ml] Allow arbitrary strings as integer constants
MASM interprets strings in expression contexts as integers expressed in big-endian base-256, treating each character as its ASCII representation.

This completely eliminates the need to special-case single-character strings.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D90788
2020-11-06 17:15:49 -05:00
Atmn Patel babc224c5d [LoopDeletion] Remove dead loops with no exit blocks
Currently, LoopDeletion refuses to remove dead loops with no exit blocks
because it cannot statically determine the control flow after it removes
the block. This leads to miscompiles if the loop is an infinite loop and
should've been removed.

Differential Revision: https://reviews.llvm.org/D90115
2020-11-06 17:08:34 -05:00
Alexander Shaposhnikov f147f59cd3 [llvm-objcopy][MachO] Skip sections with zero offset
Some binaries can contain regular sections with zero offset and zero size.
This diff makes llvm-objcopy's handling of such sections consistent with
cctools's strip (which doesn't modify them),
previously the tool would allocate file space for them.

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D90796
2020-11-06 13:29:43 -08:00
Jonas Devlieghere 2993850237 [debuginfo-tests] Skip optnone-loops.cpp on Darwin
This is failing on GreenDragon:
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/24745/
2020-11-06 13:05:33 -08:00
Stephen Kelly 0d6e1251d7 Add new matchers for dependent names in templates
Differential Revision: https://reviews.llvm.org/D90767
2020-11-06 21:03:20 +00:00
Mehdi Amini f580a49d27 Fix gcc warning by removing extra `;` after a macro (NFC) 2020-11-06 20:47:40 +00:00
Rahman Lavaee 82e7c4ce45 [obj2yaml] [yaml2obj] Add yaml support for SHT_LLVM_BB_ADDR_MAP section.
YAML support allows us to better test the feature in the subsequent patches. The implementation is quite similar to the .stack_sizes section.

Reviewed By: jhenderson, grimar

Differential Revision: https://reviews.llvm.org/D88717
2020-11-06 12:44:42 -08:00
Nathan James 062b5c598f
[clangd] Set the User option for clang-tidy to mimick its behaviour
Probably not essential as afaik only one check uses this field. but still good to have consistent behaviour.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D90552
2020-11-06 19:58:21 +00:00
Valentin Churavy 18805ea951 Fix unwind info relocation with large code model on AArch64
Makes sure that the unwind info uses 64bits pcrel relocation if a large code model is specified and handle the corresponding relocation in the ExecutionEngine. This can happen with certain kernel configuration (the same as the one in https://reviews.llvm.org/D27609, found at least on the ArchLinux stock kernel and the one used on https://www.packet.net/) using the builtin JIT memory manager.

Co-authored-by: Yichao Yu <yyc1992@gmail.com>

Differential Revision: https://reviews.llvm.org/D27629
2020-11-06 14:41:30 -05:00
Siva Chandra Reddy 573ade4bef [libc][WrapperGen] Replace the C _Noreturn annotation with C++ [[noreturn]].
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D90900
2020-11-06 11:37:48 -08:00
Valentin Churavy 85f4be0912 [RTDYLD] support absolute relocations where needed
These appear in some sections, such as DWARF tables, since
RuntimeDyldELF explicitly maps to this as a sentinel value:
29d1fba7b5/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp (L1199)

That could then be a source of problems if it tried to examine these
sections (for example, with either setProcessAllSections(true) or ORCv2 on i686).

Replaces https://reviews.llvm.org/D89241

Reviewed By: lhames, vchuravy

Differential Revision: https://reviews.llvm.org/D90722
2020-11-06 14:08:59 -05:00
Kazu Hirata 30929d1f7b [BranchProbabilityInfo] Use succ_size (NFC) 2020-11-06 11:05:35 -08:00
Craig Topper 16dccf716a [RISCV] Add test case to show incorrect matching to sroiw when the or mask does not have 1s in the upper 32 bits.
The matching code for sroiw is truncating the mask to 32 bits before
checking its value. We need to check all 64 bits.
2020-11-06 10:58:59 -08:00
Quentin Colombet a585228027 Prevent LICM and machineLICM from hoisting convergent operations
Results of convergent operations are implicitly affected by the
enclosing control flows and should not be hoisted out of arbitrary
loops.

Patch by Xiaoqing Wu <xiaoqing_wu@apple.com>

Differential Revision: https://reviews.llvm.org/D90361
2020-11-06 10:26:39 -08:00
Richard Howell 137ff73317 [lldb] add a missing dependency on intrinsics_gen
Sometimes builds will fail with errors like:

```
In file included from /build/external/llvm-project/lldb/source/Symbol/SwiftASTContext.cpp:52:
In file included from /build/external/swift/include/swift/IRGen/Linking.h:22:
In file included from /build/external/swift/include/swift/SIL/SILFunction.h:24:
In file included from /build/external/swift/include/swift/SIL/SILBasicBlock.h:23:
In file included from /build/external/swift/include/swift/SIL/SILInstruction.h:21:
In file included from /build/external/swift/include/swift/AST/Builtins.h:24:
**/build/external/llvm-project/llvm/include/llvm/IR/Attributes.h:74:14: fatal error: 'llvm/IR/Attributes.inc' file not found**
**^~~~~~~~~~~~~~~~~~~~~~~~**
```
This change ensures the `Attributes.inc` file is generated before building `SwiftASTContext.cpp`.

Differential Revision: https://reviews.llvm.org/D90857
2020-11-06 13:15:08 -05:00
Alex Zinenko b9c353fabb [mlir] Use PyValue instead of PyOpResult in Python operand container
The PyOpOperands container was erroneously constructing objects for
individual operands as PyOpResult. Operands in fact are just values,
which may or may not be results of another operation. The code would
eventually crash if the operand was a block argument. Add a test that
exercises the behavior that previously led to crashes.

Reviewed By: stellaraccident

Differential Revision: https://reviews.llvm.org/D90917
2020-11-06 19:02:35 +01:00