platform/upstream/llvm.git
4 years ago[flang][openacc] OpenACC 3.0 parser
Valentin Clement [Tue, 14 Jul 2020 00:11:52 +0000 (20:11 -0400)]
[flang][openacc] OpenACC 3.0 parser

Summary:
This patch introduce the parser for OpenACC 3.0 in Flang. It uses the same TableGen mechanism
than OpenMP.

Reviewers: nvdatian, sscalpone, tskeith, klausler, ichoyjx, jdoerfert, DavidTruby

Reviewed By: klausler

Subscribers: SouraVX, mgorny, hiraditya, jfb, sstefan1, llvm-commits

Tags: #llvm, #flang

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

4 years ago[MSAN] Implement experimental vector reduction intrinsics
Gui Andrade [Tue, 30 Jun 2020 22:34:43 +0000 (22:34 +0000)]
[MSAN] Implement experimental vector reduction intrinsics

Implement llvm.experimental.vector.{add,mul,or,and,...}.
An IR test is included but no C test for lack of good way to
get the compiler to emit these.

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

4 years ago[llvm][NFC] Removed unused CHECKs in a ml test
Mircea Trofin [Mon, 13 Jul 2020 23:58:16 +0000 (16:58 -0700)]
[llvm][NFC] Removed unused CHECKs in a ml test

The CHECKs are now in Inputs/test-module.ll

4 years agoBasic support for flexible array members in constant evaluation.
Richard Smith [Mon, 13 Jul 2020 23:54:39 +0000 (16:54 -0700)]
Basic support for flexible array members in constant evaluation.

We don't allow runtime-sized flexible array members, nor initialization
of flexible array members, but it seems reasonable to support the most
basic case where the flexible array member is empty.

4 years ago[PowerPC] Fix combineVectorShuffle regression after D77448
Fangrui Song [Mon, 13 Jul 2020 23:57:06 +0000 (16:57 -0700)]
[PowerPC] Fix combineVectorShuffle regression after D77448

Commit 1fed131660b2 assumed that NewShuffle (shuffle vector
canonicalization result) will always be ShuffleVectorSDNode, which may
be false (it may be a BITCAST node):

```
...
t12: v4i32 = scalar_to_vector t2
t15: v16i8 = bitcast t12  # LHS
t17: v16i8 = vector_shuffle<u,u,u,u,u,u,u,u,0,1,2,3,u,u,u,u> t15, undef:v16i8  # SVN
```

Reviewed By: #powerpc, nemanjai

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

4 years ago[builtins][ARM] Replace call_apsr.S with inline asm
Ryan Prichard [Fri, 19 Jun 2020 06:47:18 +0000 (23:47 -0700)]
[builtins][ARM] Replace call_apsr.S with inline asm

The %arm_call_apsr expansion doesn't work when config.clang is a clang
driver defaulting to a non-ARM arch. Rather than fix it, replace
call_apsr.S with inline asm in call_apsr.h, which also resolves the
FIXME added in D31259.

Maybe the `__attribute__((noinline,pcs("aapcs")))` attributes are
unnecessary on the static functions, but I was unsure what liberty the
compiler had to insert instructions that modified the condition codes,
so it seemed helpful.

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

4 years ago[compiler-rt][Android] Stop using detect_target_arch
Ryan Prichard [Fri, 19 Jun 2020 06:53:49 +0000 (23:53 -0700)]
[compiler-rt][Android] Stop using detect_target_arch

For Android only, compiler-rt used detect_target_arch to select the
architecture to target. detect_target_arch was added in Sept 2014
(SVN r218605). At that time, compiler-rt selected the default arch
using ${LLVM_NATIVE_ARCH}, which seems to have been the host
architecture and therefore not suitable for cross-compilation.

The compiler-rt build system was refactored in Sept 2015 (SVN r247094
and SVN r247099) to use COMPILER_RT_DEFAULT_TARGET_TRIPLE to control
the target arch rather than LLVM_NATIVE_ARCH. This approach is simpler
and also works for Android cross-compilation, so remove the
detect_target_arch function.

Android targets i686, but compiler-rt seems to identify 32-bit x86 as
"i386". For Android, we were previously calling add_default_target_arch
with i386, and calling add_default_target_arch with i686 does not build
anything. i686 is not listed in builtin-config-ix.cmake,
ALL_BUILTIN_SUPPORTED_ARCH.

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

4 years ago[builtins] Cleanup generic-file filtering
Ryan Prichard [Fri, 19 Jun 2020 06:59:36 +0000 (23:59 -0700)]
[builtins] Cleanup generic-file filtering

Split filter_builtin_sources into two functions:
 - filter_builtin_sources that removes generic files when an
   arch-specific file is selected.
 - darwin_filter_builtin_sources that implements the EXCLUDE/INCLUDE
   lists (using the files in lib/builtins/Darwin-excludes).

darwin_filter_builtin_sources delegates to filter_builtin_sources.

Previously, lib/builtins/CMakeLists.txt had a number of calls to
filter_builtin_sources (with a confusing/broken use of the
`excluded_list` parameter), as well as a redundant arch-vs-generic
filtering for the non-Apple code path at the end of the file. Replace
all of this with a single call to filter_builtin_sources.

Remove i686_SOURCES. Previously, this list contained only the
arch-specific files common to 32-bit and 64-bit x86, which is a strange
set. Normally the ${ARCH}_SOURCES list contains everything needed for
the arch. "i686" isn't in ALL_BUILTIN_SUPPORTED_ARCH.

