Commit Graph

375063 Commits

Author SHA1 Message Date
Xiang1 Zhang 50aaa8c274 [Debugify] Support checking Machine IR debug info
Add mir-check-debug pass to check MIR-level debug info.

For IR-level, currently, LLVM have debugify + check-debugify to generate
and check debug IR. Much like the IR-level pass debugify, mir-debugify
inserts sequentially increasing line locations to each MachineInstr in a
Module, But there is no equivalent MIR-level check-debugify pass, So now
we support it at "mir-check-debug".

Reviewed By: djtodoro

Differential Revision: https://reviews.llvm.org/D91595
2020-12-16 18:04:05 -08:00
Johannes Doerfert 2e6e4e6aee [OpenMP] Add initial support for `omp [begin/end] assumes`
The `assumes` directive is an OpenMP 5.1 feature that allows the user to
provide assumptions to the optimizer. Assumptions can refer to
directives (`absent` and `contains` clauses), expressions (`holds`
clause), or generic properties (`no_openmp_routines`, `ext_ABCD`, ...).

The `assumes` spelling is used for assumptions in the global scope while
`assume` is used for executable contexts with an associated structured
block.

This patch only implements the global spellings. While clauses with
arguments are "accepted" by the parser, they will simply be ignored for
now. The implementation lowers the assumptions directly to the
`AssumptionAttr`.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D91980
2020-12-16 20:02:49 -06:00
Nico Weber f48dae3108 [gn build] (manually) port ddffcdf0a6 2020-12-16 20:49:56 -05:00
Arthur Eubanks 4c8c636871 [test] Cleanup some CGSCCPassManager tests
Don't iterate over SCC as we potentially modify it.
Verify module (and fix some broken ones).
Only run pass once and make sure that it's actually run.
Rename tests to just end in a number since I'm planning on adding a
bunch more which won't have good individual names. Instead, add comments
on the transformations that each test does.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D93427
2020-12-16 16:25:55 -08:00
Nathan James ddffcdf0a6
[clang-tidy] Add a diagnostic callback to parseConfiguration
Currently errors detected when parsing the YAML for .clang-tidy files are always printed to errs.
For clang-tidy binary workflows this usually isn't an issue, but using clang-tidy as a library for integrations may want to handle displaying those errors in their own specific way.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D92920
2020-12-17 00:24:58 +00:00
Tres Popp b17a181563 [mlir] Modify linalg loops test to have nested regions
Differential Revision: https://reviews.llvm.org/D93418
2020-12-17 01:19:46 +01:00
LLVM GN Syncbot 672cdc84d2 [gn build] Port ac068e014b 2020-12-17 00:07:28 +00:00
Atmn 907886cc5b [OpenMP][Libomptarget][NFC] Use CMake Variables
This patchs adds CMake variables to add subdirectories and include
directories for libomptarget and explicitly gives the location of source
files.

Differential Revision: https://reviews.llvm.org/D93290
2020-12-16 19:05:15 -05:00
Hongtao Yu ac068e014b [CSSPGO] Consume pseudo-probe-based AutoFDO profile
This change enables pseudo-probe-based sample counts to be consumed by the sample profile loader under the regular `-fprofile-sample-use` switch with minimal adjustments to the existing sample file formats. After the counts are imported, a probe helper, aka, a `PseudoProbeManager` object, is automatically launched to verify the CFG checksum of every function in the current compilation against the corresponding checksum from the profile. Mismatched checksums will cause a function profile to be slipped. A `SampleProfileProber` pass is scheduled before any of the `SampleProfileLoader` instances so that the CFG checksums as well as probe mappings are available during the profile loading time. The `PseudoProbeManager` object is set up right after the profile reading is done. In the future a CFG-based fuzzy matching could be done in `PseudoProbeManager`.

Samples will be applied only to pseudo probe instructions as well as probed callsites once the checksum verification goes through. Those instructions are processed in the same way that regular instructions would be processed in the line-number-based scenario. In other words, a function is processed in a regular way as if it was reduced to just containing pseudo probes (block probes and callsites).

