platform/upstream/llvm.git
4 years ago[NFCI][InstCombine] Move store merging from `visitStoreInst()` into `visitUncondition...
Roman Lebedev [Tue, 14 Jul 2020 07:41:51 +0000 (10:41 +0300)]
[NFCI][InstCombine] Move store merging from `visitStoreInst()` into `visitUnconditionalBranchInst()`

Summary:
As @nikic is pointing out in https://bugs.llvm.org/show_bug.cgi?id=46680#c5,
InstCombine should not have forward instruction scans,
so let's move this transform into the proper place.

This is pretty much NFCI.

Reviewers: nikic, spatel

Reviewed By: nikic

Subscribers: hiraditya, llvm-commits, nikic

Tags: #llvm

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

4 years ago[SVE][CodeGen] Add README for SVE-related warnings in tests
David Sherwood [Thu, 9 Jul 2020 09:16:32 +0000 (10:16 +0100)]
[SVE][CodeGen] Add README for SVE-related warnings in tests

I have added a new file:

  llvm/test/CodeGen/AArch64/README

that describes what to do in the event one of the SVE codegen tests
fails the warnings check. In addition, I've added comments to all
the relevant SVE tests pointing users at the README file.

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

4 years ago[clangd] Implement textDocument/foldingRange
Kirill Bobyrev [Tue, 14 Jul 2020 07:28:38 +0000 (09:28 +0200)]
[clangd] Implement textDocument/foldingRange

Summary:
This patch introduces basic textDocument/foldingRange support. It relies on
textDocument/documentSymbols to collect all symbols and uses takes ranges
to create folds.

The next steps for textDocument/foldingRange support would be:

* Implementing FoldingRangeClientCapabilities and respecting respect client
  preferences
* Specifying folding range kind
* Migrating from DocumentSymbol implementation to custom RecursiveASTVisitor flow that will allow more flexibility
* Supporting more folding range types: comments, PP conditional regions, includes and other code regions (e.g. public/private/protected sections of classes, control flow statement bodies)

Tested: (Neo)Vim (coc-clangd) and VSCode.

Related issue: https://github.com/clangd/clangd/issues/310

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

4 years ago[SVE] Fix implicit TypeSize->uint64_t conversion getCastInstrCost
David Sherwood [Wed, 8 Jul 2020 07:47:06 +0000 (08:47 +0100)]
[SVE] Fix implicit TypeSize->uint64_t conversion getCastInstrCost

In getCastInstrCost() when comparing different sizes for src and
dst types we should be using the TypeSize comparison operators
instead of relying upon TypeSize being converted a uin64_t.
Previously this meant we were dropping the scalable property and
treating fixed and scalable vector types the same.

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

4 years ago[SVE][CodeGen] Fix implicit TypeSize->uint64_t conversion in TransformFPLoadStorePair
David Sherwood [Fri, 10 Jul 2020 16:22:10 +0000 (17:22 +0100)]
[SVE][CodeGen] Fix implicit TypeSize->uint64_t conversion in TransformFPLoadStorePair

In DAGCombiner::TransformFPLoadStorePair we were dropping the scalable
property of TypeSize when trying to create an integer type of equivalent
size. In fact, this optimisation makes no sense for scalable types
since we don't know the size at compile time. I have changed the code
to bail out when encountering scalable type sizes.

I've added a test to

  llvm/test/CodeGen/AArch64/sve-fp.ll

that exercises this code path. The test already emits an error if it
encounters warnings due to implicit TypeSize->uint64_t conversions.

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

4 years ago[AMDGPU][NFC] Tidy sgpr-control-flow.ll whitespace
Carl Ritson [Tue, 14 Jul 2020 06:31:10 +0000 (15:31 +0900)]
[AMDGPU][NFC] Tidy sgpr-control-flow.ll whitespace

Pre-commit clean up for D83641.

4 years ago[deadargelim] Attach dbg info to the insert/extractvalue instructions
Djordje Todorovic [Tue, 14 Jul 2020 06:49:01 +0000 (08:49 +0200)]
[deadargelim] Attach dbg info to the insert/extractvalue instructions

Attach DbgLoc on insertvalue/extractvalue instructions created by
DeadArgumentElimination.

This fixes the PR46350.

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

4 years ago[AMDGPU] Propagate dead flag during pre-RA exec mask optimizations
Carl Ritson [Tue, 14 Jul 2020 03:22:46 +0000 (12:22 +0900)]
[AMDGPU] Propagate dead flag during pre-RA exec mask optimizations

Preserve SCC dead flags in SIOptimizeExecMaskingPreRA.
This helps with removing redundant s_andn2 instructions later.

Reviewed By: rampitec

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

4 years ago[PowerPC][Power10] Implement Test LSB by Byte Builtins in LLVM/Clang
Amy Kwan [Mon, 13 Jul 2020 22:37:02 +0000 (17:37 -0500)]
[PowerPC][Power10] Implement Test LSB by Byte Builtins in LLVM/Clang

This patch implements builtins for the Test LSB by Byte instruction introduced
in Power10.

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

4 years ago[AArch64][GlobalISel] Add post-legalize combine for sext_inreg(trunc(sextload)) ...
Amara Emerson [Wed, 17 Jun 2020 18:55:53 +0000 (11:55 -0700)]
[AArch64][GlobalISel] Add post-legalize combine for sext_inreg(trunc(sextload)) -> copy

On AArch64 we generate redundant G_SEXTs or G_SEXT_INREGs because of this.

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

4 years ago[DWARFYAML] Replace Is64bit with Is64BitAddrSize. NFC.
Xing GUO [Tue, 14 Jul 2020 02:55:34 +0000 (10:55 +0800)]
[DWARFYAML] Replace Is64bit with Is64BitAddrSize. NFC.

Is64bit is ambiguous. In this patch, we replace it with Is64BitAddrSize
to make it clearer.

4 years ago[PowerPC] Generate CFI directives when probing in prologue
Kai Luo [Mon, 13 Jul 2020 04:55:28 +0000 (04:55 +0000)]
[PowerPC] Generate CFI directives when probing in prologue

Add missing CFI directives when probing in prologue if
`stack-clash-protection` is enabled.

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

4 years agoRevert "[flang][openacc] OpenACC 3.0 parser"
Valentin Clement [Tue, 14 Jul 2020 02:35:19 +0000 (22:35 -0400)]
Revert "[flang][openacc] OpenACC 3.0 parser"

This reverts commit 65049d16100af360674659fb56e8f9bec96a0836.

Buildbot failure clang-ppc64le-rhel

4 years agoAdd LINK_COMPONENTS Support
Valentin Clement [Tue, 14 Jul 2020 02:22:47 +0000 (22:22 -0400)]
Add LINK_COMPONENTS Support

4 years ago[GVN] teach ConstantFolding correct handling of non-integral addrspace casts
Jameson Nash [Wed, 6 Nov 2019 17:01:57 +0000 (12:01 -0500)]
[GVN] teach ConstantFolding correct handling of non-integral addrspace casts

Here we teach the ConstantFolding analysis pass that it is not legal to
replace a load of a bitcast constant (having a non-integral addrspace)
with a bitcast of the value of that constant (with a different
non-integral addrspace).

But also teach it that certain bit patterns are always known and
convertable (a fact it already uses elsewhere). This required us to also
fix a globalopt test, since, after this change, LLVM is able to realize
that the test actually is a valid transform (NULL is always a known
bit-pattern) and so it doesn't need to emit the failure remarks for it.

Also simplify some of the negative tests for transforms by avoiding a
type change in their bitcast, and add positive versions of the same
tests, to show that they otherwise should work.

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

4 years ago[VNCoercion] avoid creating bitcast for zero offsets [NFCI]
Jameson Nash [Wed, 6 Nov 2019 17:00:36 +0000 (12:00 -0500)]
[VNCoercion] avoid creating bitcast for zero offsets [NFCI]

This could previously make it more complicated for ConstantFolding
later, leading to a higher likelyhood it would have to reject the
expression, even though zero seems like probably the common case here.

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

4 years ago[GVN] add early exit to ConstantFoldLoadThroughBitcast [NFC]
Jameson Nash [Wed, 6 Nov 2019 16:47:40 +0000 (11:47 -0500)]
[GVN] add early exit to ConstantFoldLoadThroughBitcast [NFC]

And adds some additional test coverage to ensure later commits don't
introduce regressions.

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

4 years agoFix undefined behavior in DWARF emission
zuojian lin [Tue, 14 Jul 2020 01:28:00 +0000 (18:28 -0700)]
Fix undefined behavior in DWARF emission

Caused by uninitialized load of llvm::DwarfDebug::PrevCU:
llvm::DwarfCompileUnit::addRange () at ../lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:276
llvm::DwarfDebug::endFunctionImpl () at ../lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1586
llvm::DebugHandlerBase::endFunction () at ../lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp:319
llvm::AsmPrinter::EmitFunctionBody () at ../lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1230
llvm::ARMAsmPrinter::runOnMachineFunction () at ../lib/Target/ARM/ARMAsmPrinter.cpp:161

Most of the DebugInfo tests under `LLVM_LIT_ARGS:STRING=-sv --vg` prior to this fix, and pass with the fix applied.

Reviewed By: aprantl, dblaikie

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

4 years ago[lldb-vscode] Fix TestVSCode_setBreakpoints
Walter Erquinigo [Tue, 14 Jul 2020 01:26:41 +0000 (18:26 -0700)]
[lldb-vscode] Fix TestVSCode_setBreakpoints

It was failing because some module events had empty UUID, and that was not handled correctly.
The diff that added that logic is https://reviews.llvm.org/D82477

4 years ago[flang][openacc] Add Support library for error handling
clementval [Tue, 14 Jul 2020 01:06:22 +0000 (21:06 -0400)]
[flang][openacc] Add Support library for error handling

4 years ago[lldb-vscode] Fix TestVSCode_module
Walter Erquinigo [Tue, 14 Jul 2020 00:55:24 +0000 (17:55 -0700)]
[lldb-vscode] Fix TestVSCode_module
This test was added in https://reviews.llvm.org/D82477 and needs to wait a little bit before fetching some information.

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