platform/upstream/llvm.git
4 years ago[Analyzer][StreamChecker] Changed representation of stream error state - NFC.
Balázs Kéri [Mon, 18 May 2020 13:07:32 +0000 (15:07 +0200)]
[Analyzer][StreamChecker] Changed representation of stream error state - NFC.

Summary:
State of error flags for a stream is handled by having separate flags
that allow combination of multiple error states to be described with one
error state object.
After a failed function the error state is set in the stream state
and must not be determined later based on the last failed function
like before this change. The error state can not always be determined
from the last failed function and it was not the best design.

Reviewers: Szelethus

Reviewed By: Szelethus

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gamesh411, Charusso, martong, ASDenysPetrov, cfe-commits

Tags: #clang

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

4 years ago[pstl] A fix for move placement-new (and destroy) allocated objects from raw memory.
Dvorskiy, Mikhail [Tue, 10 Mar 2020 16:09:57 +0000 (19:09 +0300)]
[pstl] A fix for move placement-new (and destroy) allocated objects from raw memory.

https://reviews.llvm.org/D74123

The fix affects follow algorithms:
remove_if, unique, rotate, inplace_merge, partial_sort_copy, set_union, set_intersection, set_difference, set_symmetric_difference.

For "is_trivial" types there are no problems with "creating objects/clean-up"
For non-trivial types the algo results are also correct, but possible incorrect copying/moving "operator=" calls "by raw memory" within one of mentioned algo or incorrect destructor calls in the end of algo.

4 years ago[mlir] Add BoolArrayAttr in Tablegen + Builder support
Nicolas Vasilache [Mon, 18 May 2020 13:41:59 +0000 (09:41 -0400)]
[mlir] Add BoolArrayAttr in Tablegen + Builder support

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

4 years ago[mlir] NFC - Fix OperationSupport.cpp::findNamedAttr
Nicolas Vasilache [Mon, 18 May 2020 13:33:35 +0000 (09:33 -0400)]
[mlir] NFC - Fix OperationSupport.cpp::findNamedAttr

Summary:
When NamedAttrList::get is called against a StringRef and the
entry is not present, the Identifier::operator== crashes.
Interestingly there seems to be no use of the NamedAttrList::get(StringRef) in
the codebase so far. A subsequent commit will introduce such a use.

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

4 years ago[openmp] Fixed hang if detached task was serialized.
AndreyChurbanov [Mon, 18 May 2020 12:32:13 +0000 (15:32 +0300)]
[openmp] Fixed hang if detached task was serialized.

The patch fixes https://bugs.llvm.org/show_bug.cgi?id=45904.

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

4 years agoReorder Type fields to make various isa< > check more concise
serge-sans-paille [Tue, 12 May 2020 16:46:32 +0000 (18:46 +0200)]
Reorder Type fields to make various isa< > check more concise

Depending on the order of fields, some isa < > checks can be faster because of
tests that check a range of type, leading to assembly simplification.

To find a relevant ordering, I... brute-forced the permutation among the derived
types and pick the combination that resulted in the smallest libLLVM-11.so.

On my laptop (x86_64), this reduces the size of libLLVM-11.so from 127344064 bytes to 127335336,
that's 8728 bytes shaved without much effort.

Also removed obsolete comments in the process.

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

4 years ago[libcxx][type_traits] Add C++20 changes to common_type
Michael Schellenberger Costa [Mon, 18 May 2020 12:01:55 +0000 (14:01 +0200)]
[libcxx][type_traits] Add C++20 changes to common_type

Summary: This already implements the expected changes for LWG-3205

Reviewers: mclow.lists, EricWF, CaseyCarter, cjdb, #libc, ldionne

Reviewed By: #libc, ldionne

Subscribers: dexonsmith, broadwaylamb, christof, ldionne, libcxx-commits

Tags: #libc

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

4 years ago[libcxx testing] Remove ALLOW_RETRIES from lock_guard tests
David Zarzycki [Mon, 18 May 2020 11:39:12 +0000 (07:39 -0400)]
[libcxx testing] Remove ALLOW_RETRIES from lock_guard tests

These two tests were clumsily using time measurements to determine
whether std::lock_guard was working correctly. In practice, this
approach merely verified that the underlying lock properly waits.

Now these two tests verify that lock is acquired, not dropped
prematurely, and finally, actually dropped at the end of the scope.

4 years agoTurn -Wmax-tokens off by default
Hans Wennborg [Fri, 15 May 2020 15:20:27 +0000 (17:20 +0200)]
Turn -Wmax-tokens off by default

On the one hand, one might interpret the use of the max-token pragmas or
-fmax-tokens flag as an opt-in to the warning. However, in Chromium
we've found it useful to only opt in selected build configurations, even
though we have the pragmas in the code. For that reason, we think it
makes sense to turn it off by default.

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

4 years ago[InstCombine][NFC] Simplify check in sinking
Max Kazantsev [Mon, 18 May 2020 11:09:24 +0000 (18:09 +0700)]
[InstCombine][NFC] Simplify check in sinking

We just need to check that the only predecessor of user parent is
BB, we don't need to iterate through BB's successors for it.

4 years ago[OpenCL] Added addrspace_cast operator in C++ mode.
Anastasia Stulova [Mon, 18 May 2020 10:02:01 +0000 (11:02 +0100)]
[OpenCL] Added addrspace_cast operator in C++ mode.

This operator is intended for casting between
pointers to objects in different address spaces
and follows similar logic as const_cast in C++.

Tags: #clang

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

4 years ago[AMDGPU][MC] Corrected branch relocation handling to detect undefined labels
Dmitry Preobrazhensky [Mon, 18 May 2020 11:04:58 +0000 (14:04 +0300)]
[AMDGPU][MC] Corrected branch relocation handling to detect undefined labels

Fixed ELF object writer to die gracefully when an undefined label is encountered in a branch instruction.
See https://bugs.llvm.org/show_bug.cgi?id=41914.

