platform/upstream/llvm.git
4 years agoMerge OpFolderDialectInterface with DialectFoldInterface (NFC)
Mehdi Amini [Wed, 12 Aug 2020 22:45:16 +0000 (22:45 +0000)]
Merge OpFolderDialectInterface with DialectFoldInterface (NFC)

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D85823

4 years agoRemove DialectHooks and introduce a Dialect Interfaces instead
Mehdi Amini [Wed, 12 Aug 2020 09:36:54 +0000 (09:36 +0000)]
Remove DialectHooks and introduce a Dialect Interfaces instead

These hooks were introduced before the Interfaces mechanism was available.

DialectExtractElementHook is unused and entirely removed. The
DialectConstantFoldHook is used a fallback in the
operation fold() method, and is replaced by a DialectInterface.
The DialectConstantDecodeHook is used for interpreting OpaqueAttribute
and should be revamped, but is replaced with an interface in 1:1 fashion
for now.

Differential Revision: https://reviews.llvm.org/D85595

4 years agoPR47143: Don't crash while constant-evaluating value-initialization of
Richard Smith [Wed, 12 Aug 2020 23:53:02 +0000 (16:53 -0700)]
PR47143: Don't crash while constant-evaluating value-initialization of
an array of unknown bound as the initializer of an array new expression.

4 years ago[lldb] Fix relative imports and set the appropriate include dirs
Jonas Devlieghere [Wed, 12 Aug 2020 22:47:57 +0000 (15:47 -0700)]
[lldb] Fix relative imports and set the appropriate include dirs

After moving python.swig and lua.swig into their respective
subdirectories, the relative paths in these files were out of date. This
fixes that and ensures the appropriate include paths are set in the SWIG
invocation.

Differential revision: https://reviews.llvm.org/D85859

4 years ago[PowerPC] Implement Vector Shift Builtins
Albion Fung [Wed, 12 Aug 2020 23:26:43 +0000 (18:26 -0500)]
[PowerPC]  Implement Vector Shift Builtins

This patch implements the builtins for the vector shifts (shl, srl, sra), and
adds the appropriate test cases for these builtins. The builtins utilize the
vector shift instructions introduced within ISA 3.1.

Differential Revision: https://reviews.llvm.org/D83338

4 years ago[Coverage] Enable emitting gap area between macros
Zequan Wu [Tue, 11 Aug 2020 19:39:25 +0000 (12:39 -0700)]
[Coverage] Enable emitting gap area between macros

Differential Revision: https://reviews.llvm.org/D85176

4 years ago[NFC][MLIR][OpenMP] Add comments and test for OpenMP enum declaration utility
Kiran Chandramohan [Fri, 14 Aug 2020 21:54:29 +0000 (22:54 +0100)]
[NFC][MLIR][OpenMP] Add comments and test for OpenMP enum declaration utility

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D85857

4 years ago[flang][msvc] Remove default arguments for function specializations.
Michael Kruse [Wed, 12 Aug 2020 20:02:23 +0000 (15:02 -0500)]
[flang][msvc] Remove default arguments for function specializations.

C++ does not allow function template specializations to have default arguments. IIUC callers will only use the default arguments of the primary template. gcc and clang accept the syntax anyway, but msvc emits an error.

See https://en.cppreference.com/w/cpp/language/template_specialization for more details.

This patch is part of the series to [[ http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html | make flang compilable with MS Visual Studio ]].

Reviewed By: DavidTruby

Differential Revision: https://reviews.llvm.org/D85657