NFCI, but i686_SOURCES won't be defined, and the order of files in
${arch}_SOURCES lists will change.

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

4 years ago[builtins][Android] Define HAS_80_BIT_LONG_DOUBLE to 0
Ryan Prichard [Fri, 19 Jun 2020 07:00:24 +0000 (00:00 -0700)]
[builtins][Android] Define HAS_80_BIT_LONG_DOUBLE to 0

Android 32-bit x86 uses a 64-bit long double.

Android 64-bit x86 uses a 128-bit quad-precision long double.

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

4 years ago[gn build] Port caf395ee8c2
LLVM GN Syncbot [Mon, 13 Jul 2020 23:39:28 +0000 (23:39 +0000)]
[gn build] Port caf395ee8c2

4 years agoFix a missing update that C compiles default to gnu17.
Stephen Hines [Mon, 13 Jul 2020 23:35:54 +0000 (16:35 -0700)]
Fix a missing update that C compiles default to gnu17.

https://reviews.llvm.org/D75383 switched the C default to gnu17, but
missed this instance.

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

4 years agoMemorySanitizer: If a field is marked noundef, check init at call site
Gui Andrade [Tue, 9 Jun 2020 16:54:02 +0000 (16:54 +0000)]
MemorySanitizer: If a field is marked noundef, check init at call site

Adds LLVM option to control eager checking under -msan-eager-checks.
This change depends on the noundef keyword to determining cases where it
it sound to check these shadows, and falls back to passing shadows
values by TLS.

Checking at call boundaries enforces undefined behavior rules with
passing uninitialized arguments by value.

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

4 years ago[llvm][NFC] ML InlineAdvisor: Factored CHECKs in common test
Mircea Trofin [Mon, 13 Jul 2020 23:29:19 +0000 (16:29 -0700)]
[llvm][NFC] ML InlineAdvisor: Factored CHECKs in common test

The CHECKs are going to be shared with the development mode test

4 years agoReapply "[llvm] Native size estimator for training -Oz inliner"
Mircea Trofin [Mon, 13 Jul 2020 21:12:32 +0000 (14:12 -0700)]
Reapply "[llvm] Native size estimator for training -Oz inliner"

This reverts commit 9908a3b9f521c954cbf6adcec35b14b2f6c8da49.

The fix was to exclude the content of TFUtils.h (automatically
included in the LLVM_Analysis module, when LLVM_ENABLE_MODULES is enabled).

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

4 years ago[ORC] Fix typo in parameter name.
Lang Hames [Mon, 13 Jul 2020 23:10:45 +0000 (16:10 -0700)]
[ORC] Fix typo in parameter name.

4 years ago[Sanitizers] Ensure clock_getcpuclockid interceptor <= 80 chars
Gui Andrade [Mon, 13 Jul 2020 23:17:58 +0000 (23:17 +0000)]
[Sanitizers] Ensure clock_getcpuclockid interceptor <= 80 chars

4 years ago[AssumeBundles] Use operand bundles to encode alignment assumptions
Tyker [Mon, 13 Jul 2020 22:52:37 +0000 (00:52 +0200)]
[AssumeBundles] Use operand bundles to encode alignment assumptions

Summary:
NOTE: There is a mailing list discussion on this: http://lists.llvm.org/pipermail/llvm-dev/2019-December/137632.html

Complemantary to the assumption outliner prototype in D71692, this patch
shows how we could simplify the code emitted for an alignemnt
assumption. The generated code is smaller, less fragile, and it makes it
easier to recognize the additional use as a "assumption use".

As mentioned in D71692 and on the mailing list, we could adopt this
scheme, and similar schemes for other patterns, without adopting the
assumption outlining.

Reviewers: hfinkel, xbolva00, lebedev.ri, nikic, rjmccall, spatel, jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: thopre, yamauchi, kuter, fhahn, merge_guards_bot, hiraditya, bollu, rkruppe, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years agoFold the opt size check into the assert to silence an unused variable warning.
Eric Christopher [Mon, 13 Jul 2020 23:03:10 +0000 (16:03 -0700)]
Fold the opt size check into the assert to silence an unused variable warning.

4 years agoLowering of OpenMP Parallel operation to LLVM IR 1/n
Kiran Chandramohan [Mon, 13 Jul 2020 22:13:04 +0000 (23:13 +0100)]
Lowering of OpenMP Parallel operation to LLVM IR 1/n

This patch introduces lowering of the OpenMP parallel operation to LLVM
IR using the OpenMPIRBuilder.

Functions topologicalSort and connectPhiNodes are generalised so that
they work with operations also. connectPhiNodes is also made static.

Lowering works for a parallel region with multiple blocks. Clauses and
arguments of the OpenMP operation are not handled.

Reviewed By: rriddle, anchu-rajendran

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

4 years agoUpdate ubsan_interface.inc for D71491
Vedant Kumar [Mon, 13 Jul 2020 22:40:05 +0000 (15:40 -0700)]
Update ubsan_interface.inc for D71491

This should address the bot failure here:

http://lab.llvm.org:8011/builders/sanitizer-windows/builds/66309/