**Adjustment to profile format **

A CFG checksum field is being added to the existing AutoFDO profile formats. So far only the text format and the extended binary format are supported. For the text format, a new line like
```
!CFGChecksum: 12345
```
is added to the end of the body sample lines. For the extended binary profile format, we introduce a metadata section to store the checksum map from function names to their CFG checksums.

Differential Revision: https://reviews.llvm.org/D92347
2020-12-16 15:57:18 -08:00
Guozhi Wei 687e80be7f [MBP] Add whole chain to BlockFilterSet instead of individual BB
Currently we add individual BB to BlockFilterSet if its frequency satisfies

  LoopFreq / Freq <= LoopToColdBlockRatio

LoopFreq is edge frequency from outside to loop header.
LoopToColdBlockRatio is a command line parameter.

It doesn't make sense since we always layout whole chain, not individual BBs.

It may also cause a tricky problem. Sometimes it is possible that the LoopFreq
of an inner loop is smaller than LoopFreq of outer loop. So a BB can be in
BlockFilterSet of inner loop, but not in BlockFilterSet of outer loop,
like .cold in the test case. So it is added to the chain of inner loop. When
work on the outer loop, .cold is not added to BlockFilterSet, so the edge to
successor .problem is not counted in UnscheduledPredecessors of .problem chain.
But other blocks in the inner loop are added BlockFilterSet, so the whole inner
loop chain can be layout, and markChainSuccessors is called to decrease
UnscheduledPredecessors of following chains. markChainSuccessors calls
markBlockSuccessors for every BB, even it is not in BlockFilterSet, like .cold,
so .problem chain's UnscheduledPredecessors is decreased, but this edge was not
counted on in fillWorkLists, so .problem chain's UnscheduledPredecessors
becomes 0 when it still has an unscheduled predecessor .pred! And it causes
problems in following various successor BB selection algorithms.

Differential Revision: https://reviews.llvm.org/D89088
2020-12-16 15:45:47 -08:00
alex-t 35ec3ff76d Disable Jump Threading for the targets with divergent control flow
Details: Jump Threading does not make sense for the targets with divergent CF
         since they do not use branch prediction for speculative execution.
         Also in the high level IR there is no enough information to conclude that the branch is divergent or uniform.
         This may cause errors in further CF lowering.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D93302
2020-12-17 02:40:54 +03:00
Tom Roeder 1844ab770c [ASTImporter] Add support for importing GenericSelectionExpr AST nodes.
This allows ASTs to be merged when they contain GenericSelectionExpr
nodes (this is _Generic from C11). This is needed, for example, for
CTU analysis of C code that makes use of _Generic, like the Linux
kernel.

The node is already supported in the AST, but it didn't have a matcher
in ASTMatchers. So, this change adds the matcher and adds support to
ASTImporter. Additionally, this change adds support for structural
equivalence of _Generic in the AST.

Reviewed By: martong, aaron.ballman

Differential Revision: https://reviews.llvm.org/D92600
2020-12-16 15:39:50 -08:00
Tom Roeder f31e9bcd73 Test commit: add valid punctuation to a comment. NFC. 2020-12-16 15:33:19 -08:00
Gulfem Savrun Yeniceri 8a3c41be94 [IR] Fixed the typo in attributes test
Fixed the typo introduced in D90275.

Differential Revision: https://reviews.llvm.org/D93420
2020-12-16 15:06:23 -08:00
Harald van Dijk 09d0e7a7c1
[X86] Avoid %fs:(%eax) references in x32 mode
The ABI explains that %fs:(%eax) zero-extends %eax to 64 bits, and adds
that the TLS base address, but that the TLS base address need not be
at the start of the TLS block, TLS references may use negative offsets.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D93158
2020-12-16 22:39:57 +00:00
Thomas Preud'homme 150fe05db4 [Test] Fix undef var in catch-undef-behavior.c
Commit 9e52c43090 removed the directive
defining LINE_1600 but left a string substitution to that variable in a
CHECK-NOT directive. This will make that CHECK-NOT directive always fail
to match, no matter the string.