4 years ago[MLIR][NFC] Remove tblgen:: prefix in TableGen/*.cpp files
Rahul Joshi [Wed, 12 Aug 2020 00:47:07 +0000 (17:47 -0700)]
[MLIR][NFC] Remove tblgen:: prefix in TableGen/*.cpp files

- Add "using namespace mlir::tblgen" in several of the TableGen/*.cpp files and
  eliminate the tblgen::prefix to reduce code clutter.

Differential Revision: https://reviews.llvm.org/D85800

4 years ago[lldb] Fix unit test parsing to handle CR+LF as well as LF
Adrian McCarthy [Wed, 12 Aug 2020 20:50:28 +0000 (13:50 -0700)]
[lldb] Fix unit test parsing to handle CR+LF as well as LF

Apparently when the strings are created, the `'\n'` is converted to the
platform's natural new line indicator, which is CR+LF on Windows.  But
upon reading back with `sscanf`, the CRs caused a matching failure.

4 years ago[libcxx][test] Fix a -Wstring-concatenation warning in fuzzer_test.h
Erik Pilkington [Wed, 12 Aug 2020 19:02:24 +0000 (15:02 -0400)]
[libcxx][test] Fix a -Wstring-concatenation warning in fuzzer_test.h

This was causing failures on green dragon:
http://lab.llvm.org:8080/green/job/libc++%20and%20libc++abi%20trunk/780/

4 years agoBuild a flat LLDB.framework for embedded Darwin targets
Vedant Kumar [Tue, 11 Aug 2020 19:18:19 +0000 (12:18 -0700)]
Build a flat LLDB.framework for embedded Darwin targets

This patch configures LLDB.framework to build as a flat unversioned
framework on non-macOS Darwin targets, which have never supported the
macOS framework layout.

This patch also renames the 'IOS' cmake variable to 'APPLE_EMBEDDED' to
reflect the fact that lldb is built for several different kinds of embedded
Darwin targets, not just iOS.

Differential Revision: https://reviews.llvm.org/D85770

4 years ago[ValueTracking] Add abs intrinsics support to computeConstantRange()
Nikita Popov [Wed, 12 Aug 2020 20:26:12 +0000 (22:26 +0200)]
[ValueTracking] Add abs intrinsics support to computeConstantRange()

Implementation is the same as for SPF_ABS.

4 years ago[InstSimplify] Add additional abs intrinsic icmp tests (NFC)
Nikita Popov [Wed, 12 Aug 2020 20:21:47 +0000 (22:21 +0200)]
[InstSimplify] Add additional abs intrinsic icmp tests (NFC)

While abs >= 0 already folds, some variations thereon don't.

4 years ago[InstSimplify] Extract abs intrinsic tests into separate file (NFC)
Nikita Popov [Wed, 12 Aug 2020 20:14:44 +0000 (22:14 +0200)]
[InstSimplify] Extract abs intrinsic tests into separate file (NFC)

Also move some tests from InstCombine to InstSimplify,
as they are already handled by InstSimplify.

4 years ago[Sanitizer] Fix segfaults during unwinding on SystemZ
Ilya Leoshkevich [Wed, 12 Aug 2020 20:24:10 +0000 (22:24 +0200)]
[Sanitizer] Fix segfaults during unwinding on SystemZ

Every now and then SystemZ programs built with ASan crash with

    ERROR: AddressSanitizer: stack-overflow on address 0x040000000000

for no apparent reason. The problem is that
BufferedStackTrace::UnwindFast() is specialized for SystemZ: it takes
register 14 from the frame, however, IsValidFrame() is not
specialized, and does not guarantee that frame[14] is going to be a
valid memory access.

Fix by introducing per-arch kFrameSize and using it in IsValidFrame().

Reviewed By: uweigand

Differential Revision: https://reviews.llvm.org/D85822

4 years ago[lld][WebAssembly] Emit all return types of multivalue functions
Samuel Kostial [Wed, 12 Aug 2020 20:14:15 +0000 (13:14 -0700)]
[lld][WebAssembly] Emit all return types of multivalue functions

We previously were incorrectly emitting only the first result type.

Differential Revision: https://reviews.llvm.org/D85783

4 years ago[ValueTracking] Support min/max intrinsics in computeConstantRange()
Nikita Popov [Wed, 12 Aug 2020 20:05:56 +0000 (22:05 +0200)]
[ValueTracking] Support min/max intrinsics in computeConstantRange()

The implementation is the same as for the SPF_* case.

4 years ago[InstSimplify] Add tests for icmp of min/max with constants (NFC)
Nikita Popov [Wed, 12 Aug 2020 19:57:02 +0000 (21:57 +0200)]
[InstSimplify] Add tests for icmp of min/max with constants (NFC)

Test the case where the constants are not the same, but the result
is still known.

4 years ago[InstCombine] prefer xor with -1 because 'not' is easier to understand (PR32706)
Sanjay Patel [Wed, 12 Aug 2020 19:21:17 +0000 (15:21 -0400)]
[InstCombine] prefer xor with -1 because 'not' is easier to understand (PR32706)

This is a retry of rL300977 which was reverted because of infinite loops.
We have fixed all of the known places where that would happen, but there's
still a chance that this patch will cause infinite loops.

This matches the demanded bits behavior in the DAG and should fix:
https://bugs.llvm.org/show_bug.cgi?id=32706

Differential Revision: https://reviews.llvm.org/D32255

4 years ago[InstCombine] add test for 'not' vs 'xor'; NFC
Sanjay Patel [Wed, 12 Aug 2020 19:07:45 +0000 (15:07 -0400)]
[InstCombine] add test for 'not' vs 'xor'; NFC

4 years ago[Target] Cache the command line derived feature map in TargetOptions.
Craig Topper [Wed, 12 Aug 2020 18:47:29 +0000 (11:47 -0700)]
[Target] Cache the command line derived feature map in TargetOptions.

We can use this to remove some calls to initFeatureMap from Sema
and CodeGen when a function doesn't have a target attribute.

This reduces compile time of the linux kernel where this map
is needed to diagnose some inline assembly constraints based
on whether sse, avx, or avx512 is enabled.

Differential Revision: https://reviews.llvm.org/D85807

4 years ago[flang][msvc] Tell windows.h to not define min/max macros.
Michael Kruse [Wed, 12 Aug 2020 19:21:30 +0000 (14:21 -0500)]
[flang][msvc] Tell windows.h to not define min/max macros.

Defining macros for min and max breaks using std::min and std::max. Defining NOMINMAX before including the header stops them from being defined.

See https://web.archive.org/web/20170911092732/https://support.microsoft.com/en-us/help/143208/prb-using-stl-in-windows-program-can-cause-min-max-conflicts for details.

This patch is part of the series to [[ http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html | make flang compilable with MS Visual Studio ]].

Reviewed By: isuruf

Differential Revision: https://reviews.llvm.org/D85656

4 years agoPR47138: Don't crash if the preferred alignment of an invalid record
Richard Smith [Wed, 12 Aug 2020 19:24:08 +0000 (12:24 -0700)]
PR47138: Don't crash if the preferred alignment of an invalid record
type is requested.

4 years ago[WebAssembly] Fixed memory.init always using 64-bit ptr
Wouter van Oortmerssen [Wed, 12 Aug 2020 19:22:15 +0000 (12:22 -0700)]
[WebAssembly] Fixed memory.init always using 64-bit ptr

(because the is64 flag was tested incorrectly in LLD).

4 years ago[libc][obvious] Remove the unused file utils/CPP/StringRef.h.
Siva Chandra [Wed, 12 Aug 2020 07:54:51 +0000 (00:54 -0700)]
[libc][obvious] Remove the unused file utils/CPP/StringRef.h.

4 years ago[clang] Check `expr` inside `InitListChecker::UpdateStructuredListElement()`
Aleksandr Platonov [Wed, 12 Aug 2020 19:10:54 +0000 (22:10 +0300)]
[clang] Check `expr` inside `InitListChecker::UpdateStructuredListElement()`

- Prevent nullptr-deference at try to emit warning for invalid `expr`
- Simplify `InitListChecker::UpdateStructuredListElement()` usages. We do not need to check `expr` and increment `StructuredIndex` (for invalid `expr`) before the call anymore.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D85193

4 years ago[NFC][InstCombine] Add FIXME's for getLogBase2() / visitUDivOperand()
Roman Lebedev [Wed, 12 Aug 2020 18:59:57 +0000 (21:59 +0300)]
[NFC][InstCombine] Add FIXME's for getLogBase2() / visitUDivOperand()

These are not correctness issues.

In visitUDivOperand(), if the (potential) divisor is undef, then udiv is
already UB, so it is not incorrect to keep undef as shift amount.

But, that is suboptimal.
We could instead simply drop that select, picking the other operand.

Afterwards, getLogBase2() could assert that there is no undef in divisor.

4 years ago[InstCombine] Sanitize undef vector constant to 1 in X*(2^C) with X << C (PR47133)
Roman Lebedev [Wed, 12 Aug 2020 18:06:28 +0000 (21:06 +0300)]
[InstCombine] Sanitize undef vector constant to 1 in  X*(2^C) with X << C (PR47133)

While x*undef is undef, shift-by-undef is poison,
which we must avoid introducing.

Also log2(iN undef) is *NOT* iN undef, because log2(iN undef) u< N.

See https://bugs.llvm.org/show_bug.cgi?id=47133

4 years ago[SVE][VLS] Don't combine logical AND.
Francesco Petrogalli [Fri, 31 Jul 2020 20:19:23 +0000 (21:19 +0100)]
[SVE][VLS] Don't combine logical AND.

Testing is performed when targeting 128, 256 and 512-bit wide vectors.

For 128-bit vectors, the original behavior of using NEON instructions is
preserved.

Differential Revision: https://reviews.llvm.org/D85479

4 years ago[WebAssembly] Don't depend on the flags set by handleTargetFeatures in initFeatureMap.
Craig Topper [Wed, 12 Aug 2020 18:35:08 +0000 (11:35 -0700)]
[WebAssembly] Don't depend on the flags set by handleTargetFeatures in initFeatureMap.

Properly set "simd128" in the feature map when "unimplemented-simd128"
is requested.

initFeatureMap is used to create the feature vector used by
handleTargetFeatures. There are later calls to initFeatureMap in
CodeGen that were using these flags to recreate the map. But the
original feature vector should be passed to those calls. So that
should be enough to rebuild the map.

The only issue seemed to be that simd128 was not enabled in the
map by the first call to initFeatureMap. Using the SIMDLevel set
by handleTargetFeatures in the later calls allowed simd128 to be
set in the later versions of the map.

To fix this I've added an override of setFeatureEnabled that
will update the map the first time with the correct simd dependency.

Differential Revision: https://reviews.llvm.org/D85806

4 years ago[GlobalISel] Implement bit-test switch table optimization.
Amara Emerson [Tue, 4 Aug 2020 17:55:27 +0000 (10:55 -0700)]
[GlobalISel] Implement bit-test switch table optimization.

This is mostly a straight port from SelectionDAG. We re-use the actual bit-test
analysis part from SwitchLoweringUtils, which was factored out earlier to
support jump-tables.

Differential Revision: https://reviews.llvm.org/D85233

4 years agoFix signed/unsigned comparison warnings. NFC.
Simon Pilgrim [Wed, 12 Aug 2020 18:22:13 +0000 (19:22 +0100)]
Fix signed/unsigned comparison warnings. NFC.

4 years agoRecommit "[InstSimplify] Remove select ?, undef, X -> X and select ?, X, undef -...
Craig Topper [Wed, 12 Aug 2020 17:40:41 +0000 (10:40 -0700)]
Recommit "[InstSimplify] Remove select ?, undef, X -> X and select ?, X, undef -> X transforms" and its follow up patches

This recommits the following patches now that D85684 has landed

1cf6f210a2e [IR] Disable select ? C : undef -> C fold in ConstantFoldSelectInstruction unless we know C isn't poison.
469da663f2d [InstSimplify] Re-enable select ?, undef, X -> X transform when X is provably not poison
122b0640fc9 [InstSimplify] Don't fold vectors of partial undef in SimplifySelectInst if the non-undef element value might produce poison
ac0af12ed2f [InstSimplify] Add test cases for opportunities to fold select ?, X, undef -> X when we can prove X isn't poison
9b1e95329af [InstSimplify] Remove select ?, undef, X -> X and select ?, X, undef -> X transforms

4 years ago[SVE] Remove default-false VectorType::get
Christopher Tetreault [Wed, 12 Aug 2020 16:45:28 +0000 (09:45 -0700)]
[SVE] Remove default-false VectorType::get

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D84212

4 years ago[Scheduler] Fix typo in comments. NFC
David Green [Wed, 12 Aug 2020 17:36:05 +0000 (18:36 +0100)]
[Scheduler] Fix typo in comments. NFC

4 years ago[ARM] Predicated VFMA patterns
David Green [Wed, 12 Aug 2020 13:22:27 +0000 (14:22 +0100)]
[ARM] Predicated VFMA patterns

Similar to the Two op + select patterns that were added recently, this
adds some patterns for select + fma to turn them into predicated
operations.

Differential Revision: https://reviews.llvm.org/D85824

4 years ago[X86][SSE] Pull out BUILD_VECTOR operand equivalence tests. NFC.
Simon Pilgrim [Wed, 12 Aug 2020 16:41:09 +0000 (17:41 +0100)]
[X86][SSE] Pull out BUILD_VECTOR operand equivalence tests. NFC.

Pull out element equivalence code from isShuffleEquivalent/isTargetShuffleEquivalent, I've also removed many of the index modulos where possible.

First step toward simply adding some additional equivalence tests.

4 years ago[X86][GlobalISel] Legalize G_ICMP results to s8.
Craig Topper [Wed, 12 Aug 2020 17:03:10 +0000 (10:03 -0700)]
[X86][GlobalISel] Legalize G_ICMP results to s8.

We need to produce a setcc instruction which has an 8-bit result.
This gets rid of a bunch of cases that were using the s1->s8/s16/s32/s64
handling in selectZExt.

I'm not very familiar with GlobalISel yet so I'm not yet sure
the best way to do things. I'd especially like feedback on the
best way to handle the currently split 32-bit and 64-bit mode
handling.

Differential Revision: https://reviews.llvm.org/D85814

4 years agoFix sigaction interceptor to always correctly populate oldact
Matt Morehouse [Wed, 12 Aug 2020 16:19:25 +0000 (09:19 -0700)]
Fix sigaction interceptor to always correctly populate oldact

This fixes https://bugs.llvm.org/show_bug.cgi?id=47118. Before this change, when the sigaction interceptor prevented a signal from being changed, it also prevented the oldact output parameter from being written to. This resulted in a use-of-uninitialized-variable by any program that used sigaction for the purpose of reading signals.

This change fixes this: the regular sigaction implementation is still called, but with the act parameter nullified, preventing any changes.

Patch By: IanPudney

Reviewed By: morehouse

Differential Revision: https://reviews.llvm.org/D85797

4 years ago[SVE] Lower fixed length FP minnum/maxnum
Cameron McInally [Wed, 12 Aug 2020 17:00:37 +0000 (12:00 -0500)]
[SVE] Lower fixed length FP minnum/maxnum

Lower fixed length MINNUM/MAXNUM to scalable vectors. Cherry-picked from D71767 with added tests.

Differential Revision: https://reviews.llvm.org/D85744

4 years ago[UpdateTestChecks][FIX] Python 2.7 compatibility and use right prefix
Johannes Doerfert [Wed, 12 Aug 2020 16:56:55 +0000 (11:56 -0500)]
[UpdateTestChecks][FIX] Python 2.7 compatibility and use right prefix

4 years ago[SanitizerCoverage] Use zeroext for cmp parameters on all targets
Ilya Leoshkevich [Wed, 12 Aug 2020 16:37:28 +0000 (18:37 +0200)]
[SanitizerCoverage] Use zeroext for cmp parameters on all targets

Commit 9385aaa84851 ("[sancov] Fix PR33732") added zeroext to
__sanitizer_cov_trace(_const)?_cmp[1248] parameters for x86_64 only,
however, it is useful on other targets, in particular, on SystemZ: it
fixes swap-cmp.test.

Therefore, use it on all targets. This is safe: if target ABI does not
require zero extension for a particular parameter, zeroext is simply
ignored. A similar change has been implemeted as part of commit
3bc439bdff8b ("[MSan] Add instrumentation for SystemZ"), and there were
no problems with it.

Reviewed By: morehouse

Differential Revision: https://reviews.llvm.org/D85689

4 years ago[Driver] Change -fnostack-clash-protection to -fno-stack-clash-protection
Dávid Bolvanský [Wed, 12 Aug 2020 16:36:06 +0000 (18:36 +0200)]
[Driver] Change -fnostack-clash-protection to  -fno-stack-clash-protection

Clang command line docs mention `-fno-stack-clash-protection`, and GCC also uses  -fno-stack-clash-protection.

Fixes PR47139

Reviewed By: tstellar

Differential Revision: https://reviews.llvm.org/D85844

4 years ago[mlir] Added support for Index type inside getZeroAttr function
Jakub Lichman [Wed, 12 Aug 2020 13:07:28 +0000 (13:07 +0000)]
[mlir] Added support for Index type inside getZeroAttr function

Differential Revision: https://reviews.llvm.org/D85833

4 years ago[clang-tidy] use stable_sort instead of sort to fix EXPENSIVE_CHECKS tests
Erik Pilkington [Wed, 12 Aug 2020 15:51:52 +0000 (11:51 -0400)]
[clang-tidy] use stable_sort instead of sort to fix EXPENSIVE_CHECKS tests

http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/17317/console

4 years ago[AMDGPU][test] Add dedicated llvm-readobj test.
Stanislav Mekhanoshin [Mon, 10 Aug 2020 19:57:12 +0000 (12:57 -0700)]
[AMDGPU][test] Add dedicated llvm-readobj test.

Differential Revision: https://reviews.llvm.org/D85683

4 years ago[OPENMP] Fix PR47063: crash when trying to get captured statetment.
Alexey Bataev [Wed, 12 Aug 2020 15:48:53 +0000 (11:48 -0400)]
[OPENMP] Fix PR47063: crash when trying to get captured statetment.

Need to call getRawStmt() function instead, when trying to get inner
associated statement for the executable directive. Not all directives
use captured statements.

4 years ago[libc++] Remove workarounds for missing rvalue references
Louis Dionne [Thu, 30 Jul 2020 13:42:23 +0000 (09:42 -0400)]
[libc++] Remove workarounds for missing rvalue references

We don't support GCC in C++03 mode, and Clang provides rvalue references
even in C++03 mode. So there's effectively no supported compiler that
doesn't support rvalue references.

Differential Revision: https://reviews.llvm.org/D84943

4 years ago[mlir][linalg][NFC] Remove extra semi-colon causing warnings
Valentin Clement [Wed, 12 Aug 2020 15:44:00 +0000 (11:44 -0400)]
[mlir][linalg][NFC] Remove extra semi-colon causing warnings

Extra semi-colon causes bunch of warnings with GCC 9.2.0

```
[1354/1516] Building CXX object tools/mlir/lib/Dialect/Linalg/IR/CMakeFiles/obj.MLIRLinalgOps.dir/LinalgOps.cpp.o
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1306:35: warning: extra ';' [-Wpedantic]
 1306 | CANONICALIZERS_AND_FOLDERS(ConvOp);
      |                                   ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1307:41: warning: extra ';' [-Wpedantic]
 1307 | CANONICALIZERS_AND_FOLDERS(PoolingMaxOp);
      |                                         ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1308:41: warning: extra ';' [-Wpedantic]
 1308 | CANONICALIZERS_AND_FOLDERS(PoolingMinOp);
      |                                         ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1309:41: warning: extra ';' [-Wpedantic]
 1309 | CANONICALIZERS_AND_FOLDERS(PoolingSumOp);
      |                                         ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1310:35: warning: extra ';' [-Wpedantic]
 1310 | CANONICALIZERS_AND_FOLDERS(CopyOp);
      |                                   ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1311:35: warning: extra ';' [-Wpedantic]
 1311 | CANONICALIZERS_AND_FOLDERS(FillOp);
      |                                   ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1312:38: warning: extra ';' [-Wpedantic]
 1312 | CANONICALIZERS_AND_FOLDERS(GenericOp);
      |                                      ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1313:45: warning: extra ';' [-Wpedantic]
 1313 | CANONICALIZERS_AND_FOLDERS(IndexedGenericOp);
      |                                             ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1318:42: warning: extra ';' [-Wpedantic]
 1318 | CANONICALIZERS_AND_FOLDERS(BatchMatmulOp);
      |                                          ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1319:34: warning: extra ';' [-Wpedantic]
 1319 | CANONICALIZERS_AND_FOLDERS(DotOp);
      |                                  ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1320:37: warning: extra ';' [-Wpedantic]
 1320 | CANONICALIZERS_AND_FOLDERS(MatmulOp);
      |                                     ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1321:37: warning: extra ';' [-Wpedantic]
 1321 | CANONICALIZERS_AND_FOLDERS(MatvecOp);
      |                                     ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1322:36: warning: extra ';' [-Wpedantic]
 1322 | CANONICALIZERS_AND_FOLDERS(ConvWOp);
      |                                    ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1323:38: warning: extra ';' [-Wpedantic]
 1323 | CANONICALIZERS_AND_FOLDERS(ConvNWCOp);
      |                                      ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1324:38: warning: extra ';' [-Wpedantic]
 1324 | CANONICALIZERS_AND_FOLDERS(ConvNCWOp);
      |                                      ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1325:37: warning: extra ';' [-Wpedantic]
 1325 | CANONICALIZERS_AND_FOLDERS(ConvHWOp);
      |                                     ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1326:39: warning: extra ';' [-Wpedantic]
 1326 | CANONICALIZERS_AND_FOLDERS(ConvNHWCOp);
      |                                       ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1327:39: warning: extra ';' [-Wpedantic]
 1327 | CANONICALIZERS_AND_FOLDERS(ConvNCHWOp);
      |                                       ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1328:38: warning: extra ';' [-Wpedantic]
 1328 | CANONICALIZERS_AND_FOLDERS(ConvDHWOp);
      |                                      ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1329:40: warning: extra ';' [-Wpedantic]
 1329 | CANONICALIZERS_AND_FOLDERS(ConvNDHWCOp);
      |                                        ^
/home/4vn/versioning/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1330:40: warning: extra ';' [-Wpedantic]
 1330 | CANONICALIZERS_AND_FOLDERS(ConvNCDHWOp);
      |                                        ^
```

Reviewed By: mehdi_amini, rriddle

Differential Revision: https://reviews.llvm.org/D85766

4 years ago[OPENMP]Fix PR37671: Privatize local(private) variables in untied tasks.
Alexey Bataev [Wed, 12 Aug 2020 14:54:36 +0000 (10:54 -0400)]
[OPENMP]Fix PR37671: Privatize local(private) variables in untied tasks.

In untied tasks, need to allocate the space for local variales, declared
in task region, when the memory for task data is allocated. THe function
can be interrupted and we can exit from the function in untied task
switch. Need to keep the state of the local variables in this case.
Also, the compiler should not call cleanup when exiting in untied task
switch until the real exit out of the declaration scope is met during
 execution.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D84457

4 years ago[OpenCL] Remove warning for variadic macros in C++ for OpenCL.
Anastasia Stulova [Wed, 12 Aug 2020 09:01:46 +0000 (10:01 +0100)]
[OpenCL] Remove warning for variadic macros in C++ for OpenCL.

Patch by Ole Strohm (olestrohm)!

Tags: #clang

Differential Revision: https://reviews.llvm.org/D85429

4 years ago[Hexagon] Return scalar size in getMinVectorRegisterBitWidth() when no HVX
Krzysztof Parzyszek [Wed, 12 Aug 2020 15:11:12 +0000 (10:11 -0500)]
[Hexagon] Return scalar size in getMinVectorRegisterBitWidth() when no HVX

This fixes https://llvm.org/PR47128.

4 years ago[ARM][MVE] Enable tail predication for loops containing MVE gather/scatters
Anna Welker [Wed, 12 Aug 2020 12:44:18 +0000 (13:44 +0100)]
[ARM][MVE] Enable tail predication for loops containing MVE gather/scatters

Widen the scope of memory operations that are allowed to be tail predicated
to include gathers and scatters, such that loops that are auto-vectorized
with the option -enable-arm-maskedgatscat (and actually end up containing
an MVE gather or scatter) can be tail predicated.

Differential Revision: https://reviews.llvm.org/D85138

4 years ago[analyzer] StdLibraryFunctionsChecker: Add support for new functions
Zurab Tsinadze [Wed, 12 Aug 2020 14:18:42 +0000 (16:18 +0200)]
[analyzer] StdLibraryFunctionsChecker: Add support for new functions

`toupper`, `tolower`, `toascii` functions were added to
StdLibraryFunctionsChecker to fully cover CERT STR37-C rule:
https://wiki.sei.cmu.edu/confluence/x/BNcxBQ

Differential Revision: https://reviews.llvm.org/D85093

4 years ago[OPENMP]Do not add TGT_OMP_TARGET_PARAM flag to non-captured mapped arguments.
Alexey Bataev [Tue, 11 Aug 2020 16:30:45 +0000 (12:30 -0400)]
[OPENMP]Do not add TGT_OMP_TARGET_PARAM flag to non-captured mapped arguments.

If the arguments are mapped, but are actually not used in the target
region, the compiler still adds attribute TGT_OMP_TARGET_PARAM for such
arguments. It makes the libomptarget to add such parameters to the list
of arguments, passed to the kernel at the runtime, and may lead to
incorrect results/crashes during execution.

Differential Revision: https://reviews.llvm.org/D85755

4 years agoAMDGPU/GlobalISel: Select llvm.amdgcn.global.atomic.fadd
Matt Arsenault [Thu, 6 Aug 2020 03:21:16 +0000 (23:21 -0400)]
AMDGPU/GlobalISel: Select llvm.amdgcn.global.atomic.fadd

Remove the intermediate transform in the DAG path. I believe this is
the last non-deprecated intrinsic that needs handling.

4 years agoAMDGPU: Handle intrinsics in performMemSDNodeCombine
Matt Arsenault [Mon, 10 Aug 2020 16:25:48 +0000 (12:25 -0400)]
AMDGPU: Handle intrinsics in performMemSDNodeCombine

This avoids a possible regression in a future patch

4 years agoRevert "[OPENMP]Fix PR37671: Privatize local(private) variables in untied tasks."
Alexey Bataev [Wed, 12 Aug 2020 13:49:59 +0000 (09:49 -0400)]
Revert "[OPENMP]Fix PR37671: Privatize local(private) variables in untied tasks."

This reverts commit ec9563c54ed25e9f9cbe60985399212d50bd801d to
investigate compiler crash revelaed by the buildbots.

4 years ago[DWARFYAML] Make the address size of compilation units optional.
Xing GUO [Wed, 12 Aug 2020 13:47:27 +0000 (21:47 +0800)]
[DWARFYAML] Make the address size of compilation units optional.

This patch makes the 'AddrSize' field optional. If the address size is
missing, yaml2obj will infer it from the object file.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D85805

4 years ago[MachOYAML] Simplify the section data emitting function. NFC.
Xing GUO [Wed, 12 Aug 2020 13:44:56 +0000 (21:44 +0800)]
[MachOYAML] Simplify the section data emitting function. NFC.

This patch helps simplify some codes in writeSectionData() function.

Reviewed By: jhenderson, grimar

Differential Revision: https://reviews.llvm.org/D85821

4 years ago[OPENMP]Fix PR37671: Privatize local(private) variables in untied tasks.
Alexey Bataev [Tue, 21 Jul 2020 19:20:16 +0000 (15:20 -0400)]
[OPENMP]Fix PR37671: Privatize local(private) variables in untied tasks.

Summary:
In untied tasks, need to allocate the space for local variales, declared
in task region, when the memory for task data is allocated. THe function
can be interrupted and we can exit from the function in untied task
switch. Need to keep the state of the local variables in this case.
Also, the compiler should not call cleanup when exiting in untied task
switch until the real exit out of the declaration scope is met during
 execution.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, cfe-commits, sstefan1, caomhin

Tags: #clang

Differential Revision: https://reviews.llvm.org/D84457

4 years agoLimit Max Vector alignment on COFF targets to 8192.
Erich Keane [Fri, 7 Aug 2020 19:05:24 +0000 (12:05 -0700)]
Limit Max Vector alignment on COFF targets to 8192.

COFF targets have a max object alignment of 8192, so trying to create
one with a larger size results in an unreachable in WinCOFFObjectWriter.

For the reproducer I have uses thread local storage, however other
alignments are likely affected as well.

This patch sets the MaxVectorAlign for COFF to 8192.  Additionally,
though there is no longer a way to reproduce that I could find, it
correctly sets the MaxTLSAlign for COFF to that value as well, so that
if anyone comes up with a situation where this is true, it will cause an
error.

Differential Revision: https://reviews.llvm.org/D85543

4 years ago[VectorCombine] early exit if target has no vector registers
Sanjay Patel [Wed, 12 Aug 2020 13:20:59 +0000 (09:20 -0400)]
[VectorCombine] early exit if target has no vector registers

Based on post-commit discussion in:
D81766

Other vectorization passes (SLP and Loop) use this TTI API similarly.

4 years ago[VectorCombine] add test for x86 target with SSE disabled; NFC
Sanjay Patel [Wed, 12 Aug 2020 13:15:11 +0000 (09:15 -0400)]
[VectorCombine] add test for x86 target with SSE disabled; NFC

4 years ago[ARM] Add additional predicated VFMA tests. NFC
David Green [Wed, 12 Aug 2020 13:20:20 +0000 (14:20 +0100)]
[ARM] Add additional predicated VFMA tests. NFC

4 years ago[InstCombine] eliminate a pointer cast around insertelement
Sanjay Patel [Wed, 12 Aug 2020 13:08:17 +0000 (09:08 -0400)]
[InstCombine] eliminate a pointer cast around insertelement

I'm not sure if this solves PR46839 completely, but reducing the casting should help:
https://bugs.llvm.org/show_bug.cgi?id=46839

Differential Revision: https://reviews.llvm.org/D85647

4 years ago[VectorCombine] add test for Hexagon that would crash; NFC
Sanjay Patel [Wed, 12 Aug 2020 12:36:02 +0000 (08:36 -0400)]
[VectorCombine] add test for Hexagon that would crash; NFC

This test verifies the code change from:
rGb0b95dab1ce2
(although that would not be true if PR47128 is fixed)

4 years ago[SystemZ/ZOS] Implement computeHostNumPhysicalCores
Kai Nacke [Tue, 28 Jul 2020 08:33:50 +0000 (10:33 +0200)]
[SystemZ/ZOS] Implement computeHostNumPhysicalCores

On z/OS, the information is stored in the Common System Data Area
(CSD). It is the number of CPs allocated to the current LPAR.

Reviewers: aganea, hubert.reinterpertcast, MaskRay

Reviewed By: hubert.reinterpertcast

Differential Revision: https://reviews.llvm.org/D85531

4 years ago[LoopUnroll] Adjust CostKind query
Sam Parker [Tue, 11 Aug 2020 13:19:35 +0000 (14:19 +0100)]
[LoopUnroll] Adjust CostKind query

When TTI was updated to use an explicit cost, TCK_CodeSize was used
although the default implicit cost would have been the hand-wavey
cost of size and latency. So, revert back to this behaviour. This is
not expected to have (much) impact on targets since most (all?) of
them return the same value for SizeAndLatency and CodeSize.

When optimising for size, the logic has been changed to query
CodeSize costs instead of SizeAndLatency.

This patch also adds a testing option in the unroller so that
OptSize thresholds can be specified.

Differential Revision: https://reviews.llvm.org/D85723

4 years agoRevert "[lldb] Display autosuggestion part in gray if there is one possible suggestion"
Raphael Isemann [Wed, 12 Aug 2020 11:52:03 +0000 (13:52 +0200)]
Revert "[lldb] Display autosuggestion part in gray if there is one possible suggestion"

This reverts commit 246afe0cd17fce935a01171f3cca548e02523e5c. This broke
the following tests on Linux it seems:
  lldb-api :: commands/expression/multiline-completion/TestMultilineCompletion.py
  lldb-api :: iohandler/completion/TestIOHandlerCompletion.py

4 years ago[ARM] Commutative vmin/maxnma tests. NFC
David Green [Wed, 12 Aug 2020 11:50:18 +0000 (12:50 +0100)]
[ARM] Commutative vmin/maxnma tests. NFC

4 years ago[clang-tidy] prevent generated checks from triggering assertions on anonymous functions
Bogdan Serea [Tue, 11 Aug 2020 13:41:48 +0000 (14:41 +0100)]
[clang-tidy] prevent generated checks from triggering assertions on anonymous functions

Skeleton checks generated by clang-tidy add_check.py cause assertions to fail when run over anonymous functions(lambda functions). This patch introduces an additional check to verify that the target function is not anonymous before calling getName().
The code snippet from the [[ https://clang.llvm.org/extra/clang-tidy/Contributing.html | clang-tidy tutorial  ]]is also updated.

Reviewed By: alexfh, DavidTruby

Differential Revision: https://reviews.llvm.org/D85218

4 years ago[X86][SSE] Fold HOP(SHUFFLE(X),SHUFFLE(Y)) --> SHUFFLE(HOP(X,Y))
Simon Pilgrim [Wed, 12 Aug 2020 11:11:08 +0000 (12:11 +0100)]
[X86][SSE] Fold HOP(SHUFFLE(X),SHUFFLE(Y)) --> SHUFFLE(HOP(X,Y))

This is beginning to look like a canonicalization stage that could be performed as part of shuffle combining

Another step towards PR41813

4 years ago[lldb] Display autosuggestion part in gray if there is one possible suggestion
Shu Anzai [Wed, 12 Aug 2020 10:54:28 +0000 (12:54 +0200)]
[lldb] Display autosuggestion part in gray if there is one possible suggestion

I implemented autosuggestion if there is one possible suggestion.
I set the keybinds for every character. When a character is typed, Editline::TypedCharacter is called.
Then, autosuggestion part is displayed in gray, and you can actually input by typing C-k.
Editline::Autosuggest is a function for finding completion, and it is like Editline::TabCommand now, but I will add more features to it.

Testing does not work well in my environment, so I can't confirm that it goes well, sorry. I am dealing with it now.

Reviewed By: teemperor, JDevlieghere, #lldb

Differential Revision: https://reviews.llvm.org/D81001

4 years ago[mlir] Expose printing functions in C API
Alex Zinenko [Tue, 11 Aug 2020 16:25:09 +0000 (18:25 +0200)]
[mlir] Expose printing functions in C API

Provide printing functions for most IR objects in C API (except Region that
does not have a `print` function, and Module that is expected to be printed as
Operation instead). The printing is based on a callback that is called with
chunks of the string representation and forwarded user-defined data.

Reviewed By: stellaraccident, Jing, mehdi_amini

Differential Revision: https://reviews.llvm.org/D85748

4 years ago[llvm-readobj] - Refine logic of the symbol table locating in printRelocationsHelper().
Georgii Rymar [Thu, 6 Aug 2020 12:42:39 +0000 (15:42 +0300)]
[llvm-readobj] - Refine logic of the symbol table locating in printRelocationsHelper().

This removes the last `unwrapOrError` call from the `printRelocationsHelper`.

There is a little additional complexity because of `SHT_RELR/SHT_ANDROID_RELR` sections.
Such sections contains only relative relocations and they do not have a
symbol table associated with them, hence we should not try to treat
their `sh_link` field as a reference to a symbol table.

Differential revision: https://reviews.llvm.org/D85430

4 years ago[X86][AVX] Fold CONCAT(HOP(X,Y),HOP(Z,W)) -> HOP(CONCAT(X,Z),CONCAT(Y,W)) for float...
Simon Pilgrim [Wed, 12 Aug 2020 10:21:20 +0000 (11:21 +0100)]
[X86][AVX] Fold CONCAT(HOP(X,Y),HOP(Z,W)) -> HOP(CONCAT(X,Z),CONCAT(Y,W)) for float types

Only do this for AVX2+ targets as we still get some regressions on AVX1 without PERMPD/PERMQ

4 years ago[lldb] Add support for checking children in expect_expr
Raphael Isemann [Wed, 12 Aug 2020 09:27:21 +0000 (11:27 +0200)]
[lldb] Add support for checking children in expect_expr

expect_expr currently can't verify the children of the result SBValue.

This patch adds the ability to check them. The idea is to have a CheckValue
class where one can specify what attributes of a SBValue should be checked.
Beside the properties we already check for (summary, type, etc.) this also
has a list of children which is again just a list of CheckValue object (which
can also have children of their own).

The main motivation is to make checking the children no longer based
on error-prone substring checks that allow tests to pass just because
for example the error message contains the expected substrings by accident.

I also expect that we can just have a variant of `expect_expr` for LLDB's
expression paths (aka 'frame var') feature.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D83792

4 years ago[Transforms][SROA] Skip uses of allocas where the type is scalable
Cullen Rhodes [Tue, 11 Aug 2020 11:51:24 +0000 (11:51 +0000)]
[Transforms][SROA] Skip uses of allocas where the type is scalable

When visiting load and store instructions in SROA skip scalable vectors.
This is relevant in the implementation of the 'arm_sve_vector_bits'
attribute that is used to define VLS types, where an alloca of a
fixed-length vector could be bitcasted to scalable. See D85128 for more
information.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D85725

4 years agoAdd missing dependency on Doc generation for the OpenMP dialect
Mehdi Amini [Wed, 12 Aug 2020 09:11:32 +0000 (09:11 +0000)]
Add missing dependency on Doc generation for the OpenMP dialect

This is fixing the bot building the MLIR website.

4 years ago[mlir] use intptr_t in C API
Alex Zinenko [Tue, 11 Aug 2020 16:34:32 +0000 (18:34 +0200)]
[mlir] use intptr_t in C API

Using intptr_t is a consensus for MLIR C API, but the change was missing
from 75f239e9756b (that was using unsigned initially) due to a
misrebase.

Reviewed By: stellaraccident, mehdi_amini

Differential Revision: https://reviews.llvm.org/D85751

4 years ago[SCEV] Look through single value PHIs.
Florian Hahn [Wed, 12 Aug 2020 07:46:07 +0000 (08:46 +0100)]
[SCEV] Look through single value PHIs.

Now that SCEVExpander can preserve LCSSA form,
we do not have to worry about LCSSA form when
trying to look through PHIs. SCEVExpander will take
care of inserting LCSSA PHI nodes as required.

This increases precision of the analysis in some cases.

Reviewed By: mkazantsev, bmahjour

Differential Revision: https://reviews.llvm.org/D71539

4 years ago[llvm-dwarfdump] Avoid crashing if an abbreviation offset is invalid.
Igor Kudrin [Wed, 12 Aug 2020 08:37:16 +0000 (15:37 +0700)]
[llvm-dwarfdump] Avoid crashing if an abbreviation offset is invalid.

Note that DWARFUnit::getAbbreviations() returns nullptr if the
abbreviations could not be read, but callers used the returned
pointer without checking.

Differential Revision: https://reviews.llvm.org/D85738

4 years ago[ARM][MVE] tail-predication: overflow checks for backedge taken count.
Sjoerd Meijer [Tue, 11 Aug 2020 14:48:29 +0000 (15:48 +0100)]
[ARM][MVE] tail-predication: overflow checks for backedge taken count.

This pick ups the work on the overflow checks for get.active.lane.mask,
which ensure that it is safe to insert the VCTP intrinisc that enables
tail-predication. For a 2d auto-correlation kernel and its inner loop j:

  M = Size - i;
  for (j = 0; j < M; j++)
    Sum += Input[j] * Input[j+i];

For this inner loop, the SCEV backedge taken count (BTC) expression is:

  (-1 + (sext i16 %Size to i32)),+,-1}<nw><%for.body>

and LoopUtil cannotBeMaxInLoop couldn't calculate a bound on this, thus "BTC
cannot be max" could not be determined. So overflow behaviour had to be assumed
in the loop tripcount expression that uses the BTC. As a result
tail-predication had to be forced (with an option) for this case.

This change solves that by using ScalarEvolution's helper
getConstantMaxBackedgeTakenCount which is able to determine the range of BTC,
thus can determine it is safe, so that we no longer need to force tail-predication
as reflected in the changed test cases.

Differential Revision: https://reviews.llvm.org/D85737

4 years ago[SyntaxTree] Unbox operators into tokens for nodes generated from `CXXOperatorCallExpr`
Eduardo Caldas [Tue, 11 Aug 2020 16:28:00 +0000 (16:28 +0000)]
[SyntaxTree] Unbox operators into tokens for nodes generated from `CXXOperatorCallExpr`

For an user define `<`, `x < y` would yield the syntax tree:
```
BinaryOperatorExpression
|-IdExpression
| `-UnqualifiedId
|   `-x
|-IdExpression
| `-UnqualifiedId
|   `-<
`-IdExpression
  `-UnqualifiedId
    `-y
```
But there is no syntatic difference at call site between call site or
built-in `<`. As such they should generate the same syntax tree, namely:
```
BinaryOperatorExpression
|-IdExpression
| `-UnqualifiedId
|   `-x
|-<
`-IdExpression
  `-UnqualifiedId
    `-y
```

Differential Revision: https://reviews.llvm.org/D85750

4 years ago[SVE][CodeGen] Fix issues with EXTRACT_SUBVECTOR when using scalable FP vectors
David Sherwood [Fri, 7 Aug 2020 10:45:25 +0000 (11:45 +0100)]
[SVE][CodeGen] Fix issues with EXTRACT_SUBVECTOR when using scalable FP vectors

In this patch I have fixed two issues:

1. Our SVE tuple get/set intrinsics were using the wrong constant type
for the index passed to EXTRACT_SUBVECTOR. I have fixed this by using the
function SelectionDAG::getVectorIdxConstant to create the value. Also, I
have updated the documentation for EXTRACT_SUBVECTOR describing what type
the constant index should be and we now enforce this when creating the
node.
2. The AArch64 backend was missing the appropriate patterns for
extracting certain subvectors (nxv4f16 and nxv2f32) from legal SVE types.
I have added them as part of this patch.

The only way that I could find to test the new patterns was to use the
SVE tuple get intrinsics, although I realise it looks a bit unusual.
Tests added here:

  test/CodeGen/AArch64/sve-extract-subvector.ll

Differential Revision: https://reviews.llvm.org/D85516

4 years ago[VE] Change to promote i32 AND/OR/XOR operations
Kazushi (Jam) Marukawa [Tue, 11 Aug 2020 12:37:12 +0000 (21:37 +0900)]
[VE] Change to promote i32 AND/OR/XOR operations

VE has only 64 bits AND/OR/XOR instructions.  We pretended that VE has 32 bits
instructions also, but doing it increase the number of generated instructions.
Therefore, we decide to promote 32 bits operations and use only 64 bits
instructions in back end.  We also avoid pretending that VE has 32 bits LEA
instruction.  Update regression tests also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D85726

4 years ago[libc][obvious] Switch copysign[f|l] and fabs[f|l] to the new test matchers.
Siva Chandra [Wed, 12 Aug 2020 06:54:00 +0000 (23:54 -0700)]
[libc][obvious] Switch copysign[f|l] and fabs[f|l] to the new test matchers.

4 years ago[AST] Fix the CXXFoldExpr source range when parentheses range is invalid.
Haojian Wu [Wed, 12 Aug 2020 07:20:23 +0000 (09:20 +0200)]
[AST] Fix the CXXFoldExpr source range when parentheses range is invalid.

The CXXFoldExpr's range is invalid if the cxxfoldexpr is formed via the
Concept's TypeContraints (because the parentheses are not written in the
source code). We fallback to use the range from the pattern.

Differential Revision: https://reviews.llvm.org/D85645

4 years ago[MLIR,OpenMP] Lowering of parallel operation: proc_bind clause 2/n
Kiran Chandramohan [Wed, 22 Jul 2020 16:28:04 +0000 (17:28 +0100)]
[MLIR,OpenMP] Lowering of parallel operation: proc_bind clause 2/n

This patch adds the translation of the proc_bind clause in a
parallel operation.

The values that can be specified for the proc_bind clause are
specified in the OMP.td tablegen file in the llvm/Frontend/OpenMP
directory. From this single source of truth enumeration for
proc_bind is generated in llvm and mlir (used in specification of
the parallel Operation in the OpenMP dialect). A function to return
the enum value from the string representation is also generated.
A new header file (DirectiveEmitter.h) containing definitions of
classes directive, clause, clauseval etc is created so that it can
be used in mlir as well.

Reviewers: clementval, jdoerfert, DavidTruby

Differential Revision: https://reviews.llvm.org/D84347

4 years ago[X86][GlobalISel] Replace a misuse of SUBREG_TO_REG with INSERT_SUBREG.
Craig Topper [Wed, 12 Aug 2020 06:39:13 +0000 (23:39 -0700)]
[X86][GlobalISel] Replace a misuse of SUBREG_TO_REG with INSERT_SUBREG.

SUBREG_TO_REG is supposed to be used when we know the producing
instruction already zeroed the bits we're extending. But that's
not the case here. So INSERT_SUBREG with an IMPLICIT_DEF is the
correct thing to use.

4 years ago[MLIR][SPIRVToLLVM] Conversion for global and addressof
George Mitenkov [Wed, 12 Aug 2020 06:10:39 +0000 (09:10 +0300)]
[MLIR][SPIRVToLLVM] Conversion for global and addressof

Inital conversion of `spv._address_of` and `spv.globalVariable`.
In SPIR-V, the global returns a pointer, whereas in LLVM dialect
the global holds an actual value. This difference is handled by
`spv._address_of` and `llvm.mlir.addressof`ops that both return
a pointer. Moreover, only current invocation is in conversion's
scope.

Reviewed By: antiagainst, mravishankar

Differential Revision: https://reviews.llvm.org/D84626

4 years ago[libc][obvious] Switch nearest integer function tests to the new matchers.
Siva Chandra [Wed, 12 Aug 2020 05:13:59 +0000 (22:13 -0700)]
[libc][obvious] Switch nearest integer function tests to the new matchers.

4 years ago[NFC] Factor out hasForceAttributes
Kyungwoo Lee [Wed, 12 Aug 2020 06:14:35 +0000 (02:14 -0400)]
[NFC] Factor out hasForceAttributes

This is a preparation for https://reviews.llvm.org/D85586.

Differential Revision: https://reviews.llvm.org/D85793

4 years ago[Attributor][NFC] Reformat tests after D85099
Johannes Doerfert [Tue, 11 Aug 2020 01:31:30 +0000 (20:31 -0500)]
[Attributor][NFC] Reformat tests after D85099

Reviewed By: sstefan1

Differential Revision: https://reviews.llvm.org/D85700

4 years ago[UpdateTestChecks] Match unnamed values like "@[0-9]+" and "![0-9]+"
Johannes Doerfert [Mon, 10 Aug 2020 18:59:07 +0000 (13:59 -0500)]
[UpdateTestChecks] Match unnamed values like "@[0-9]+" and "![0-9]+"

With this patch we will match most *uses* of "temporary" named things in
the IR via regular expressions, not their name at creation time. The new
"values" we match are:
  - "unnamed" globals: `@[0-9]+`
  - debug metadata: `!dbg ![0-9]+`
  - loop metadata: `!loop ![0-9]+`
  - tbaa metadata: `!tbaa ![0-9]+`
  - range metadata: `!range ![0-9]+`
  - generic metadata: `metadata ![0-9]+`
  - attributes groups: `#[0-9]`

We still don't match the declarations but that can be done later. This
patch can introduce churn when existing check lines contain the old
hardcoded versions of the above "values". We can add a flag to opt-out,
or opt-in, if necessary.

Reviewed By: arichardson, MaskRay

Differential Revision: https://reviews.llvm.org/D85099

4 years ago[CMake] Simplify CMake handling for zlib
Petr Hosek [Thu, 30 Apr 2020 20:07:13 +0000 (13:07 -0700)]
[CMake] Simplify CMake handling for zlib

Rather than handling zlib handling manually, use find_package from CMake
to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
set to YES, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.

This is a reland of abb0075 with all followup changes and fixes that
should address issues that were reported in PR44780.

Differential Revision: https://reviews.llvm.org/D79219

4 years ago[NFC] Inline variable only used in debug builds
Jordan Rupprecht [Wed, 12 Aug 2020 02:38:01 +0000 (19:38 -0700)]
[NFC] Inline variable only used in debug builds

4 years ago[VectorCombine] add safety check for 0-width register
Sanjay Patel [Wed, 12 Aug 2020 00:27:50 +0000 (20:27 -0400)]
[VectorCombine] add safety check for 0-width register

Based on post-commit discussion in D81766, Hexagon sets this to "0".
I'll see if I can come up with a test, but making the obvious
code fix first to unblock that target.