4 years ago[compiler-rt] Fix compiler warnings and runtime errors in sanitizer RT strxfrm(_l...
Dokyung Song [Mon, 13 Jul 2020 21:56:02 +0000 (21:56 +0000)]
[compiler-rt] Fix compiler warnings and runtime errors in sanitizer RT strxfrm(_l) test cases.

Summary: Fixed an implicit definition warning by including <string.h>. Also fixed run-time assertions that the return value of strxfrm_l calls is less than the buffer size by increasing the size of the referenced buffer.

Reviewers: morehouse

Reviewed By: morehouse

Subscribers: dberris, #sanitizers

Tags: #sanitizers

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

4 years ago[InstCombine] Erase attribute lists for simplified libcalls
Gui Andrade [Tue, 7 Jul 2020 21:21:13 +0000 (21:21 +0000)]
[InstCombine] Erase attribute lists for simplified libcalls

Currently, a transformation like pow(2.0, x) -> exp2(x) copies the pow
attribute list verbatim and applies it to exp2. This works out fine
when the attribute list is empty, but when it isn't clang may error due
due to the mismatch.

The source function and destination don't necessarily have anything
to do with one another, attribute-wise. So it makes sense to remove
the attribute lists (this is similar to what IPO does in this
situation).

This was discovered after implementing the `noundef` param attribute.

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

4 years agoRevert "[InstCombine] Drop debug loc in TryToSinkInstruction (reland)"
Vedant Kumar [Mon, 13 Jul 2020 22:17:03 +0000 (15:17 -0700)]
Revert "[InstCombine] Drop debug loc in TryToSinkInstruction (reland)"

This reverts commit 9649c2095f07a392bc2b2a93b5bd6c4c9bf5ba34. See
discussion on the llvm-commits thread: if it's OK to preserve the
location when sinking a call, it's probably OK to always preserve the
location.

4 years agoCheck output in test/CodeGen/Generic/MIRStripDebug/no-metadata-present.mir, NFC
Vedant Kumar [Mon, 13 Jul 2020 22:15:34 +0000 (15:15 -0700)]
Check output in test/CodeGen/Generic/MIRStripDebug/no-metadata-present.mir, NFC

4 years ago[compiler-rt][MSAN][test] Update buffersize for UTF-8 to C convert
Jinsong Ji [Mon, 13 Jul 2020 21:19:18 +0000 (21:19 +0000)]
[compiler-rt][MSAN][test] Update buffersize for UTF-8 to C convert

This is exposed by https://reviews.llvm.org/D83486.
When the host is UTF8, we may get n >10, causing assert failure.
Increase the buffersize to support UTF-8 to C conversion.

Reviewed By: vitalybuka

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

4 years ago[Sanitizers] Implement getcpuclockid interceptor
Gui Andrade [Mon, 29 Jun 2020 23:56:01 +0000 (23:56 +0000)]
[Sanitizers] Implement getcpuclockid interceptor

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

4 years ago[ubsan] Check implicit casts in ObjC for-in statements
Vedant Kumar [Fri, 13 Dec 2019 20:59:40 +0000 (12:59 -0800)]
[ubsan] Check implicit casts in ObjC for-in statements

Check that the implicit cast from `id` used to construct the element
variable in an ObjC for-in statement is valid.

This check is included as part of a new `objc-cast` sanitizer, outside
of the main 'undefined' group, as (IIUC) the behavior it's checking for
is not technically UB.

The check can be extended to cover other kinds of invalid casts in ObjC.

Partially addresses: rdar://12903059, rdar://9542496

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

4 years ago[analyzer] Inline StringSet that's defined in a header
Benjamin Kramer [Mon, 13 Jul 2020 21:50:00 +0000 (23:50 +0200)]
[analyzer] Inline StringSet that's defined in a header

That's just asking for ODR violations. Also drop a call to lower()
that's not needed.

4 years ago[debugify] Add targeted test for 2fa656c, NFC
Vedant Kumar [Mon, 13 Jul 2020 21:38:31 +0000 (14:38 -0700)]
[debugify] Add targeted test for 2fa656c, NFC

https://reviews.llvm.org/D78411 introduced test changes which relied on
the ability to strip debugify metadata even if module-level metadata is
missing. This introduces a more targeted test for that ability.

4 years ago[MC/AsmParser] layout-interdependency.s depends on having a proper triple
Quentin Colombet [Mon, 13 Jul 2020 21:37:21 +0000 (14:37 -0700)]
[MC/AsmParser] layout-interdependency.s depends on having a proper triple

Fix the requirements for that test.

NFC

4 years ago[mlir] Add alignment attribute to LLVM memory ops and use in vector.transfer
Nicolas Vasilache [Mon, 13 Jul 2020 15:04:09 +0000 (11:04 -0400)]
[mlir] Add alignment attribute to LLVM memory ops and use in vector.transfer

Summary: The native alignment may generally not be used when lowering a vector.transfer to the underlying load/store operation. This revision fixes the unmasked load/store alignment to match that of the masked path.

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

4 years ago[ADT] Specialize std::swap() for SetVector
Nikita Popov [Fri, 19 Jun 2020 18:25:33 +0000 (20:25 +0200)]
[ADT] Specialize std::swap() for SetVector

This is intended to address a compile-time regression from
1eddce4177cfddc86d4696b758904443b0b4f193. A SmallPtrSet was
replaced with a SetVector there, which had an unexpected large
compile-time impact. It turns out that this structure is getting
swapped a lot, and previously this used an optimized std::swap()
specialization for SmallPtrSet. Now it ends up using the default,
triple-move based implementation, which is much more expensive.

This patch (partly) addresses the issue by specializing std::swap()
for SetVector.

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

4 years agoRetry ""[lldb-vscode] Fix TestVSCode_module""
Walter Erquinigo [Mon, 13 Jul 2020 19:10:49 +0000 (12:10 -0700)]
Retry ""[lldb-vscode] Fix TestVSCode_module""

Original commit c60216db15132401ff60c08ccef899321f63b6b6.

The test can only run on Darwin because of how it was setup, so I'm
enforcing that.

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

4 years ago[lldb] Remove unused argument (NFC)
Jonas Devlieghere [Mon, 13 Jul 2020 20:44:01 +0000 (13:44 -0700)]
[lldb] Remove unused argument (NFC)

Nobody is writing to the stream so there's no point in passing it
around.

4 years ago[MLIR] Change ODS collective params build method to provide an empty default value...
Rahul Joshi [Mon, 13 Jul 2020 18:20:27 +0000 (11:20 -0700)]
[MLIR] Change ODS collective params build method to provide an empty default value for named attributes

- Provide default value for `ArrayRef<NamedAttribute> attributes` parameter of
  the collective params build method.
- Change the `genSeparateArgParamBuilder` function to not generate build methods
  that may be ambiguous with the new collective params build method.
- This change should help eliminate passing empty NamedAttribue ArrayRef when the
  collective params build method is used
- Extend op-decl.td unit test to make sure the ambiguous build methods are not
  generated.

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

4 years ago[flang] Extended the flang driver options to include gfortran equivalents to pgf90...
AlexisPerry [Mon, 13 Jul 2020 16:32:12 +0000 (10:32 -0600)]
[flang] Extended the flang driver options to include gfortran equivalents to pgf90 specific options.

Summary: Added gfortran equivalents of pgf90's -Mfixed, -Mfree, -Mextend, -Mstandard, -Munlimited and also added -fdefault-double-8

Reviewers: sscalpone, richard.barton.arm, DavidTruby, clementval, jdoerfert

Reviewed By: sscalpone, richard.barton.arm

Subscribers: sstefan1, llvm-commits, flang-commits

Tags: #llvm, #flang

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

4 years ago[mlir] Support operations with multiple results in slicing
Thomas Raoux [Mon, 13 Jul 2020 20:24:27 +0000 (13:24 -0700)]
[mlir] Support operations with multiple results in slicing

Right now slicing would assert if an operation with multiple results is in the
slice.

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

4 years ago[gn build] Port 9908a3b9f52
LLVM GN Syncbot [Mon, 13 Jul 2020 20:18:59 +0000 (20:18 +0000)]
[gn build] Port 9908a3b9f52

4 years ago[mlir][StandardToSPIRV] Fix conversion for signed remainder
Lei Zhang [Sun, 12 Jul 2020 17:03:23 +0000 (13:03 -0400)]
[mlir][StandardToSPIRV] Fix conversion for signed remainder

Per the Vulkan's SPIR-V environment spec, "for the OpSRem and OpSMod
instructions, if either operand is negative the result is undefined."
So we cannot directly use spv.SRem/spv.SMod if either operand can be
negative. Emulate it via spv.UMod.

Because the emulation uses spv.SNegate, this commit also defines
spv.SNegate.

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

4 years agoRevert "[llvm] Native size estimator for training -Oz inliner"
Davide Italiano [Mon, 13 Jul 2020 19:59:16 +0000 (12:59 -0700)]
Revert "[llvm] Native size estimator for training -Oz inliner"

This reverts commit 83080a294ad7d145d758821bcf4354ad0cb7d299 as
it breaks the macOS modules build.

4 years agoAdd a decorator to skip tests when running under Rosetta
Adrian Prantl [Mon, 13 Jul 2020 20:09:53 +0000 (13:09 -0700)]
Add a decorator to skip tests when running under Rosetta

This allows skipping a test when running the testsuite on macOS under
the Rosetta translation layer.

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

4 years ago[lldb] Fix a CMake warning typo. NFC.
Martin Storsjö [Mon, 13 Jul 2020 19:47:31 +0000 (22:47 +0300)]
[lldb] Fix a CMake warning typo. NFC.

4 years ago[ORC] Remove a spurious reinterpret_cast.
Lang Hames [Mon, 13 Jul 2020 19:37:18 +0000 (12:37 -0700)]
[ORC] Remove a spurious reinterpret_cast.

4 years ago[llvm][NFC] Factored the default inlining advice
Mircea Trofin [Mon, 13 Jul 2020 19:14:21 +0000 (12:14 -0700)]
[llvm][NFC] Factored the default inlining advice

This is in preparation for the 'development' mode advisor. We currently
want to track what the default policy's decision would have been, this
refactoring makes it easier to do that.

4 years ago[flang] Use octal escapes for character literals in modfiles
Tim Keith [Mon, 13 Jul 2020 19:19:17 +0000 (12:19 -0700)]
[flang] Use octal escapes for character literals in modfiles

Character literals can be formatted using octal or hex escapes for
non-ascii characters. This is so that the program can be unparsed for
either pgf90 or gfortran to compile. But modfiles should not be affected
by that -- they should be consistent.

This changes causes modfiles to always have character literals formatted
with octal escapes.

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

4 years ago[PredicateInfo] Place predicate info after assume
Nikita Popov [Sat, 11 Jul 2020 20:48:26 +0000 (22:48 +0200)]
[PredicateInfo] Place predicate info after assume

Place the ssa.copy instructions for assumes after the assume,
instead of before it. Both options are valid, but placing them
afterwards prevents assumes from being replaced with assume(true).
This fixes https://bugs.llvm.org/show_bug.cgi?id=37541 in NewGVN
and will avoid a similar issue in SCCP when we handle more
predicate infos.

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

4 years ago[NewGVN] Separate passing assume tests (NFC)
Nikita Popov [Mon, 13 Jul 2020 19:05:47 +0000 (21:05 +0200)]
[NewGVN] Separate passing assume tests (NFC)

Result might not be exactly the same as under GVN, but all the
desired transforms are made.

4 years ago[NewGVN] Rename xfail tests (NFC)
Nikita Popov [Mon, 13 Jul 2020 18:48:12 +0000 (20:48 +0200)]
[NewGVN] Rename xfail tests (NFC)

Add an -xfail.ll suffix to tests marked XFAIL, so these files can
be split into passing and failing parts.

4 years ago[JITLink] Apply MSVCPError workaround to a1fc26030a42.
Lang Hames [Mon, 13 Jul 2020 18:21:40 +0000 (11:21 -0700)]
[JITLink] Apply MSVCPError workaround to a1fc26030a42.

Hopefully this will get the Windows bots building again.

4 years agoGlobalISel: Define equivalent nodes for saturating add/sub
Matt Arsenault [Sun, 12 Jul 2020 18:03:23 +0000 (14:03 -0400)]
GlobalISel: Define equivalent nodes for saturating add/sub

4 years agoGlobalISel: Implement fewerElementsVector for saturating add/sub
Matt Arsenault [Sun, 12 Jul 2020 20:11:53 +0000 (16:11 -0400)]
GlobalISel: Implement fewerElementsVector for saturating add/sub

4 years agoGlobalISel: Implement widenScalar for saturating add/sub
Matt Arsenault [Sun, 12 Jul 2020 17:58:53 +0000 (13:58 -0400)]
GlobalISel: Implement widenScalar for saturating add/sub

Add a placeholder legality rule for AMDGPU until the rest of the
actions are handled.

4 years agoAMDGPU/GlobalISel: Add baseline add/sub sat legalization tests
Matt Arsenault [Sun, 12 Jul 2020 16:49:04 +0000 (12:49 -0400)]
AMDGPU/GlobalISel: Add baseline add/sub sat legalization tests

4 years ago[clangd] Remove const_cast. NFC
Sam McCall [Mon, 13 Jul 2020 18:44:03 +0000 (20:44 +0200)]
[clangd] Remove const_cast. NFC

4 years ago[NFC] Remove unused header include
Lei Zhang [Mon, 13 Jul 2020 18:40:04 +0000 (14:40 -0400)]
[NFC] Remove unused header include

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

4 years agoFix HexagonGenExtract return status
serge-sans-paille [Thu, 9 Jul 2020 07:56:26 +0000 (09:56 +0200)]
Fix HexagonGenExtract return status

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

4 years ago[NewPM][opt] Translate -foo-analysis to require<foo-analysis>
Arthur Eubanks [Mon, 13 Jul 2020 18:10:56 +0000 (11:10 -0700)]
[NewPM][opt] Translate -foo-analysis to require<foo-analysis>

 Fixes 53 check-llvm tests under NPM.

Reviewed By: asbirlea

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

4 years ago[gn build] Port fdb69539bcd
LLVM GN Syncbot [Mon, 13 Jul 2020 18:10:37 +0000 (18:10 +0000)]
[gn build] Port fdb69539bcd

4 years ago[AST] Fix potential nullptr dereference in Expr::HasSideEffects
Jan Korous [Wed, 8 Jul 2020 22:16:21 +0000 (15:16 -0700)]
[AST] Fix potential nullptr dereference in Expr::HasSideEffects

Array returned by LambdaExpr::capture_inits() can contain nullptrs.

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

4 years agoAMDGPU/GlobalISel: Add tests for 96-bit add/sub/mul
Matt Arsenault [Sun, 12 Jul 2020 21:22:15 +0000 (17:22 -0400)]
AMDGPU/GlobalISel: Add tests for 96-bit add/sub/mul

I almost regressed these, so add tests for them.

4 years ago[llvm][NFC] ML Policies: changed the saved_model protobuf to text
Mircea Trofin [Mon, 13 Jul 2020 17:59:55 +0000 (10:59 -0700)]
[llvm][NFC] ML Policies: changed the saved_model protobuf to text

Also compacted the checkpoints (variables) to one file (plus the index).

This reduces the binary model files to just the variables and their
index. The index is very small. The variables are serialized float
arrays. When updated through training, the changes are very likely
unlocalized, so there's very little value in them being anything else
than binary.

4 years agoTableGen/GlobalISel: Emit enum names for reg class ID instead of value
Matt Arsenault [Mon, 13 Jul 2020 17:14:29 +0000 (13:14 -0400)]
TableGen/GlobalISel: Emit enum names for reg class ID instead of value

This was emitting the raw value for the reg class ID with a comment
for the actual class name. Switch to emitting the qualified enum name
instead, which obviates the need for the comment and also helps keep
the lit tests on the emitter output more stable.

4 years agoRISCV: Avoid GlobalISel build break in a future patch
Matt Arsenault [Mon, 13 Jul 2020 14:39:13 +0000 (10:39 -0400)]
RISCV: Avoid GlobalISel build break in a future patch

The GlobalISelEmitter is stricter about matching timm instruction
outputs to timm inputs (although in an accidental sort of way that
doesn't hit a proper import failure error). Also, apparently no
intrinsic patterns were importing since the ID enum declaration was
missing.

4 years ago[libc++] Implement P0551
Louis Dionne [Mon, 13 Jul 2020 15:53:48 +0000 (11:53 -0400)]
[libc++] Implement P0551

Make sure we satisfy the requirements added by P0551, and add tests to
enforce that.

4 years ago[PGO][PGSO] Add profile guided size optimization to X86ISelDAGToDAG.
Hiroshi Yamauchi [Tue, 7 Jul 2020 18:01:35 +0000 (11:01 -0700)]
[PGO][PGSO] Add profile guided size optimization to X86ISelDAGToDAG.

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

4 years ago[gn build] Port 83080a294ad
LLVM GN Syncbot [Mon, 13 Jul 2020 17:19:05 +0000 (17:19 +0000)]
[gn build] Port 83080a294ad

4 years ago[ORC] Generalize emit re-entry, stub, etc. APIs for working addr != link addr.
Lang Hames [Mon, 13 Jul 2020 04:56:45 +0000 (21:56 -0700)]
[ORC] Generalize emit re-entry, stub, etc. APIs for working addr != link addr.

This patch generalizes the APIs for writing re-entry blocks, trampolines and
stubs to allow their final linked address to differ from the address of
their initial working memory. This will allow these routines to be used with
JITLinkMemoryManagers, which will in turn allow for unification of code paths
for in-process and cross-process lazy JITing.

4 years ago[JITLink] Add a synchronous version of finalize for convenience.
Lang Hames [Mon, 13 Jul 2020 04:49:17 +0000 (21:49 -0700)]
[JITLink] Add a synchronous version of finalize for convenience.

This will be used by upcoming patches that implement indirection utils
(reentry, reentry trampolines, and stubs) on top of
JITLinkMemoryManager to unify in-process and cross-process lazy
compilation support.

4 years ago[llvm] Native size estimator for training -Oz inliner
Mircea Trofin [Mon, 29 Jun 2020 18:37:06 +0000 (11:37 -0700)]
[llvm] Native size estimator for training -Oz inliner

Summary:
This is an experimental ML-based native size estimator, necessary for
computing partial rewards during -Oz inliner policy training. Data
extraction for model training will be provided in a separate patch.

RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-April/140763.html

Reviewers: davidxl, jdoerfert

Subscribers: mgorny, hiraditya, mgrang, arphaman, llvm-commits

Tags: #llvm

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

4 years ago[PGO][PGSO] Add profile guided size optimization to the X86 LEA fixup.
Hiroshi Yamauchi [Tue, 7 Jul 2020 17:19:54 +0000 (10:19 -0700)]
[PGO][PGSO] Add profile guided size optimization to the X86 LEA fixup.

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

4 years ago[DAGCombiner] rot i16 X, 8 --> bswap X
Sanjay Patel [Mon, 13 Jul 2020 15:35:38 +0000 (11:35 -0400)]
[DAGCombiner] rot i16 X, 8 --> bswap X

We have this generic transform in IR (instcombine),
but as shown in PR41098:
http://bugs.llvm.org/PR41098
...the pattern may emerge in codegen too.

x86 has a potential refinement/reversal opportunity here,
but that should come later or needs a target hook to
avoid the transform. Converting to bswap is the more
specific form, so we should use it if it is available.

4 years ago[x86] add tests for bswap/rotate; NFC
Sanjay Patel [Mon, 13 Jul 2020 15:23:45 +0000 (11:23 -0400)]
[x86] add tests for bswap/rotate; NFC

4 years ago[ARM][NFC] More detailed vbsl checks in ARM & Thumb2 tests.
Pavel Iliin [Mon, 13 Jul 2020 11:37:59 +0000 (12:37 +0100)]
[ARM][NFC] More detailed vbsl checks in ARM & Thumb2 tests.

4 years ago[llvm-ar][test][AIX] Unsupport error-opening-directory.test on AIX
stevewan [Mon, 13 Jul 2020 15:58:22 +0000 (11:58 -0400)]
[llvm-ar][test][AIX] Unsupport error-opening-directory.test on AIX

Summary:
The test fails on AIX as it allows open() and read() on a directory. This patch adds `# UNSUPPORTED:
system-aix` to the test to prevent it from running on AIX.

Reviewers: sameerarora101, daltenty, ShuhongL, hubert.reinterpretcast, MaskRay, smeenai, alexshap

Reviewed By: sameerarora101, hubert.reinterpretcast, MaskRay, smeenai

Subscribers: MaskRay, rupprecht, llvm-commits

Tags: #llvm

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

4 years ago[ADT] Make Load(AP)IntFromMemory pointer argument const
Pavel Labath [Mon, 13 Jul 2020 15:15:25 +0000 (17:15 +0200)]
[ADT] Make Load(AP)IntFromMemory pointer argument const

The function does not modify this memory.

4 years agoFix llvm-test-suite failure introduced by D82550/D83122
Sanne Wouda [Mon, 13 Jul 2020 15:09:41 +0000 (16:09 +0100)]
Fix llvm-test-suite failure introduced by D82550/D83122

Apparently, isIndirectCall does not imply that getCalledFunction will be non-null

4 years ago[flang][openmp] libc++ unordered_map build fix in flang openmp static analysis
David Truby [Mon, 13 Jul 2020 15:07:22 +0000 (16:07 +0100)]
[flang][openmp] libc++ unordered_map build fix in flang openmp static analysis

Simply move the include of unordered_map from the .cpp file to the .h file

4 years ago[OPENMP]Fix compiler crash for target data directive without actual target codegen.
Alexey Bataev [Thu, 9 Jul 2020 12:34:06 +0000 (08:34 -0400)]
[OPENMP]Fix compiler crash for target data directive without actual target codegen.

Summary:
Need to privatize addresses of the captured variables when trying to
emit the body of the target data directive in no target codegen mode.

Reviewers: jdoerfert

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

Tags: #clang

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

4 years ago[ms] [llvm-ml] Restore omitted changes requested by reviewer
Eric Astor [Mon, 13 Jul 2020 14:47:30 +0000 (10:47 -0400)]
[ms] [llvm-ml] Restore omitted changes requested by reviewer

4 years ago[lldb/Utility] Rewrite Scalar::SetValueFromCString
Pavel Labath [Wed, 8 Jul 2020 13:43:07 +0000 (15:43 +0200)]
[lldb/Utility] Rewrite Scalar::SetValueFromCString

The function's reliance on host types meant that it was needlessly
complicated, and did not handle the newer (wider) types. Rewrite it in
terms of APInt/APFloat functions to save code and improve functionality.

4 years ago[ms] [llvm-ml] Add support for MASM STRUCT casting field accessors: (<TYPE> PTR ...
Eric Astor [Mon, 13 Jul 2020 14:38:39 +0000 (10:38 -0400)]
[ms] [llvm-ml] Add support for MASM STRUCT casting field accessors: (<TYPE> PTR <value>).<field>

Summary:
Add support for MASM STRUCT casting field accessors: (<TYPE> PTR <value>).<field>

Since these are operands, we add them to X86AsmParser. If/when we extend MASM support to other architectures (e.g., ARM), we will need similar changes there as well.

Reviewed By: thakis

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

4 years ago[compiler-rt][CMake] Pass down LLVM_LIT_ARGS in runtime build
Jinsong Ji [Mon, 13 Jul 2020 02:54:20 +0000 (02:54 +0000)]
[compiler-rt][CMake] Pass down LLVM_LIT_ARGS in runtime build

We should also pass down the LLVM_LIT_ARGS in runtime build mode,
so that the runtime tests can be well controlled as well.

We actually passed this down in clang/runtime/CMakeLists.txt
But not for calls from llvm/runtime/CMakeLists.txt.

Reviewed By: phosek

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

4 years ago[ms] [llvm-ml] Fix MASM support for nested unnamed STRUCTs and UNIONs
Eric Astor [Mon, 13 Jul 2020 14:36:30 +0000 (10:36 -0400)]
[ms] [llvm-ml] Fix MASM support for nested unnamed STRUCTs and UNIONs

Summary: Fix MASM support for nested unnamed STRUCTs and UNIONs

Reviewed By: thakis

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

4 years ago[ms] [llvm-ml] Improve MASM STRUCT field accessor support
Eric Astor [Mon, 13 Jul 2020 14:33:15 +0000 (10:33 -0400)]
[ms] [llvm-ml] Improve MASM STRUCT field accessor support

Summary:
Adds support for several accessors:
- `[<identifier>.<struct name>].<field>`
- `[<identifier>.<struct name>.<field>].<subfield>` (where `field` has already-defined STRUCT type)
- `[<variable>.<field>].<subfield>` (where `field` has already-defined STRUCT type)

Reviewed By: thakis

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

4 years ago[lldb/dotest] Remove the "xunit" result formatter
Pavel Labath [Fri, 10 Jul 2020 11:18:00 +0000 (13:18 +0200)]
[lldb/dotest] Remove the "xunit" result formatter

Summary:
My understanding is that this was added to make dotest interact well
with the GreenDragon bots, back when dotest was the main test driver.
Now that everything goes through lit (which has its own xunit
formatter), it seems largely irrelevant.

There are more cleanups that can be done after removing this be done
here, but this should be enough to test the waters.

Reviewers: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[NFC] rename to reflect F is not necessarily an Intrinsic
Sanne Wouda [Fri, 3 Jul 2020 11:37:21 +0000 (12:37 +0100)]
[NFC] rename to reflect F is not necessarily an Intrinsic

4 years ago[SLPVectorizer] handle vectorizeable library functions
Sanne Wouda [Fri, 10 Jul 2020 11:37:26 +0000 (12:37 +0100)]
[SLPVectorizer] handle vectorizeable library functions

Teaches the SLPVectorizer to use vectorized library functions for
non-intrinsic calls.

This already worked for intrinsics that have vectorized library
functions, thanks to D75878, but schedules with library functions with a
vector variant were being rejected early.

-   assume that there are no load/store dependencies between lib
    functions with a vector variant; this would otherwise prevent the
    bundle from becoming "ready"

-   check during legalization that the vector variant can be used

-   fix-up where we previously assumed that a call would be an intrinsic

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

4 years agoPre-commit tests
Sanne Wouda [Thu, 25 Jun 2020 15:02:52 +0000 (16:02 +0100)]
Pre-commit tests

Prepare to land D82550

4 years agoFix crash when getVFABIMappings is called with an indirect call instruction
Sanne Wouda [Thu, 25 Jun 2020 15:08:13 +0000 (16:08 +0100)]
Fix crash when getVFABIMappings is called with an indirect call instruction

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

4 years ago[yaml2obj] - Refactor header-sh-fields.yaml test.
Georgii Rymar [Thu, 9 Jul 2020 13:03:40 +0000 (16:03 +0300)]
[yaml2obj] - Refactor header-sh-fields.yaml test.

This refines the test to use macros. It is needed for
a follow-up change that adds a functionality to
override more fields.

Also, it is just cleaner to test each key separately.

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

4 years ago[lldb][NFC] Refactor instruction dumping out of DumpDataExtractor
Raphael Isemann [Mon, 13 Jul 2020 11:36:25 +0000 (13:36 +0200)]
[lldb][NFC] Refactor instruction dumping out of DumpDataExtractor

4 years ago[clangd] Fix DocumentSymbol ranges
Kirill Bobyrev [Mon, 13 Jul 2020 13:02:47 +0000 (15:02 +0200)]
[clangd] Fix DocumentSymbol ranges

Summary:
DocumentSymbol ranges were not previously tested and, as a result, had invalid
end location. This patch addresses the issue.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[DAGCombiner] allow load/store merging if pairs can be rotated into place
Sanjay Patel [Mon, 13 Jul 2020 12:57:00 +0000 (08:57 -0400)]
[DAGCombiner] allow load/store merging if pairs can be rotated into place

This carves out an exception for a pair of consecutive loads that are
reversed from the consecutive order of a pair of stores. All of the
existing profitability/legality checks for the memops remain between
the 2 altered hunks of code.

This should give us the same x86 base-case asm that gcc gets in
PR41098 and PR44895:
http://bugs.llvm.org/PR41098
http://bugs.llvm.org/PR44895

I think we are missing a potential subsequent conversion to use "movbe"
if the target supports that. That might be similar to what AArch64
would use to get "rev16".

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

4 years agoRevert "[DAGCombiner] allow load/store merging if pairs can be rotated into place"
Sanjay Patel [Mon, 13 Jul 2020 12:55:29 +0000 (08:55 -0400)]
Revert "[DAGCombiner] allow load/store merging if pairs can be rotated into place"

This reverts commit 591a3af5c7acc05617c0eacf6ae4f76bd8a9a6ce.
The commit message was cut off and failed to include the review citation.

4 years ago[DAGCombiner] allow load/store merging if pairs can be rotated into place
Sanjay Patel [Mon, 13 Jul 2020 12:51:09 +0000 (08:51 -0400)]
[DAGCombiner] allow load/store merging if pairs can be rotated into place

This carves out an exception for a pair of consecutive loads that are
reversed from the consecutive order of a pair of stores. All of the
existing profitability/legality checks for the memops remain between
the 2 altered hunks of code.

This should give us the same x86 base-case asm that gcc gets in
PR41098 and PR44895:i
http://bugs.llvm.org/PR41098
http://bugs.llvm.org/PR44895

I think we are missing a potential subsequent conversion to use "movbe"
if the target supports that. That might be similar to what AArch64
would use to get "rev16".

Differential Revision:

4 years ago[ARM][MVE] Refactor option -disable-mve-tail-predication
Sjoerd Meijer [Mon, 13 Jul 2020 10:53:09 +0000 (11:53 +0100)]
[ARM][MVE] Refactor option -disable-mve-tail-predication

This refactors option -disable-mve-tail-predication to take different arguments
so that we have 1 option to control tail-predication rather than several
different ones.

This is also a prep step for D82953, in which we want to reject reductions
unless that is requested with this option.

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

4 years ago[analyzer] ctu-on-demand-parsing tests: replace linux -> system-linux
Balazs Benics [Mon, 13 Jul 2020 12:29:47 +0000 (14:29 +0200)]
[analyzer] ctu-on-demand-parsing tests: replace linux -> system-linux

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

4 years ago[LLD][ELF] - Fix the test after llvm-readelf output change.
Georgii Rymar [Mon, 13 Jul 2020 12:14:06 +0000 (15:14 +0300)]
[LLD][ELF] - Fix the test after llvm-readelf output change.

An issue for llvm-readelf was fixed in
https://reviews.llvm.org/rG84a170178c4431b7536c83ff0e5ce80774d08df6

Now it produce no output for this test.

4 years ago[COFF] Error on unexpected .pdata size
Hans Wennborg [Thu, 9 Jul 2020 12:54:53 +0000 (14:54 +0200)]
[COFF] Error on unexpected .pdata size

Previously, lld would crash if the .pdata size was not an even multiple
of the expected .pdata entry size. This makes it error gracefully instead.

(We hit this in Chromium due to an assembler problem: https://crbug.com/1101577)

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

4 years ago[AMDGPU][GlobalISel] Fix subregister index for EXEC register in selectBallot.
Mirko Brkusanin [Mon, 13 Jul 2020 11:35:34 +0000 (13:35 +0200)]
[AMDGPU][GlobalISel] Fix subregister index for EXEC register in selectBallot.

Temporarily remove subregister for EXEC in selectBallot added in
https://reviews.llvm.org/D83214 to fix failures on expensive checks buildbot.