This commit follows the pattern done in
9e52c43090 of simplifying the CHECK-NOT to
only look for the function name and the opening parenthesis, thereby not
requiring the LINE_1600 variable.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D93350
2020-12-16 22:39:41 +00:00
Alexander Belyaev 9ca67d7f44 Revert "[mlir] Lookup the latest value with a legal type when remapping values."
This reverts commit f8184d4c44.
2020-12-16 23:09:04 +01:00
Mehdi Amini c21ee1a942 Improve the verifier diagnostic on dominance error
Address PR47937

Differential Revision: https://reviews.llvm.org/D93361
2020-12-16 22:05:17 +00:00
Roman Lebedev d22a47e9ff
[SimplifyCFG] Teach mergeEmptyReturnBlocks() to preserve DomTree
A first real transformation that didn't already knew how to do that,
but it's pretty tame - either change successor of all the predecessors
of a block and carefully delay deletion of the block until afterwards
the DomTree updates are appled, or add a successor to the block.

There wasn't a great test coverage for this, so i added extra, to be sure.
2020-12-17 01:03:50 +03:00
Roman Lebedev 5cce4aff18
[SimplifyCFG] TryToSimplifyUncondBranchFromEmptyBlock() already knows how to preserve DomTree
... so just ensure that we pass DomTreeUpdater it into it.

Fixes DomTree preservation for a large number of tests,
all of which are marked as such so that they do not regress.
2020-12-17 01:03:49 +03:00
Roman Lebedev 49dac4aca0
[SimplifyCFG] MergeBlockIntoPredecessor() already knows how to preserve DomTree
... so just ensure that we pass DomTreeUpdater it into it.

Fixes DomTree preservation for a large number of tests,
all of which are marked as such so that they do not regress.
2020-12-17 01:03:49 +03:00
Roman Lebedev 4fc169f664
[SimplifyCFG] removeUnreachableBlocks() already knows how to preserve DomTree
... so just ensure that we pass DomTreeUpdater it into it.

Apparently, there were no dedicated tests just for that functionality,
so i'm adding one here.
2020-12-17 01:03:49 +03:00
Roman Lebedev aa2009fe78
[NFCI][SimplifyCFG] Mark all the SimplifyCFG tests that already don't invalidate DomTree as such
First step after e113317958,
in these tests, DomTree is valid afterwards, so mark them as such,
so that they don't regress.

In further steps, SimplifyCFG transforms shall taught to preserve DomTree,
in as small steps as possible.
2020-12-17 01:03:49 +03:00
Fangrui Song 1bd928e50b [AArch64InstPrinter] Use * 4096 instead of << 12
Left shirting a negative integer is undefined before C++20.
2020-12-16 14:02:25 -08:00
Louis Dionne 46ae360452 [libc++] Fix CI Dockerfile
Installing clang-format-11 doesn't seem to work if it's done before
we've installed LLVM. I must admit I didn't try to get to the bottom
of the issue, since installing it after seems to work.
2020-12-16 17:01:21 -05:00
Reid Kleckner b7905e81fc Fix split-debug.c test on Windows 2020-12-16 13:48:57 -08:00
Rong Xu 0abd744597 [PGO] Use the sum of profile counts to fix the function entry count
Raw profile count values for each BB are not kept after profile
annotation. We record function entry count and branch weights
and use them to compute the count when needed.  This mechanism
works well in a perfect world, but often breaks in real programs,
because of number prevision, inconsistent profile, or bugs in
BFI). This patch uses sum of profile count values to fix
function entry count to make the BFI count close to real profile
counts.

Differential Revision: https://reviews.llvm.org/D61540
2020-12-16 13:37:43 -08:00
Marek Kurdej d69fc6629d [libc++] Install git-clang-format on CI nodes.
Two problems fixed:
* an old version of clang-format get installed by default (6.0).
* git-clang-format is not present, only git-clang-format-<version> (e.g. git-clang-format-6.0).