Reviewers: arsenm, rampitec

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

4 years ago[clang-tidy] NFC: Cleanup Python scripts
Kirill Bobyrev [Mon, 18 May 2020 10:20:11 +0000 (12:20 +0200)]
[clang-tidy] NFC: Cleanup Python scripts

Summary: Silence few PEP8 warnings.

Reviewers: hokein

Reviewed By: hokein

Subscribers: Eugene.Zelenko, xazax.hun, cfe-commits

Tags: #clang

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

4 years ago[Test] Opportunity for sinking to unreachable in InstCombine
Max Kazantsev [Mon, 18 May 2020 09:25:16 +0000 (16:25 +0700)]
[Test] Opportunity for sinking to unreachable in InstCombine

4 years agoRevert 76c5f277f2 "Re-land [Debug][CodeView] Emit fully qualified names for globals"
Hans Wennborg [Mon, 18 May 2020 09:20:42 +0000 (11:20 +0200)]
Revert 76c5f277f2 "Re-land [Debug][CodeView] Emit fully qualified names for globals"

> Before this patch, S_[L|G][THREAD32|DATA32] records were emitted with a simple name, not the fully qualified name (namespace + class scope).
>
> Differential Revision: https://reviews.llvm.org/D79447

This causes asserts in Chromium builds:

CodeViewDebug.cpp:2997: void llvm::CodeViewDebug::emitDebugInfoForUDTs(const std::vector<std::pair<std::string, const DIType *>> &):
Assertion `OriginalSize == UDTs.size()' failed.

I will follow up on the Phabricator issue.

4 years ago[NFC][clang-tidy] use hasOperands in place of hasEitherOperand
Nathan James [Mon, 18 May 2020 09:11:22 +0000 (10:11 +0100)]
[NFC][clang-tidy] use hasOperands in place of hasEitherOperand

4 years ago[DebugInfo][DWARF] Emit a single location instead of a location list
OCHyams [Mon, 18 May 2020 08:25:29 +0000 (09:25 +0100)]
[DebugInfo][DWARF] Emit a single location instead of a location list

for variables in nested scopes (including inlined functions) if there is a
single location which covers the entire scope and the scope is contained in a
single block.

Based on work by @jmorse.

Reviewed By: vsk, aprantl

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

4 years ago[compiler-rt] Don't error out on missing builtins when builting builtins themselves
Martin Storsjö [Mon, 18 May 2020 08:04:42 +0000 (11:04 +0300)]
[compiler-rt] Don't error out on missing builtins when builting builtins themselves

This fixes bootstrapping the builtins when no previous version of
them exists after 2fe66bdb2e5fb556e15d4a07158e89ec007c587b.

Also fix a whitespace issue in that commit.

4 years ago[TargetLibraryInfo] memcpy and memset have optimized codegen.
Clement Courbet [Mon, 27 Apr 2020 08:45:41 +0000 (10:45 +0200)]
[TargetLibraryInfo] memcpy and memset have optimized codegen.

Summary:
Add memcpy and memset to the list of function with optimized codegen.
hasOptimizedCodeGen() was returning false for them.
This was not an issue when working with c++ as clang typically emits an
intrinsic rather than a libfunc call, but when working with IR,
this would cause some issues with sanitizers which would not correctly
mark the function as nobuiltin in `maybeMarkSanitizerLibraryCallNoBuiltin()`.

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[RISCV] Fix passing two floating-point values in complex separately by two GPRs on...
Jim Lin [Mon, 18 May 2020 03:10:46 +0000 (11:10 +0800)]
[RISCV] Fix passing two floating-point values in complex separately by two GPRs on RV64

Summary:
This patch fixed the error of counting the remaining FPRs. Complex floating-point
values should be passed by two FPRs for the hard-float ABI. If no two FPRs are
available, it should be passed via a 64-bit GPR (fp+fp). `ArgFPRsLeft` is only
decreased one while the type is complex floating-point. It causes two floating-point
values in the complex are passed separately by two GPRs.

Reviewers: asb, luismarques, lenary

Reviewed By: asb

Subscribers: rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, s.egerton, pzheng, sameer.abuasal, apazos, evandro, cfe-commits

Tags: #clang

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

4 years ago[llvm-objcopy][MachO] Fix code formatting
Alexander Shaposhnikov [Mon, 18 May 2020 03:46:17 +0000 (20:46 -0700)]
[llvm-objcopy][MachO] Fix code formatting

Apply clang-format to MachOObjcopy.cpp. NFC.

Test plan: make check-all

4 years ago[PowerPC] add more high latency opcodes for machinecombiner - NFC
Chen Zheng [Mon, 18 May 2020 01:00:09 +0000 (21:00 -0400)]
[PowerPC] add more high latency opcodes for machinecombiner - NFC

4 years ago[MLIR][cmake] Fix unittest/Tablegen by special casing LLVMMLIRTableGen
Stephen Neuendorffer [Sun, 17 May 2020 22:17:04 +0000 (15:17 -0700)]
[MLIR][cmake] Fix unittest/Tablegen by special casing LLVMMLIRTableGen

unittest/Tablegen generates an executable that depends on MLIRIR and
LLVMMLIRTableGen.  Avoid specifying linkage dependence on LLVM
libraries here because then everyone has to depend on those libraries.

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

4 years agoFix warning "defined but not used" for debug function (NFC)
Mehdi Amini [Sun, 17 May 2020 23:16:21 +0000 (23:16 +0000)]
Fix warning "defined but not used" for debug function (NFC)

4 years agoReplace dyn_cast with isa when the result isn't used (NFC)
Mehdi Amini [Sun, 17 May 2020 19:25:35 +0000 (19:25 +0000)]
Replace dyn_cast with isa when the result isn't used (NFC)

Fix build warning: unused variable 'BB'

4 years agoRemove spurious semicolon after function definition (NFC)
Mehdi Amini [Sun, 17 May 2020 19:24:33 +0000 (19:24 +0000)]
Remove spurious semicolon after function definition (NFC)

This fixes some GCC pedantic warnings.

4 years agoValueMapper does not preserve inline assembly dialect when remapping the type
Craig Topper [Sun, 17 May 2020 21:57:04 +0000 (14:57 -0700)]
ValueMapper does not preserve inline assembly dialect when remapping the type

Bug report: https://bugs.llvm.org/show_bug.cgi?id=45291

Patch by Tomasz Miąsko

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

4 years ago[MLIR] Fix linkage for libMLIR.so
Stephen Neuendorffer [Sun, 17 May 2020 06:01:52 +0000 (23:01 -0700)]
[MLIR] Fix linkage for libMLIR.so

Generally:
1) don't use target_link_libraries() and add_mlir_library() on the same target, use LINK_LIBS PUBLIC instead.
2) don't use LINK_LIBS to specify LLVM libraries.  Use LINK_COMPONENTS instead
3) no need to link against LLVMSupport.  We pull it in by default.

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

4 years ago[MLIR][cmake][NFC] Update linkage checker for mlir-opt
Stephen Neuendorffer [Sun, 17 May 2020 05:46:57 +0000 (22:46 -0700)]
[MLIR][cmake][NFC] Update linkage checker for mlir-opt

New CMakeLists.txt for MLIRStandardOpsTransforms was incorrect, but wasn't
caught by the check.

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

4 years ago[Alignment] Remove unnecessary getValueOrABITypeAlignment calls (NFC)
Nikita Popov [Sun, 17 May 2020 20:14:42 +0000 (22:14 +0200)]
[Alignment] Remove unnecessary getValueOrABITypeAlignment calls (NFC)

Now that load/store alignment is required, we no longer need most
of them. Also switch the getLoadStoreAlignment() helper to return
Align instead of MaybeAlign.

4 years ago[InstCombine] visitMaskedMerge(): when unfolding, sanitize undef constants (PR45955)
Roman Lebedev [Sun, 17 May 2020 18:58:55 +0000 (21:58 +0300)]
[InstCombine] visitMaskedMerge(): when unfolding, sanitize undef constants (PR45955)

We can't leave undef vector element constants as-is,
it is a miscompile, so we need to sanitize them.

We have two vectors (C and ~C):
* We can't replace undef with 0 in both of them
* We can't replace undef with 0 in only one of them
* We could replace undef with -1 in both of them
* We could replace undef with -1 in only one(!) of them
* We could replace undef with -1 in one and 0 in another one of them.

Therefore, it seems best to go with the last option, since otherwise
we'd loose knowledge that C and ~C have no common bits set,
which seems more important than preserving partial undef knowledge.

Fixes https://bugs.llvm.org/show_bug.cgi?id=45955

4 years agoDebugInfo: Reduce long-distance dependence on what will/won't emit a debug_addr section
David Blaikie [Sun, 17 May 2020 19:17:31 +0000 (12:17 -0700)]
DebugInfo: Reduce long-distance dependence on what will/won't emit a debug_addr section

This is a no-op/NFC at the moment & generally makes the code /somewhat/
cleaner/less reliant on assumptions about what will produce a debug_addr
section.

It's still a bit "spooky action at a distance" - the add ranges code
pre-emptively inserts addresses into the address pool it knows will
eventually be used by the range emission code (or low/high pc).

The 'ideal' would be either to actually compute the addresses needed for
range (& loc) emission earlier - which would mean decanonicalizing the
range/loc representation earlier to account for whether it was going to
use addrx encodings or not (which would be unfortunate, but could be
refactored to be relatively unobtrusive).

Alternatively, emitting the range/loc sections earlier would cause them
to request the needed addresses sooner - but then you endup having to
split finalizeModuleInfo because some things need to be handled there
before the ranges/locs are emitted, I think...

4 years ago[LVI] Don't use dominator tree in isValidAssumeForContext()
Nikita Popov [Wed, 25 Mar 2020 19:51:01 +0000 (20:51 +0100)]
[LVI] Don't use dominator tree in isValidAssumeForContext()

LVI and its consumers currently have quite a bit of complexity
related to dominator tree management. However, it doesn't look
like it is actually needed...

The only use of the dominator tree is inside isValidAssumeForContext().
However, due to the way LVI queries work, it is not needed:
If we query a value for some block, we will first get the edge values
from all predecessor blocks, which also includes an intersection with
assumptions that apply to the terminator of the predecessor. As such,
we will already have processed all assumptions from predecessor blocks
(this is actually stronger than what isValidAssumeForContext() does
with a DT, because this is capable of combining non-dominating
assumptions). The only additional assumptions we need to take into
account are those in the block being queried. And we don't need a
dominator tree for that.

This patch only removes the use of DT, I will drop the machinery
around it in a followup.

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

4 years agoAdd missing include Host.h in llvm-mc-* fuzzers. NFC.
Fedor Sergeev [Sun, 17 May 2020 19:17:56 +0000 (02:17 +0700)]
Add missing include Host.h in llvm-mc-* fuzzers. NFC.

Fixes build failure in these fuzzers.

4 years ago[ASTMatchers] Added BinaryOperator hasOperands matcher
Nathan James [Sat, 16 May 2020 01:00:33 +0000 (02:00 +0100)]
[ASTMatchers] Added BinaryOperator hasOperands matcher

Summary: Adds a matcher called `hasOperands` for `BinaryOperator`'s when you need to match both sides but the order isn't important, usually on commutative operators.

Reviewers: klimek, aaron.ballman, gribozavr2, alexfh

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years agotest commit
JinGu Kang [Sun, 17 May 2020 18:49:37 +0000 (19:49 +0100)]
test commit

4 years agoRevert rGca18ce1a00cd8b7cb7ce0e130440f5ae1ffe86ee "GlobPattern.h - remove unnecessary...
Simon Pilgrim [Sun, 17 May 2020 17:51:21 +0000 (18:51 +0100)]
Revert rGca18ce1a00cd8b7cb7ce0e130440f5ae1ffe86ee "GlobPattern.h - remove unnecessary BitVector.h/StringRef.h includes. NFC"

Causes lld build errors

4 years agoGlobPattern.h - remove unnecessary BitVector.h/StringRef.h includes. NFC
Simon Pilgrim [Sun, 17 May 2020 17:29:27 +0000 (18:29 +0100)]
GlobPattern.h - remove unnecessary BitVector.h/StringRef.h includes. NFC

Use forward declarations (BitVector already had one) and an headers to source file that were implicitly using them.

4 years agoImmutableGraph.h - remove unused raw_ostream.h include. NFC
Simon Pilgrim [Sun, 17 May 2020 17:03:15 +0000 (18:03 +0100)]
ImmutableGraph.h - remove unused raw_ostream.h include. NFC

4 years ago[XRay] Migrate xray_naive_log=true tests to xray_mode=xray-basic
Fangrui Song [Sun, 17 May 2020 16:31:09 +0000 (09:31 -0700)]
[XRay] Migrate xray_naive_log=true tests to xray_mode=xray-basic

4 years ago[x86] favor vector constant load to avoid GPR to XMM transfer
Sanjay Patel [Sun, 17 May 2020 15:56:26 +0000 (11:56 -0400)]
[x86] favor vector constant load to avoid GPR to XMM transfer

This build vector lowering pattern came up in D79886.
I've tried to limit the improvement to cases where it looks
clearly better to load, but we could remove the 'TODO'
predicates already if we are willing to overlook some
corner cases.

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

4 years ago[InstCombine] add tests for FP cast of cast; NFC
Sanjay Patel [Sun, 17 May 2020 15:40:27 +0000 (11:40 -0400)]
[InstCombine] add tests for FP cast of cast; NFC

A fold of casts is proposed as a backend transform in D79187,
but we can also do that in IR (and that may obsolete the need
for a backend transform).

4 years ago[ObjectYAML][DWARF] Take into account other debug sections in DWARFYAML::Data::isEmpty().
Xing GUO [Sun, 17 May 2020 14:48:40 +0000 (22:48 +0800)]
[ObjectYAML][DWARF] Take into account other debug sections in DWARFYAML::Data::isEmpty().

4 years ago[AVR] Explicitly set the address of the data section when invoking the linker
Dylan McKay [Sun, 17 May 2020 14:18:54 +0000 (02:18 +1200)]
[AVR] Explicitly set the address of the data section when invoking the linker

This is required to get avr-gdb correctly showing values at the right
addresses. This problem was discovered by using debug symbols in an
external program to lookup values in an AVR simulator.

4 years ago[mlir] NFC - VectorTransforms use OpBuilder where relevant
Nicolas Vasilache [Sun, 17 May 2020 14:15:58 +0000 (10:15 -0400)]
[mlir] NFC - VectorTransforms use OpBuilder where relevant

Summary: This will allow using unrolling outside of only rewrite patterns.

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

4 years ago[X86] Add getTargetConstantFromBasePtr helper. NFC.
Simon Pilgrim [Sun, 17 May 2020 13:58:17 +0000 (14:58 +0100)]
[X86] Add getTargetConstantFromBasePtr helper. NFC.

Allows us to share code from LoadSDNode and MemIntrinsicSDNode constant pool loads.

4 years ago[X86] getTargetConstantBitsFromNode - remove unnecessary X86ISD::VBROADCAST handling.
Simon Pilgrim [Sun, 17 May 2020 13:39:51 +0000 (14:39 +0100)]
[X86] getTargetConstantBitsFromNode - remove unnecessary X86ISD::VBROADCAST handling.

We create X86ISD::VBROADCAST_LOAD for constant pool folds now.

4 years ago[InstCombine] improve analysis of FP->int->FP to eliminate fpextend
Sanjay Patel [Sun, 17 May 2020 12:43:40 +0000 (08:43 -0400)]
[InstCombine] improve analysis of FP->int->FP to eliminate fpextend

This was originally in D79116.
Converting from a narrow-enough FP source value to integer and
back to FP guarantees that the conversion to FP is exact because
of UB/poison-on-overflow.

This was suggested in PR36617:
https://bugs.llvm.org/show_bug.cgi?id=36617#c19

4 years ago[LoopUnroll] Extend test case with additional loop with larger TC.
Florian Hahn [Sun, 17 May 2020 12:55:11 +0000 (13:55 +0100)]
[LoopUnroll] Extend test case with additional loop with larger TC.

4 years ago[LoopUnroll] Precommit test for PR459393.
Florian Hahn [Sun, 17 May 2020 12:26:51 +0000 (13:26 +0100)]
[LoopUnroll] Precommit test for PR459393.

4 years ago[AMDGPU] Enable base pointer.
Christudasan Devadasan [Tue, 21 Apr 2020 09:34:33 +0000 (15:04 +0530)]
[AMDGPU] Enable base pointer.

When the callee requires a dynamic stack realignment,
it is not possible to correcty access the incoming
stack arguments using the stack pointer. We reserve a
base pointer in such cases to access the function arguments
inside the callee. The base pointer will hold the incoming
stack pointer value before any kind of delta added to it.

Reviewed By: arsenm, scott.linder

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

4 years ago[OpenMP] Fix race condition in the completion/freeing of detached tasks
Joachim Protze [Sun, 17 May 2020 10:25:02 +0000 (12:25 +0200)]
[OpenMP] Fix race condition in the completion/freeing of detached tasks

Spurious assertion failures are symptoms of a race condition for the handling
of detached tasks:
Assertion failure at kmp_tasking.cpp(3744): taskdata->td_flags.complete == 1.
Assertion failure at kmp_tasking.cpp(710): taskdata->td_flags.executing == 0.

in the case of detach=true, all accesses to taskdata in __kmp_task_finish need
to happen before (~line 873):

taskdata->td_flags.proxy = TASK_PROXY;

This assignment signals to __kmp_fulfill_event, that the task will need to be
freed there. So, conceptionally the ownership of taskdata is moved.

Reviewed By: AndreyChurbanov

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

4 years ago[Inliner][NFC] silence gcc 'overloaded-virtual' warning on hiding of Pass::doInitiali...
Fedor Sergeev [Sun, 17 May 2020 09:31:33 +0000 (16:31 +0700)]
[Inliner][NFC] silence gcc 'overloaded-virtual' warning on hiding of Pass::doInitialization

When compiling with -Werror=overloaded-virtual, gcc emits this:
====
llvm/include/llvm/Pass.h:102:16: error: ‘virtual bool llvm::Pass::doInitialization(llvm::Module&)’ was hidden [-Werror=overloaded-virtual]
   virtual bool doInitialization(Module &)  { return false; }
                ^~~~~~~~~~~~~~~~
In file included from llvm/lib/Transforms/IPO/Inliner.cpp:20:0:
llvm/include/llvm/Transforms/IPO/Inliner.h:38:8: error:   by ‘virtual bool llvm::LegacyInlinerBase::doInitialization(llvm::CallGraph&)’ [-Werror=overloaded-virtual]
   bool doInitialization(CallGraph &CG) override;
        ^~~~~~~~~~~~~~~~
====

This is an old issue which has just started biting our downstream after
a slight rearrangement of includes around Inliner.
Fixing it similar to how doFinalization was done years ago.

4 years ago[LLVM][AVR] Support for R_AVR_6 fixup
Dylan McKay [Sun, 17 May 2020 04:46:32 +0000 (16:46 +1200)]
[LLVM][AVR] Support for R_AVR_6 fixup

Summary: Handle the emission of `R_AVR_6` ELF relocation type.

Reviewers: dylanmckay

Reviewed By: dylanmckay

Subscribers: hiraditya, Jim, llvm-commits

Tags: #llvm

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

Patch by @LemonBoy https://reviews.llvm.org/p/LemonBoy/

4 years ago[AVR] Fix I/O instructions on XMEGA
Dylan McKay [Sun, 17 May 2020 04:25:12 +0000 (16:25 +1200)]
[AVR]  Fix I/O instructions on XMEGA

Summary:
On XMEGA, I/O address space is same as data address space - there is no 0x20 offset,
because CPU General Purpose Registers are not mapped in data address space.

From https://en.wikipedia.org/wiki/AVR_microcontrollers
> In the XMEGA variant, the working register file is not mapped into the data address space; as such, it is not possible to treat any of the XMEGA's working registers as though they were SRAM. Instead, the I/O registers are mapped into the data address space starting at the very beginning of the address space.

Reviewers: dylanmckay

Reviewed By: dylanmckay

Subscribers: hiraditya, Jim, llvm-commits

Tags: #llvm

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

Patch by Vlastimil Labsky.

4 years ago[Driver] Render -T for Gnu.cpp
Fangrui Song [Sun, 17 May 2020 06:32:28 +0000 (23:32 -0700)]
[Driver] Render -T for Gnu.cpp

clang -T a.lds a.c currently does not render -T.

4 years ago[MLIR][cmake] use LINK_LIBS PUBLIC for MLIRStandardOpsTransforms
Stephen Neuendorffer [Sun, 17 May 2020 05:42:32 +0000 (22:42 -0700)]
[MLIR][cmake] use LINK_LIBS PUBLIC for MLIRStandardOpsTransforms

Without this LLVM_LINK_LLVM_DYLIB is broken

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

4 years ago[llvm-xray] consumeError when trying big-endian
Fangrui Song [Sun, 17 May 2020 05:42:52 +0000 (22:42 -0700)]
[llvm-xray] consumeError when trying big-endian

Follow-up of rL341226.

Fixes "Expected<T> must be checked before access or destruction"

4 years ago[NFC] Run clang-format on ISDOpcodes.h
Arthur Eubanks [Fri, 15 May 2020 23:31:17 +0000 (16:31 -0700)]
[NFC] Run clang-format on ISDOpcodes.h

Subscribers: jfb, llvm-commits

Tags: #llvm

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

4 years ago[Compiler-rt] Emit error if builtins library cannot be found
Yi Kong [Sat, 16 May 2020 03:59:21 +0000 (11:59 +0800)]
[Compiler-rt] Emit error if builtins library cannot be found

Since setting COMPILER_RT_USE_BUILTINS_LIBRARY would remove -z,defs
flag, missing builtins library would continue to build unnoticed.
Explicitly emit an error in such case.

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

4 years agoFix a few doc typos to cycle bots.
Nico Weber [Sun, 17 May 2020 00:38:28 +0000 (20:38 -0400)]
Fix a few doc typos to cycle bots.

4 years agoTry to heal bots after https://reviews.llvm.org/D79655
Nico Weber [Sun, 17 May 2020 00:32:58 +0000 (20:32 -0400)]
Try to heal bots after https://reviews.llvm.org/D79655

4 years ago[LegalizeDAG] Use MachinePointerInfo::getUnknownStack in place of MachinePointerInfo...
Craig Topper [Sat, 16 May 2020 22:48:08 +0000 (15:48 -0700)]
[LegalizeDAG] Use MachinePointerInfo::getUnknownStack in place of MachinePointerInfo() in a couple places. NFC

We know the pointer somewhere on the stack, we just don't know
exactly where since the index may be variable.

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

4 years agoAllocaInst should store Align instead of MaybeAlign.
Eli Friedman [Fri, 15 May 2020 20:23:14 +0000 (13:23 -0700)]
AllocaInst should store Align instead of MaybeAlign.

Along the lines of D77454 and D79968.  Unlike loads and stores, the
default alignment is getPrefTypeAlign, to match the existing handling in
various places, including SelectionDAG and InstCombine.

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

4 years ago[X86] Replace selectScalarSSELoad ComplexPattern with PatFrags to handle the 3 types...
Craig Topper [Sat, 16 May 2020 19:38:34 +0000 (12:38 -0700)]
[X86] Replace selectScalarSSELoad ComplexPattern with PatFrags to handle the 3 types of loads we currently match.

This ensures we create mem operands for these instructions fixing PR45949.

Unfortunately, it increases the size of X86GenDAGISel.inc, but some dag
combine canonicalization could reduce the types of load we need to match.

4 years agoHarden IR and bitcode parsers against infinite size types.
Eli Friedman [Sat, 16 May 2020 21:01:54 +0000 (14:01 -0700)]
Harden IR and bitcode parsers against infinite size types.

If isSized is passed a SmallPtrSet, it uses that set to catch infinitely
recursive types (for example, a struct that has itself as a member).
Otherwise, it just crashes on such types.

4 years agoRevert "[nfc] test commit"
faisal vali [Sat, 16 May 2020 20:12:04 +0000 (15:12 -0500)]
Revert "[nfc] test commit"

This reverts commit 0ee46e857d81ea815e5b11d266c0c118a2c2e714.

4 years ago[nfc] test commit
faisal vali [Sat, 16 May 2020 20:08:30 +0000 (15:08 -0500)]
[nfc] test commit

4 years agoExpose IRGen API to add the default IR attributes to a function definition.
John McCall [Sat, 16 May 2020 18:44:54 +0000 (14:44 -0400)]
Expose IRGen API to add the default IR attributes to a function definition.

I've also made a stab at imposing some more order on where and how we add
attributes; this part should be NFC.  I wasn't sure whether the CUDA use
case for libdevice should propagate CPU/features attributes, so there's a
bit of unnecessary duplication.

4 years agoThe release notes for ObjCBreakBeforeNestedBlockParam was placed between the release...
mydeveloperday [Sat, 16 May 2020 17:48:13 +0000 (18:48 +0100)]
The release notes for ObjCBreakBeforeNestedBlockParam was placed between the release note for IndentCaseBlocks and its example code

Remove other whitespace and line limit issues and double blank line issues

4 years ago[VectorCombine] forward walk through instructions to improve chaining of transforms
Sanjay Patel [Sat, 16 May 2020 17:08:01 +0000 (13:08 -0400)]
[VectorCombine] forward walk through instructions to improve chaining of transforms

This is split off from D79799 - where I was proposing to fully iterate
over a function until there are no more transforms. I suspect we are
still going to want to do something like that eventually.

But we can achieve the same gains much more efficiently on the current
set of regression tests just by reversing the order that we visit the
instructions.

This may also reduce the motivation for D79078, but we are still not
getting the optimal pattern for a reduction.

4 years ago[PhaseOrdering] add vector reduction tests; NFC
Sanjay Patel [Sat, 16 May 2020 16:50:16 +0000 (12:50 -0400)]
[PhaseOrdering] add vector reduction tests; NFC

These are based on tests originally included in:
D79078

4 years ago[InstCombine] Clean up alignment handling (NFC)
Nikita Popov [Sat, 16 May 2020 16:46:03 +0000 (18:46 +0200)]
[InstCombine] Clean up alignment handling (NFC)

Now that load/store alignment is required, we can simplify code
in some places.

4 years ago[ARM] Patterns for VQSHRN
David Green [Sat, 16 May 2020 14:27:20 +0000 (15:27 +0100)]
[ARM] Patterns for VQSHRN

Given a VQMOVN(VSHR), we can fold that into a VQSHRN simply enough using
a few tablegen patterns.

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

4 years ago[VectorCombine] add reduction-like patterns; NFC
Sanjay Patel [Sat, 16 May 2020 16:44:00 +0000 (12:44 -0400)]
[VectorCombine] add reduction-like patterns; NFC

These are based on tests originally included in:
D79078

4 years ago[AArch64] Precommit tests for D77316
Jay Foad [Sat, 16 May 2020 15:00:02 +0000 (16:00 +0100)]
[AArch64] Precommit tests for D77316

4 years ago[x86][CGP] try to hoist funnel shift above select-of-splats
Sanjay Patel [Fri, 15 May 2020 19:22:30 +0000 (15:22 -0400)]
[x86][CGP] try to hoist funnel shift above select-of-splats

This is basically the same patch as D63233, but converted to
funnel shifts rather than regular shifts. I did not see a
way to effectively share code for these 2 cases though.

This follows D79718 and D79827 to re-fix PR37426 because
that gets canonicalized to funnel shift intrinsics in IR.

I did draft an alternative patch as an enhancement to
"shouldSinkOperands()", but that was awkward because
we have to key the transform from the select, but then
look at both its users and its operands.

4 years ago[ARM] Combines for VMOVN
David Green [Sat, 16 May 2020 14:12:41 +0000 (15:12 +0100)]
[ARM] Combines for VMOVN

This adds two combines for VMOVN, one to fold
VMOVN[tb](c, VQMOVNb(a, b)) => VQMOVN[tb](c, b)
The other to perform demand bits analysis on the lanes of a VMOVN. We
know that only the bottom lanes of the second operand and the top or
bottom lanes of the Qd operand are needed in the result, depending on if
the VMOVN is bottom or top.

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

4 years ago[ARM] MVE saturating truncates
David Green [Sat, 16 May 2020 13:54:33 +0000 (14:54 +0100)]
[ARM] MVE saturating truncates

This adds some custom lowering for VQMOVN, an instruction that can be
used to perform saturating truncates from a pair of min(max(X, -0x8000),
0x7fff), providing those constants are correct. This leaves a VQMOVNBs
which saturates the value and inserts that into the bottom lanes of an
existing vector. We then need to do something with the other lanes,
extending the value using a vmovlb.

Ideally, as will often be the case, only the bottom lane of what remains
will be demanded, allowing the vmovlb to be removed. Which should mean
the instruction is either equal or a win most of the time, and allows
some extra follow-up folding to happen.

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

4 years agoDIEHash.cpp - remove headers explicitly included in DIEHash.h. NFC.
Simon Pilgrim [Sat, 16 May 2020 13:40:00 +0000 (14:40 +0100)]
DIEHash.cpp - remove headers explicitly included in DIEHash.h. NFC.

Don't duplicate module header includes.

4 years agoAggressiveAntiDepBreaker.cpp - remove headers explicitly included in AggressiveAntiDe...
Simon Pilgrim [Sat, 16 May 2020 13:39:21 +0000 (14:39 +0100)]
AggressiveAntiDepBreaker.cpp - remove headers explicitly included in AggressiveAntiDepBreaker.h. NFC.

Don't duplicate module header includes.

4 years agoLLParser.cpp - remove headers explicitly included in LLParser.h. NFC.
Simon Pilgrim [Sat, 16 May 2020 13:38:40 +0000 (14:38 +0100)]
LLParser.cpp - remove headers explicitly included in LLParser.h. NFC.

Don't duplicate module header includes.

4 years agoFix -Wdocumentation warning. NFC.
Simon Pilgrim [Sat, 16 May 2020 12:28:59 +0000 (13:28 +0100)]
Fix -Wdocumentation warning. NFC.

Remove non-existant DataLayoutCallback param comment.

4 years ago[ARM] Extra VQMOVN/VQSHRN tests. NFC
David Green [Sat, 16 May 2020 13:23:26 +0000 (14:23 +0100)]
[ARM] Extra VQMOVN/VQSHRN tests. NFC

4 years ago[mlir][spirv] Handle debuginfo for control flow ops.
Denis Khalikov [Sat, 16 May 2020 07:56:58 +0000 (10:56 +0300)]
[mlir][spirv] Handle debuginfo for control flow ops.

Summary:
Handle debuginfo for control flow operations: spv.Selection,
spv.Loop, spv.BranchOp, spv.BranchConditional.

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

4 years ago[ValueTracking] Fix computeKnownBits() with bitwidth-changing ptrtoint
Nikita Popov [Fri, 1 May 2020 13:19:41 +0000 (15:19 +0200)]
[ValueTracking] Fix computeKnownBits() with bitwidth-changing ptrtoint

computeKnownBitsFromAssume() currently asserts if m_V matches a
ptrtoint that changes the bitwidth. Because InstCombine
canonicalizes ptrtoint instructions to use explicit zext/trunc,
we never ran into the issue in practice. I'm adding unit tests,
as I don't know if this can be triggered via IR anywhere.

Fix this by calling anyextOrTrunc(BitWidth) on the computed
KnownBits. Note that we are going from the KnownBits of the
ptrtoint result to the KnownBits of the ptrtoint operand,
so we need to truncate if the ptrtoint zexted and anyext if
the ptrtoint truncated.

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

4 years ago[libcxx testing] Remove ALLOW_RETRIES from last futures test
David Zarzycki [Sat, 16 May 2020 11:08:42 +0000 (07:08 -0400)]
[libcxx testing] Remove ALLOW_RETRIES from last futures test

Like other uses of ALLOW_RETRIES, this test tried to verify that an API
returned "quickly" but quick is not safe to define given slow and/or
busy machines.

Instead, we now verify that these "wait" APIs actually wait, which the
old test did not.

4 years ago[LegalizeDAG] Use getMemBasePlusOffset to simplify some code. Use other signature...
Craig Topper [Sat, 16 May 2020 08:02:06 +0000 (01:02 -0700)]
[LegalizeDAG] Use getMemBasePlusOffset to simplify some code. Use other signature of getMemBasePlusOffset in another location. NFCI

The code was calculating an offset from a stack pointer SDValue.
This is exactly what getMemBasePlusOffset does. I also replaced
sizeof(int) with a hardcoded 4. We know the type we're operating
on is 4 bytes. But the size of int that the source code is being
compiled with isn't guaranteed to be 4 bytes.

While here replace another use of getMemBasePlusOffset that was
proceeded with a call to getConstant with the other signature
that call getConstant internally.

4 years ago[LegalizeVectorTypes] Remove non-constnat INSERT_SUBVECTOR handling. NFC
Craig Topper [Fri, 15 May 2020 19:44:52 +0000 (12:44 -0700)]
[LegalizeVectorTypes] Remove non-constnat INSERT_SUBVECTOR handling. NFC

Now that D79814 has landed, we can assume that subvector ops use constant, in-range indices.

4 years ago[Windows EH] Fix the order of Nested try-catches in $tryMap$ table
Ten Tzen [Sat, 16 May 2020 05:03:43 +0000 (22:03 -0700)]
[Windows EH] Fix the order of Nested try-catches in $tryMap$ table

This bug is exposed by Test7 of ehthrow.cxx in MSVC EH suite where
a rethrow occurs in a try-catch inside a catch (i.e., a nested Catch
handlers). See the test code in
https://github.com/microsoft/compiler-tests/blob/master/eh/ehthrow.cxx#L346

When an object is rethrown in a Catch handler, the copy-ctor of this
object must be executed after the destructions of live objects, but
BEFORE the dtors of live objects in parent handlers.

Today Windows 64-bit runtime (__CxxFrameHandler3 & 4) expects nested Catch
handers
are stored in pre-order (outer first, inner next) in $tryMap$ table, so
that given a State, its Catch's beginning State can be properly
retrieved. The Catch beginning state (which is also the ending State) is
the State where rethrown object's copy-ctor must take place.

LLVM currently stores nested catch handlers in post-ordering because
it's the natural way to compute the highest State in Catch.
The fix is to simply store TryCatch handler in pre-order, but update
Catch's highest State after child Catches are all processed.

Differential Revision: https://reviews.llvm.org/D79474?id=263919

4 years agoRevert "[WebAssembly] Handle exception specifications"
Heejin Ahn [Sat, 16 May 2020 04:33:44 +0000 (21:33 -0700)]
Revert "[WebAssembly] Handle exception specifications"

This reverts commit bca347508c86647f9d44992275c9a364fbd9fb0d.

This broke clang/test/Misc/warning-flags.c, because the newly added
warning option in this commit didn't have a matching flag.

4 years ago[WebAssembly] Handle exception specifications
Heejin Ahn [Fri, 8 May 2020 23:19:46 +0000 (16:19 -0700)]
[WebAssembly] Handle exception specifications

Summary:
Wasm currently does not fully handle exception specifications. Rather
than crashing, this treats `throw()` in the same way as `noexcept`, and
ignores and prints a warning for `throw(type, ..)`, for a temporary
measure.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits

Tags: #clang

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

4 years ago[AMDGPU] Allow use of StackPtrOffsetReg when building spills
Carl Ritson [Sat, 16 May 2020 02:54:31 +0000 (11:54 +0900)]
[AMDGPU] Allow use of StackPtrOffsetReg when building spills

Summary:
When spilling in the entry function we should be able to borrow
StackPtrOffsetReg as a last resort.  This restores behaviour
removed in D75138, and fixes failures when shaders use all
SGPRs, VGPRs and spill in the entry function.

Reviewers: scott.linder, arsenm, tpr

Reviewed By: scott.linder, arsenm

Subscribers: qcolombet, foad, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[flang] Constraint checks C751 to C760
Pete Steinfeld [Tue, 12 May 2020 16:53:58 +0000 (09:53 -0700)]
[flang] Constraint checks C751 to C760

Summary:
Many of these were already implemented, and I just annotated the tests and/or
the code.

C752 was a simple check to verify that CONTIGUOUS components are arrays with

C754 proved to be virtually identical to C750 that I implemented previously.
This caused me to remove the distinction between specification expressions for
type parameters and bounds expressions that I'd previously created.
the POINTER attribute.

I also changed the error messages to specify that errors in specification
expressions could arise from either bad derived type components or type
parameters.

In cases where we detect a type param that was not declared, I created a symbol
marked as erroneous.  That avoids subsequent semantic process for expressions
containing the symbol.  This change caused me to adjust tests resolve33.f90 and
resolve34.f90.  Also, I avoided putting out error messages for erroneous type
param symbols in `OkToAddComponent()` in resolve-names.cpp and in
`EvaluateParameters()`, type.cpp.

C756 checks that procedure components have the POINTER attribute.

Reviewers: tskeith, klausler, DavidTruby

Subscribers: llvm-commits

Tags: #llvm, #flang

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

4 years ago[clang-tidy] Transformer checks now store IncludeStyle option
Nathan James [Sat, 16 May 2020 00:14:55 +0000 (01:14 +0100)]
[clang-tidy] Transformer checks now store IncludeStyle option

4 years agoFix go bindings after FixedVectorType -> VectorType change.
Eric Christopher [Fri, 15 May 2020 23:30:11 +0000 (16:30 -0700)]
Fix go bindings after FixedVectorType -> VectorType change.

4 years agoPrevent register coalescing in functions whith setjmp
Diogo Sampaio [Fri, 15 May 2020 21:21:13 +0000 (22:21 +0100)]
Prevent register coalescing in functions whith setjmp

Summary:
In the the given example, a stack slot pointer is merged
between a setjmp and longjmp. This pointer is spilled,
so it does not get correctly restored, addinga undefined
behaviour where it shouldn't.

Change-Id: I60ec010844f2a24ce01ceccf12eb5eba5ab94abb

Reviewers: eli.friedman, thanm, efriedma

Reviewed By: efriedma

Subscribers: MatzeB, qcolombet, tpr, rnk, efriedma, hiraditya, llvm-commits, chill

Tags: #llvm

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

4 years ago[test] Improve FileCheck's numeric-expression.txt
Thomas Preud'homme [Tue, 12 May 2020 22:39:45 +0000 (23:39 +0100)]
[test] Improve FileCheck's numeric-expression.txt

Summary:
Various improvement for FileCheck's numeric-expression.txt test:
- remove unused values in USE DEF FMT IMPL MATCH section
- replace 14 literal for 0xe and 0xE to have example of hex literals
- rename variable to be more self-descriptive
- move CHECK as comment of the values being matched to help readability
- add conversion tests
- simplify test for use of several numeric variables by using existing
  variable
- adjust position of error message check to match the alignment of the
  error message wrt. the output matched by the previous check

Reviewed By: jhenderson, jdenny

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

4 years agoFix flang build after mlir SideEffects.h -> SideEffectInterfaces.h change.
Eric Christopher [Fri, 15 May 2020 22:50:28 +0000 (15:50 -0700)]
Fix flang build after mlir SideEffects.h -> SideEffectInterfaces.h change.

4 years agoCleanup some test issues:
Casey Carter [Fri, 15 May 2020 22:14:57 +0000 (15:14 -0700)]
Cleanup some test issues:

* improve coverage in `span`'s "conversion from `std::array`" test, while eliminating MSVC diagnostics about `testConstructorArray<T>() && testConstructorArray<const T, T>()` being redundant when `T` is already `const`.

* Remove use of `is_assignable` that triggers UB due to an insufficiently-complete type argument in `std::function`'s assignment operator test.

* Don't test that `shared_ptr` initialization from an rvalue triggers the lvalue aliasing constructor on non-libc++; this is not the case for Standard Libraries that implement LWG-2996. (Ditto, I'd simply remove this but it's your library ;).)

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