Solution:
* install clang-format-11 with explicit version
* make symlink git-clang-format to the latest version of git-clang-format-<version>

Differential Revision: https://reviews.llvm.org/D93201
2020-12-16 16:36:34 -05:00
Reid Kleckner 15ca54525d Fix XCore test on Windows, the register order is reversed, for reasons unknown 2020-12-16 13:33:24 -08:00
Sanjay Patel 46c331bf26 [VectorCombine] adjust test alignments for better coverage; NFC 2020-12-16 16:30:45 -05:00
Fangrui Song ef74f0fdc3 [libc++abi] Remove redundant null pointer check in operator delete
Similar to D52401. Normally operator delete is defined in libc++abi
(LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS is off by default).

C89 4.10.3.2 The free function
C99 7.20.3.2 The free function
C11 7.22.3.3 The free function

    If ptr is a null pointer, no action shall occur.

free on MSDN:

    If memblock is NULL, the pointer is ignored and free immediately returns.

Reviewed By: #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D93339
2020-12-16 13:29:40 -08:00
Nikita Popov e728024808 [DSE] Pass MemoryLocation by const ref (NFC) 2020-12-16 21:47:46 +01:00
Mircea Trofin cd551f8564 [NFC] Remove unused prefixes in llvm/test/CodeGen/X86
Differential Revision: https://reviews.llvm.org/D92965
2020-12-16 12:41:49 -08:00
Sanjay Patel 38ebc1a13d [VectorCombine] optimize alignment for load transform
Here's another minimal step suggested by D93229 / D93397 .
(I'm trying to be extra careful in these changes because
load transforms are easy to get wrong.)

We can optimistically choose the greater alignment of a
load and its pointer operand. As the test diffs show, this
can improve what would have been unaligned vector loads
into aligned loads.

When we enhance with gep offsets, we will need to adjust
the alignment calculation to include that offset.

Differential Revision: https://reviews.llvm.org/D93406
2020-12-16 15:25:45 -05:00
Shivanshu Goyal e53b9f733a Print source location in the error message when parens are missing around sizeof typename and the expression is inside macro expansion
Given the following code:

```
void Foo(int);

void Baz()
{
	Bar(sizeof int);
}
```

The error message which is printed today is this:
```
error: expected parentheses around type name in sizeof expression
```

There is no source location printed whatsoever, so fixing a compile break like this becomes extremely hard in a large codebase.

My change improves the error message. But it doesn't output a FixItHint because I wasn't able to figure out how to get the locations for left and right parens. So any tips would be appreciated.

```
<source>:7:6: error: expected parentheses around type name in sizeof expression
        Bar(sizeof int);
            ^
```

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D91129
2020-12-16 12:03:31 -08:00
Richard Smith 735ab86b81 PR47474: Add test for Clang's current behavior.
Our current behavior rejects the example, following the current language
rules, but it's likely the rules will be revised to allow this example.
2020-12-16 12:01:00 -08:00
Mitch Phillips 30d292ddbb [sanitizer-common] Pickup llvm-symbolizer from $OUT/bin IFF exists.
Fix-forward for D93352.

Slight rework of the same idea, pickup the external symbolizer from the
binary directory iff it exists.
2020-12-16 11:59:10 -08:00
Yaxun (Sam) Liu b9fb063e63 [clang-offload-bundler] Add option -allow-missing-bundles
There are out-of-tree tools using clang-offload-bundler to extract
bundles from bundled files. When a bundle is not in the bundled
file, clang-offload-bundler is expected to emit an error message
and return non-zero value. However currently clang-offload-bundler
silently generates empty file for the missing bundles.

Since OpenMP/HIP toolchains expect the current behavior, an option
-allow-missing-bundles is added to let clang-offload-bundler
create empty file when a bundle is missing when unbundling.
The unbundling job action is updated to use this option by
default.

clang-offload-bundler itself will emit error when a bundle
is missing when unbundling by default.

Changes are also made to check duplicate targets in -targets
option and emit error.

Differential Revision: https://reviews.llvm.org/D93068
2020-12-16 14:52:39 -05:00
Emma Blink 7685d818ef Mark implicit coroutine variables as being implicit
This prevents the clang-tidy readability-identifier-naming check from
triggering on implicit __coro_gro and __promise variables in coroutines.
2020-12-16 14:42:07 -05:00
Eugene Zhulenev 900d71a851 [mlir] Async: re-enable tests after fixing fkakines
Test flakiness was fixed by: 9edcedf7f2

Runs these tests to verify that all parts of the lowering work correctly.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D93384
2020-12-16 11:07:03 -08:00
Eugene Zhulenev 11f1027b4d [mlir] AsyncRuntime: mode runtime declarations to mlir::runtime namespace
Define Async runtime related typedefs in the `mlir::runtime` namespace.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D93391
2020-12-16 11:05:21 -08:00
Peter Steinfeld 4e90cad6a6 [flang] Handle undeclared names in EQUIVALENCE statements
Names in EQUIVALENCE statements are only allowed to indicate local
objects as per 19.5.1.4, paragraph 2, item (10).  Thus, a name appearing
in an EQUIVALENCE statement with no corresponding declaration in the
same scope is an implicit declaration of the name.  If that scope
contains an IMPLICIT NONE, it's an error.

I implemented this by adding a state variable to ScopeHandler to
indicate if we're resolving the names in an EQUIVALENCE statement and
then checked this state when resolving names.  I also added a test to
the existing tests for EQUIVALENCE statements.

Differential Revision: https://reviews.llvm.org/D93345
2020-12-16 11:04:27 -08:00
Jordan Rupprecht 869f8363c4 [lldb][NFC] Apply performance-faster-string-find (`str.find("X")` -> `str.find('x')`) 2020-12-16 10:53:18 -08:00
Florian Hahn 70bd75426e [SimplifyCFG] Precommit test for preserving !annotation. 2020-12-16 18:47:45 +00:00
Fangrui Song 0f10a26dd4 [Go] Fix bindings/go/llvm/IRBindings.cpp 2020-12-16 10:09:58 -08:00
Christian Sigg a79b26db0e [mlir] Fix for gpu-async-region pass.
- the !gpu.async.token is the second result of 'gpu.alloc async', not the first.
- async.execute construction takes operand types not yet wrapped in !async.value.
- fix typo

Reviewed By: herhut

Differential Revision: https://reviews.llvm.org/D93156
2020-12-16 19:08:10 +01:00
LLVM GN Syncbot d5700fdf10 [gn build] Port 6eff12788e 2020-12-16 17:38:06 +00:00
Bardia Mahjour 6eff12788e [DDG] Data Dependence Graph - DOT printer - recommit
This is being recommitted to try and address the MSVC complaint.

This patch implements a DDG printer pass that generates a graph in
the DOT description language, providing a more visually appealing
representation of the DDG. Similar to the CFG DOT printer, this
functionality is provided under an option called -dot-ddg and can
be generated in a less verbose mode under -dot-ddg-only option.

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D90159
2020-12-16 12:37:36 -05:00
Mehdi Amini 4bd9e62422 Remove spurious MLIRLLVMConversionsIncGen dependency from LLVM Dialect (NFC)
Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D93335
2020-12-16 17:32:49 +00:00
Sanjay Patel aaaf0ec72b [VectorCombine] loosen alignment constraint for load transform
As discussed in D93229, we only need a minimal alignment constraint
when querying whether a hypothetical vector load is safe. We still
pass/use the potentially stronger alignment attribute when checking
costs and creating the new load.

There's already a test that changes with the minimum code change,
so splitting this off as a preliminary commit independent of any
gep/offset enhancements.

Differential Revision: https://reviews.llvm.org/D93397
2020-12-16 12:25:18 -05:00