platform/upstream/llvm.git
5 years agoPermit cross-CU references
Jan Kratochvil [Wed, 15 May 2019 19:22:33 +0000 (19:22 +0000)]
Permit cross-CU references

So far dw_offset_t was global for the whole SymbolFileDWARF but with
.debug_types the same dw_offset_t may mean two different things depending on
its section (=CU). So references now return whole new referenced DWARFDIE
instead of just dw_offset_t.

This means that some functions have to now handle 16 bytes instead of 8 bytes
but I do not see that anywhere performance critical.

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

llvm-svn: 360795

5 years ago[lld] Remove 2>&1 from --trace-symbol tests
Sam Clegg [Wed, 15 May 2019 19:01:51 +0000 (19:01 +0000)]
[lld] Remove 2>&1 from --trace-symbol tests

The tracing goes to stdout so this is not needed.

Also remove the "not" from the final check in ELF/trace-symbols.s.
According the comment the check is that we don't crash, so we should
be checking for success here. Previously this step is error'ing with
undefined symbols because it didn't include all the needed objects.

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

llvm-svn: 360794

5 years ago[analyzer] RetainCount: Fix os_returns_retained_on_zero with weird return types.
Artem Dergachev [Wed, 15 May 2019 18:41:32 +0000 (18:41 +0000)]
[analyzer] RetainCount: Fix os_returns_retained_on_zero with weird return types.

The checker was crashing when it was trying to assume a structure
to be null or non-null so that to evaluate the effect of the annotation.

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

llvm-svn: 360790

5 years ago[MachineOperand] Add a ChangeToGA method
Nicolai Haehnle [Wed, 15 May 2019 17:48:10 +0000 (17:48 +0000)]
[MachineOperand] Add a ChangeToGA method

Summary:
Analogous to the other ChangeToXXX methods. See the next patch for a
use case.

Change-Id: I6548d614706834fb9109ab3c8fe915e9c6ece2a7

Reviewers: arsenm, kzhuravl

Subscribers: wdng, llvm-commits

Tags: #llvm

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

llvm-svn: 360789

5 years ago[clang-tidy] Recommit r360785 "modernize-loop-convert: impl const cast iter" with...
Don Hinton [Wed, 15 May 2019 17:47:51 +0000 (17:47 +0000)]
[clang-tidy] Recommit r360785 "modernize-loop-convert: impl const cast iter" with correct attribution

Summary:
modernize-loop-convert was not detecting implicit casts to
const_iterator as convertible to range-based loops:

    std::vector<int> vec{1,2,3,4}
    for(std::vector<int>::const_iterator i = vec.begin();
        i != vec.end();
        ++i) { }

Thanks to Don Hinton for advice.

As well, this change adds a note for this check's applicability to code
targeting OpenMP prior version 5 as this check will continue breaking
compilation with `-fopenmp`. Thanks to Roman Lebedev for pointing this
out.

Fixes PR#35082

Patch by Torbjörn Klatt!

Reviewed By: hintonda

Tags: #clang-tools-extra, #clang

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

llvm-svn: 360788

5 years agoRevert [clang-tidy] modernize-loop-convert: impl const cast iter
Don Hinton [Wed, 15 May 2019 17:36:54 +0000 (17:36 +0000)]
Revert [clang-tidy] modernize-loop-convert: impl const cast iter

This reverts r360785 (git commit 42d28be802fe5beab18bc1a27f89894c0a290d44)

llvm-svn: 360787

5 years agoRegAlloc: try to fail more gracefully when out of registers
Nicolai Haehnle [Wed, 15 May 2019 17:29:58 +0000 (17:29 +0000)]
RegAlloc: try to fail more gracefully when out of registers

Summary:
The emitError path allows the program to continue, unlike report_fatal_error.
This is friendlier to use cases where LLVM is embedded in a larger program,
because the caller may be able to deal with the error somewhat gracefully.

Change the number of requested NOP bytes in the AArch64 and PowerPC
test cases to avoid triggering an unrelated assertion. The compilation
still fails, as verified by the test.

Change-Id: Iafb9ca341002a597b82e59ddc7a1f13c78758e3d

Reviewers: arsenm, MatzeB

Subscribers: qcolombet, nemanjai, wdng, javed.absar, kristof.beyls, kbarton, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 360786

5 years ago[clang-tidy] modernize-loop-convert: impl const cast iter
Don Hinton [Wed, 15 May 2019 16:58:58 +0000 (16:58 +0000)]
[clang-tidy] modernize-loop-convert: impl const cast iter

Summary:
modernize-loop-convert was not detecting implicit casts to
const_iterator as convertible to range-based loops:

    std::vector<int> vec{1,2,3,4}
    for(std::vector<int>::const_iterator i = vec.begin();
        i != vec.end();
        ++i) { }

Thanks to Don Hinton for advice.

As well, this change adds a note for this check's applicability to code
targeting OpenMP prior to version 5 as this check will continue breaking
compilation with `-fopenmp`. Thanks to Roman Lebedev for pointing this
out.

Fixes PR#35082

Reviewed By: hintonda

Tags: #clang-tools-extra, #clang

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

llvm-svn: 360785

5 years agoFixed https://bugs.llvm.org/show_bug.cgi?id=41584.
Andrey Churbanov [Wed, 15 May 2019 16:53:45 +0000 (16:53 +0000)]
Fixed https://bugs.llvm.org/show_bug.cgi?id=41584.

Removed unconditional and unsafe decrement of counter
of active threads in pool at shutdown time.

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

llvm-svn: 360784

5 years agoTest commit
Kevin Petit [Wed, 15 May 2019 16:39:28 +0000 (16:39 +0000)]
Test commit

Remove stray space.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
llvm-svn: 360783

5 years ago[WebAssembly] LTO: Honor comdat groups when loading bitcode files
Sam Clegg [Wed, 15 May 2019 16:03:28 +0000 (16:03 +0000)]
[WebAssembly] LTO: Honor comdat groups when loading bitcode files

But don't apply comdat groups when loading the LTO object files.
This is basically the same logic used by the ELF linker.

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

llvm-svn: 360782

5 years ago[FileCheck] Fix sphinx error: Make input be gas block
Thomas Preud'homme [Wed, 15 May 2019 15:20:45 +0000 (15:20 +0000)]
[FileCheck] Fix sphinx error: Make input be gas block

Summary:
Change example of input text from being llvm block to being gas block
since that text is made-up assembly.

Reviewers: jhenderson, jdenny, probinson, arichardson

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 360781

5 years ago[JumpThreading] A bug fix for stale loop info after unfold select
Hiroshi Yamauchi [Wed, 15 May 2019 15:15:16 +0000 (15:15 +0000)]
[JumpThreading] A bug fix for stale loop info after unfold select

Summary:
The return value of a TryToUnfoldSelect call was not checked, which led to an
incorrectly preserved loop info and some crash.

The original crash was reported on https://reviews.llvm.org/D59514.

Reviewers: davidxl, amehsan

Reviewed By: davidxl

Subscribers: fhahn, brzycki, llvm-commits

Tags: #llvm

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

llvm-svn: 360780

5 years ago[clang-tidy] new check: bugprone-branch-clone
Kristof Umann [Wed, 15 May 2019 15:06:25 +0000 (15:06 +0000)]
[clang-tidy] new check: bugprone-branch-clone

Implement a check for detecting if/else if/else chains where two or more
branches are Type I clones of each other (that is, they contain identical code)
and for detecting switch statements where two or more consecutive branches are
Type I clones of each other.

Patch by Donát Nagy!

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

llvm-svn: 360779

5 years ago[AMDGPU] Increases available SGPR for Calling Convention
Ryan Taylor [Wed, 15 May 2019 14:43:55 +0000 (14:43 +0000)]
[AMDGPU] Increases available SGPR for Calling Convention

Summary:
SGPR in CC can be either hw initialized or set by other chained shaders
and so this increases the SGPR count availalbe to CC to 105.

Change-Id: I3dfadc750fe4a3e2bd07117a2899fd13f3e2fef3

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

Tags: #llvm

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

llvm-svn: 360778

5 years agoTeach InstSimplify -X + X --> 0.0 about unary FNeg
Cameron McInally [Wed, 15 May 2019 14:31:33 +0000 (14:31 +0000)]
Teach InstSimplify -X + X --> 0.0 about unary FNeg

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

llvm-svn: 360777

5 years agoRevert r360771 "[MergeICmps] Simplify the code."
Clement Courbet [Wed, 15 May 2019 14:21:59 +0000 (14:21 +0000)]
Revert r360771 "[MergeICmps] Simplify the code."

Breaks a bunch of builbdots.

llvm-svn: 360776

5 years ago[MergeICmps] Fix r360771.
Clement Courbet [Wed, 15 May 2019 14:00:45 +0000 (14:00 +0000)]
[MergeICmps] Fix r360771.

Twine references a StringRef by reference, not value...

llvm-svn: 360775

5 years agoIntroduce new OpenMP 5.0 depend object type.
Andrey Churbanov [Wed, 15 May 2019 13:45:36 +0000 (13:45 +0000)]
Introduce new OpenMP 5.0 depend object type.

The implementation should be done by compiler, user can only declare
objects of this type and use them in OpenMP directives.

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

llvm-svn: 360774

5 years agoRevert "[Salvage] Change salvage debug info implementation to use DW_OP_LLVM_convert...
Stephen Tozer [Wed, 15 May 2019 13:41:44 +0000 (13:41 +0000)]
Revert "[Salvage] Change salvage debug info implementation to use DW_OP_LLVM_convert where needed"

This reverts r360772 due to build issues.
Reverted commit: 17dd4d7403770bd683675e45f5517e0cdb8f9b2b.

llvm-svn: 360773

5 years ago[Salvage] Change salvage debug info implementation to use DW_OP_LLVM_convert where...
Stephen Tozer [Wed, 15 May 2019 13:15:48 +0000 (13:15 +0000)]
[Salvage] Change salvage debug info implementation to use DW_OP_LLVM_convert where needed

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

Previously, LLVM had no functional way of performing casts inside of a
DIExpression(), which made salvaging cast instructions other than Noop
casts impossible. With the recent addition of DW_OP_LLVM_convert this
salvaging is now possible, and so can be used to fix the attached bug as
well as any cases where SExt instruction results are lost in the
debugging metadata. This patch introduces this fix by expanding the
salvage debug info method to cover these cases using the new operator.

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

llvm-svn: 360772

5 years ago[MergeICmps] Simplify the code.
Clement Courbet [Wed, 15 May 2019 13:04:24 +0000 (13:04 +0000)]
[MergeICmps] Simplify the code.

Instead of patching the original blocks, we now generate new blocks and
delete the old blocks. This results in simpler code with a less twisted
control flow (see the change in `entry-block-shuffled.ll`).

This will make https://reviews.llvm.org/D60318 simpler by making it more
obvious where control flow created and deleted.

Reviewers: gchatelet

Subscribers: hiraditya, llvm-commits, spatel

Tags: #llvm

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

llvm-svn: 360771

5 years agoRevert rL360675 : [APFloat] APFloat::Storage::Storage - fix use after move
Simon Pilgrim [Wed, 15 May 2019 13:03:10 +0000 (13:03 +0000)]
Revert rL360675 : [APFloat] APFloat::Storage::Storage - fix use after move

This was mentioned both in https://www.viva64.com/en/b/0629/ and by scan-build checks
........
There's concerns this may just introduce a use-after-free instead.....

llvm-svn: 360770

5 years ago[ARM] Don't use the Machine Scheduler for cortex-m at minsize
David Green [Wed, 15 May 2019 12:58:02 +0000 (12:58 +0000)]
[ARM] Don't use the Machine Scheduler for cortex-m at minsize

The new cortex-m schedule in rL360768 helps performance, but can increase the
amount of high-registers used. This, on average, ends up increasing the
codesize by a fair amount (because less instructions are converted from T2 to
T1). On cortex-m at -Oz, where we are quite size-paranoid, it is better to use
the existing DAG scheduler with the RegPressure scheduling preference (at least
until the issues around T2 vs T1 instructions can be improved).

I have also made sure that the Sched::RegPressure dag scheduler is always
chosen for MinSize.

The test shows one case where we increase the number of registers used.

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

llvm-svn: 360769

5 years ago[ARM] Cortex-M4 schedule
David Green [Wed, 15 May 2019 12:41:58 +0000 (12:41 +0000)]
[ARM] Cortex-M4 schedule

This patch adds a simple Cortex-M4 schedule, renaming the existing M3
schedule to M4 and filling in the latencies as-per the Cortex-M4 TRM:
https://developer.arm.com/docs/ddi0439/latest

Most of these are 1, with the important exception being loads taking 2
cycles. A few others are also higher, but I don't believe they make a
large difference. I've repurposed the M3 schedule as the latencies are
mostly the same between the two cores, with the M4 having more FP and
DSP instructions. We also turn on MISched and UseAA for the cores that
now use this.

It also adds some schedule Write's to various instruction to make things
simpler.

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

llvm-svn: 360768

5 years ago[lldb] [test] Mark frequently failing flaky tests skipped on NetBSD
Michal Gorny [Wed, 15 May 2019 12:13:20 +0000 (12:13 +0000)]
[lldb] [test] Mark frequently failing flaky tests skipped on NetBSD

llvm-svn: 360767

5 years agogn build: Merge r360671
Nico Weber [Wed, 15 May 2019 12:08:45 +0000 (12:08 +0000)]
gn build: Merge r360671

llvm-svn: 360766

5 years ago[mips] LLVM and GAS now use same instructions for CFA Definition. NFCI
Simon Atanasyan [Wed, 15 May 2019 12:05:27 +0000 (12:05 +0000)]
[mips] LLVM and GAS now use same instructions for CFA Definition. NFCI

LLVM previously used `DW_CFA_def_cfa` instruction in .eh_frame to set
the register and offset for current CFA rule. We change it to
`DW_CFA_def_cfa_register` which is the same one used by GAS that only
changes the register but keeping the old offset.

Patch by Mirko Brkusanin.

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

llvm-svn: 360765

5 years agogn build: Run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`
Nico Weber [Wed, 15 May 2019 12:03:10 +0000 (12:03 +0000)]
gn build: Run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`

llvm-svn: 360764

5 years agoarm64_32: add some unittests that were in the wrong commit.
Tim Northover [Wed, 15 May 2019 12:01:04 +0000 (12:01 +0000)]
arm64_32: add some unittests that were in the wrong commit.

Accidentally dropped them when committing the arm64_32 binutils support.
There's no change to real code.

llvm-svn: 360763

5 years agoDelete unnecessary copy ctors/copy assignment operators
Fangrui Song [Wed, 15 May 2019 11:23:54 +0000 (11:23 +0000)]
Delete unnecessary copy ctors/copy assignment operators

It's the simplest and gives the cleanest semantics.

llvm-svn: 360762

5 years ago[lldb] [lit] Pass --mode=compile to fix compiler-full-path.test
Michal Gorny [Wed, 15 May 2019 10:48:55 +0000 (10:48 +0000)]
[lldb] [lit] Pass --mode=compile to fix compiler-full-path.test

Pass '--mode=compile' to fix compiler-full-path.test failure on NetBSD
buildbot (apparently due to lack of 'link' executable).

Fixes r360355.  Acked by Pavel Labath.

llvm-svn: 360761

5 years ago[ASTImporter] Use llvm::Expected and Error in the importer API
Gabor Marton [Wed, 15 May 2019 10:29:48 +0000 (10:29 +0000)]
[ASTImporter] Use llvm::Expected and Error in the importer API

Summary:
This is the final phase of the refactoring towards using llvm::Expected
and llvm::Error in the ASTImporter API.
This involves the following:
- remove old Import functions which returned with a pointer,
- use the Import_New functions (which return with Err or Expected) everywhere
  and handle their return value
- rename Import_New functions to Import
This affects both Clang and LLDB.

Reviewers: shafik, teemperor, aprantl, a_sidorin, balazske, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits, lldb-commits

Tags: #clang, #lldb

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

llvm-svn: 360760

5 years ago[NFC][InstCombine] Regenerate trunc.ll test
Roman Lebedev [Wed, 15 May 2019 10:24:38 +0000 (10:24 +0000)]
[NFC][InstCombine] Regenerate trunc.ll test

llvm-svn: 360759

5 years ago[LV] Move getScalarizationOverhead and vector call cost computations to CM. (NFC)
Florian Hahn [Wed, 15 May 2019 10:05:49 +0000 (10:05 +0000)]
[LV] Move getScalarizationOverhead and vector call cost computations to CM. (NFC)

This reduces the number of parameters we need to pass in and they seem a
natural fit in LoopVectorizationCostModel. Also simplifies things for
D59995.

As a follow up refactoring, we could only expose a expose a
shouldUseVectorIntrinsic() helper in LoopVectorizationCostModel, instead
of calling getVectorCallCost/getVectorIntrinsicCost in
InnerLoopVectorizer/VPRecipeBuilder.

Reviewers: Ayal, hsaito, dcaballe, rengolin

Reviewed By: rengolin

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

llvm-svn: 360758

5 years agoGroup forward declarations in one namespace lldb_private {}
Fangrui Song [Wed, 15 May 2019 09:15:13 +0000 (09:15 +0000)]
Group forward declarations in one namespace lldb_private {}

llvm-svn: 360757

5 years ago[CMake] Add error to clarify that lldb requires libcxx
Stefan Granitz [Wed, 15 May 2019 08:59:02 +0000 (08:59 +0000)]
[CMake] Add error to clarify that lldb requires libcxx

Summary:
This adds a specific error message to clarify that lldb requires libcxx when
built together with clang on macOS. In addition, the lldb building docs are also
updated.

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

Reviewers: sgraenitz, JDevlieghere, EricWF

Reviewed By: sgraenitz

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 360756

5 years ago[[DAGCombiner][NFC] Add a comment.
Clement Courbet [Wed, 15 May 2019 08:21:18 +0000 (08:21 +0000)]
[[DAGCombiner][NFC] Add a comment.

As suggested in D61846.

llvm-svn: 360755

5 years agoDWARF: s/CompileUnit/Unit/ in DWARFFormValue
Pavel Labath [Wed, 15 May 2019 07:45:40 +0000 (07:45 +0000)]
DWARF: s/CompileUnit/Unit/ in DWARFFormValue

The class has been converted to use DWARFUnit, but a number of uses of
the words compile unit remained. This removes all such references
Get/SetCompileUnit becomes Get/SetUnit, and m_cu becomes m_unit.

llvm-svn: 360754

5 years agoReplace assert with static_assert here applicable.
Jonas Devlieghere [Wed, 15 May 2019 05:39:41 +0000 (05:39 +0000)]
Replace assert with static_assert here applicable.

Replaces assert() with static_assert() if the condition is can be
evaluated at compile time.

llvm-svn: 360753

5 years agoMark private unimplemented functions as deleted
Jonas Devlieghere [Wed, 15 May 2019 05:31:14 +0000 (05:31 +0000)]
Mark private unimplemented functions as deleted

Applies modernize-use-equals-delete to the LLDB code base and removes
the now redundant comments.

llvm-svn: 360751

5 years ago[Docs] Document lldb-dotest
Jonas Devlieghere [Wed, 15 May 2019 04:42:30 +0000 (04:42 +0000)]
[Docs] Document lldb-dotest

Document the lldb-dotest binary.

llvm-svn: 360748

5 years ago[X86] Use OR32mi8Locked instead of LOCK_OR32mi8 in emitLockedStackOp.
Craig Topper [Wed, 15 May 2019 04:15:46 +0000 (04:15 +0000)]
[X86] Use OR32mi8Locked instead of LOCK_OR32mi8 in emitLockedStackOp.

They encode the same way, but OR32mi8Locked sets hasUnmodeledSideEffects set
which should be stronger than the mayLoad/mayStore on LOCK_OR32mi8. I think
this makes sense since we are using it as a fence.

This also seems to hide the operation from the speculative load hardening pass
so I've reverted r360511.

llvm-svn: 360747

5 years agoRevert "build: use the correct variable"
Saleem Abdulrasool [Wed, 15 May 2019 03:57:07 +0000 (03:57 +0000)]
Revert "build: use the correct variable"

This reverts commit b5a8abd57f23e2f621d5ceb0f64f1bb8f9579c3f.  This
should not be needed as the lldb-server tool will add
`LLDB_CAN_USE_LLDB_SERVER` which will never be set to true on Windows.

llvm-svn: 360745

5 years ago[lldb] [lit] Fix whitespace in matches for remaining AVX512 tests
Michal Gorny [Wed, 15 May 2019 03:32:47 +0000 (03:32 +0000)]
[lldb] [lit] Fix whitespace in matches for remaining AVX512 tests

llvm-svn: 360744

5 years agoFix 2-field llvm.global_ctors `REQUIRES: asserts` tests after rL360742
Fangrui Song [Wed, 15 May 2019 03:08:21 +0000 (03:08 +0000)]
Fix 2-field llvm.global_ctors `REQUIRES: asserts` tests after rL360742

llvm-svn: 360743

5 years ago[IR] Disallow llvm.global_ctors and llvm.global_dtors of the 2-field form in textual...
Fangrui Song [Wed, 15 May 2019 02:35:32 +0000 (02:35 +0000)]
[IR] Disallow llvm.global_ctors and llvm.global_dtors of the 2-field form in textual format

The 3-field form was introduced by D3499 in 2014 and the legacy 2-field
form was planned to be removed in LLVM 4.0

For the textual format, this patch migrates the existing 2-field form to
use the 3-field form and deletes the compatibility code.
test/Verifier/global-ctors-2.ll checks we have a friendly error message.

For bitcode, lib/IR/AutoUpgrade UpgradeGlobalVariables will upgrade the
2-field form (add i8* null as the third field).

Reviewed By: rnk, dexonsmith

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

llvm-svn: 360742

5 years ago[Target] Generalize some behavior in Thread
Alex Langford [Wed, 15 May 2019 01:46:45 +0000 (01:46 +0000)]
[Target] Generalize some behavior in Thread

Summary:
I don't think there's a good reason for this behavior to be considered
ObjC-specific. We can generalize this.

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

llvm-svn: 360741

5 years ago[NFC] Reuse a helper function to eliminate duplicate code
Philip Reames [Wed, 15 May 2019 01:39:07 +0000 (01:39 +0000)]
[NFC] Reuse a helper function to eliminate duplicate code

llvm-svn: 360740

5 years ago[analyzer] MIGChecker: Fix redundant semicolon.
Artem Dergachev [Wed, 15 May 2019 01:36:41 +0000 (01:36 +0000)]
[analyzer] MIGChecker: Fix redundant semicolon.

llvm-svn: 360739

5 years ago[XCore] Create a TargetInfo header. NFC
Richard Trieu [Wed, 15 May 2019 01:28:30 +0000 (01:28 +0000)]
[XCore] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360738

5 years ago[analyzer] MIGChecker: Add support for os_ref_retain().
Artem Dergachev [Wed, 15 May 2019 01:19:19 +0000 (01:19 +0000)]
[analyzer] MIGChecker: Add support for os_ref_retain().

Suppress MIG checker false positives that occur when the programmer increments
the reference count before calling a MIG destructor, and the MIG destructor
literally boils down to decrementing the reference count.

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

llvm-svn: 360737

5 years ago[X86] Create a TargetInfo header. NFC
Richard Trieu [Wed, 15 May 2019 01:17:58 +0000 (01:17 +0000)]
[X86] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360736

5 years ago[WebAssembly] Create a TargetInfo header. NFC
Richard Trieu [Wed, 15 May 2019 01:03:00 +0000 (01:03 +0000)]
[WebAssembly] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360735

5 years ago[SystemZ] Create a TargetInfo header. NFC
Richard Trieu [Wed, 15 May 2019 00:46:18 +0000 (00:46 +0000)]
[SystemZ] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360734

5 years ago[Sparc] Create a TargetInfo header. NFC
Richard Trieu [Wed, 15 May 2019 00:35:37 +0000 (00:35 +0000)]
[Sparc] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360733

5 years ago[RISCV] Create a TargetInfo header. NFC
Richard Trieu [Wed, 15 May 2019 00:24:15 +0000 (00:24 +0000)]
[RISCV] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360732

5 years ago[PowerPC] Create a TargetInfo header. NFC
Richard Trieu [Wed, 15 May 2019 00:09:58 +0000 (00:09 +0000)]
[PowerPC] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360731

5 years agoMake SBDebugger.RunCommandInterpreter callable from Python.
Jim Ingham [Wed, 15 May 2019 00:08:55 +0000 (00:08 +0000)]
Make SBDebugger.RunCommandInterpreter callable from Python.

Authored by: Lukas Boger

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

llvm-svn: 360730

5 years ago[NVPTX] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 23:56:18 +0000 (23:56 +0000)]
[NVPTX] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360729

5 years ago[MSP430] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 23:45:18 +0000 (23:45 +0000)]
[MSP430] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360728

5 years ago[Mips] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 23:34:37 +0000 (23:34 +0000)]
[Mips] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360727

5 years ago[Lanai] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 23:17:18 +0000 (23:17 +0000)]
[Lanai] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360726

5 years ago[lit/Register] Fix matching of the output.
Davide Italiano [Tue, 14 May 2019 23:17:12 +0000 (23:17 +0000)]
[lit/Register] Fix matching of the output.

llvm-svn: 360725

5 years ago[Hexagon] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 23:04:55 +0000 (23:04 +0000)]
[Hexagon] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360724

5 years ago[polly] Fix non-determinism in IslNodeBuilder.
Eli Friedman [Tue, 14 May 2019 23:01:19 +0000 (23:01 +0000)]
[polly] Fix non-determinism in IslNodeBuilder.

The iteration order of OutsideLoopIterations matters for
IslNodeBuilder::getReferencesInSubtree, which inserts the values from
the map into a SetVector, which is eventually used to construct the
type of the context for parallel loops.

llvm-svn: 360723

5 years ago[BPF] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 22:54:06 +0000 (22:54 +0000)]
[BPF] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360722

5 years ago[AVR] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 22:41:58 +0000 (22:41 +0000)]
[AVR] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360721

5 years agoFix bots by adding target triple to test.
Leonard Chan [Tue, 14 May 2019 22:37:34 +0000 (22:37 +0000)]
Fix bots by adding target triple to test.

llvm-svn: 360720

5 years agoUse an offset from TOS for idempotent rmw locked op lowering
Philip Reames [Tue, 14 May 2019 22:32:42 +0000 (22:32 +0000)]
Use an offset from TOS for idempotent rmw locked op lowering

This was the portion split off D58632 so that it could follow the redzone API cleanup. Note that I changed the offset preferred from -8 to -64. The difference should be very minor, but I thought it might help address one concern which had been previously raised.

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

llvm-svn: 360719

5 years ago[ARM] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 22:29:50 +0000 (22:29 +0000)]
[ARM] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360718

5 years ago[libFuzzer] replace string_view with string to fix the bots. This is NFC, just slower.
Kostya Serebryany [Tue, 14 May 2019 22:16:04 +0000 (22:16 +0000)]
[libFuzzer] replace string_view with string to fix the bots. This is NFC, just slower.

llvm-svn: 360717

5 years ago[ARC] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 22:06:04 +0000 (22:06 +0000)]
[ARC] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360716

5 years ago[libFuzzer] #include <string_view>, hopefully should fix the windows build
Kostya Serebryany [Tue, 14 May 2019 22:05:41 +0000 (22:05 +0000)]
[libFuzzer] #include <string_view>, hopefully should fix the windows build

llvm-svn: 360715

5 years ago[AMDGPU] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 21:54:37 +0000 (21:54 +0000)]
[AMDGPU] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360713

5 years ago[libFuzzer] reimplement DFT's collect_data_flow inside libFuzzer so that we don't...
Kostya Serebryany [Tue, 14 May 2019 21:47:35 +0000 (21:47 +0000)]
[libFuzzer] reimplement DFT's collect_data_flow inside libFuzzer so that we don't need external python scripts

llvm-svn: 360712

5 years ago[OpenMP][AArch64] Fix compile with LLVM trunk.
Eli Friedman [Tue, 14 May 2019 21:44:54 +0000 (21:44 +0000)]
[OpenMP][AArch64] Fix compile with LLVM trunk.

The code is currently using the ambiguous instruction
"sub sp, sp, w9, lsl #4". The ARM reference manual says this isn't
valid, and it's not clear whether it's supposed to mean uxtw or uxtx.

It doesn't matter which instruction we use here, since the high
bits of the operand are zero anyway, so I arbitrarily choose uxtw, to
preserve the register name.

See https://reviews.llvm.org/D60840 for the LLVM patch.

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

llvm-svn: 360711

5 years ago[GWP-ASan] Initial build files, implementation of PRNG [1].
Mitch Phillips [Tue, 14 May 2019 21:43:11 +0000 (21:43 +0000)]
[GWP-ASan] Initial build files, implementation of PRNG [1].

Summary:
See D60593 for further information.
This patch slices off the PRNG implementation and the initial build files for GWP-ASan.

Reviewers: vlad.tsyrklevich, morehouse, vitalybuka

Reviewed By: morehouse

Subscribers: srhines, kubamracek, mgorny, #sanitizers, llvm-commits, cryptoad, eugenis

Tags: #sanitizers, #llvm

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

llvm-svn: 360710

5 years ago[AArch64] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 21:33:53 +0000 (21:33 +0000)]
[AArch64] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360709

5 years ago[Polly] Don't crash on invalid delinearization result.
Eli Friedman [Tue, 14 May 2019 21:32:54 +0000 (21:32 +0000)]
[Polly] Don't crash on invalid delinearization result.

In certain cases, it's possible for delinearization to decide one of the
array dimensions should be some function of an induction variable inside
the scop.  Make sure if this happens, we refuse to use those dimensions
for delinearization.

Usually, we end up rejecting the scop before it actually crashes, but it
looks like it's possible to slip past other checks in certain cases
involving smax expressions.

Fixes a crash that started showing up this week on the polly AOSP
builder.  As far as I can tell, this is a longstanding issue, though;
it was just exposed by better SCEV analysis of smin expressions.

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

llvm-svn: 360708

5 years ago[NewPM] Port HWASan and Kernel HWASan
Leonard Chan [Tue, 14 May 2019 21:17:21 +0000 (21:17 +0000)]
[NewPM] Port HWASan and Kernel HWASan

Port hardware assisted address sanitizer to new PM following the same guidelines as msan and tsan.

Changes:
- Separate HWAddressSanitizer into a pass class and a sanitizer class.
- Create new PM wrapper pass for the sanitizer class.
- Use the getOrINsert pattern for some module level initialization declarations.
- Also enable kernel-kwasan in new PM
- Update llvm tests and add clang test.

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

llvm-svn: 360707

5 years ago[NFC][CodeGen][X86][AArch64] Add and-const-mask + const-shift pattern tests
Roman Lebedev [Tue, 14 May 2019 20:17:04 +0000 (20:17 +0000)]
[NFC][CodeGen][X86][AArch64] Add and-const-mask + const-shift pattern tests

Unlike instcombine, we currently don't turn and+shift into shift+and.
We probably should, likely unconditionally.

While i'm adding only all-ones (potentially shifted) mask,
this obviously isn't limited to any particular mask pattern:
https://rise4fun.com/Alive/kmX

Related to https://bugs.llvm.org/show_bug.cgi?id=41874

llvm-svn: 360706

5 years agoFix ASTMerge/namespace/test.cpp after r360701
Reid Kleckner [Tue, 14 May 2019 20:01:03 +0000 (20:01 +0000)]
Fix ASTMerge/namespace/test.cpp after r360701

llvm-svn: 360705

5 years ago[LICM] Allow AliasSetMap to contain top-level loops.
Florian Hahn [Tue, 14 May 2019 19:41:36 +0000 (19:41 +0000)]
[LICM] Allow AliasSetMap to contain top-level loops.

When an outer loop gets deleted by a different pass, before LICM visits
it, we cannot clean up its sub-loops in AliasSetMap, because at the
point we receive the deleteAnalysisLoop callback for the outer loop, the loop
object is already invalid and we cannot access its sub-loops any longer.

Reviewers: asbirlea, sanjoy, chandlerc

Reviewed By: asbirlea

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

llvm-svn: 360704

5 years agoTemporarily revert "Change -gz and -Wa,--compress-debug-sections to use gABI compress...
Eric Christopher [Tue, 14 May 2019 19:40:42 +0000 (19:40 +0000)]
Temporarily revert "Change -gz and -Wa,--compress-debug-sections to use gABI compression (SHF_COMPRESSED)"

This affects users of older (pre 2.26) binutils in such a way that they can't necessarily
work around it as it doesn't support the compress option on the command line. Reverting
to unblock them and we can revisit whether to make this change now or fix how we want
to express the option.

This reverts commit bdb21337e6e1732c9895966449c33c408336d295/r360403.

llvm-svn: 360703

5 years ago[AMDGPU][GFX8][GFX9] Corrected predicate of v_*_co_u32 aliases
Dmitry Preobrazhensky [Tue, 14 May 2019 19:16:24 +0000 (19:16 +0000)]
[AMDGPU][GFX8][GFX9] Corrected predicate of v_*_co_u32 aliases

Reviewers: rampitec, arsenm

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

llvm-svn: 360702

5 years agoUpdate ASTMerge FileCheck test expectations
Reid Kleckner [Tue, 14 May 2019 19:02:39 +0000 (19:02 +0000)]
Update ASTMerge FileCheck test expectations

I belive many of these diagnostics changed from errors to warnings in
r357394. I've simply mechanically updated the tests, but whoever owns
this code should probably audit for unintented behavior changes. I
wasn't able to find a flag to make these warnings errors again.

llvm-svn: 360701

5 years ago[LVI][CVP] Add support for abs/nabs select pattern flavor
Nikita Popov [Tue, 14 May 2019 18:53:47 +0000 (18:53 +0000)]
[LVI][CVP] Add support for abs/nabs select pattern flavor

Based on ConstantRange support added in D61084, we can now handle
abs and nabs select pattern flavors in LVI.

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

llvm-svn: 360700

5 years agoRestore test files accidentally deleted in r354839
Reid Kleckner [Tue, 14 May 2019 18:51:07 +0000 (18:51 +0000)]
Restore test files accidentally deleted in r354839

I think there must be a bug in git-llvm causing parent directories to be
deleted when the diff deletes files in a subdirectory. Perhaps it is
Windows-only.

There has been a behavior change, so some of these tests now fail. I
have marked them XFAIL and will fix them in a follow-up to separate the
changes.

llvm-svn: 360699

5 years ago[clang-tidy] Fix invalid fixit for readability-static-accessed-through-instance ...
Matthias Gehre [Tue, 14 May 2019 18:23:10 +0000 (18:23 +0000)]
[clang-tidy] Fix invalid fixit for readability-static-accessed-through-instance (bug 40544)

Summary:
Fixed https://bugs.llvm.org/show_bug.cgi?id=40544
Before, we would generate a fixit like `(anonymous namespace)::Foo::fun();` for
the added test case.

Reviewers: aaron.ballman, alexfh, xazax.hun

Subscribers: rnkovacs, cfe-commits

Tags: #clang, #clang-tools-extra

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

llvm-svn: 360698

5 years ago[MemorySSA] LoopSimplify preserves MemorySSA only when flag is flipped.
Alina Sbirlea [Tue, 14 May 2019 18:07:18 +0000 (18:07 +0000)]
[MemorySSA] LoopSimplify preserves MemorySSA only when flag is flipped.

LoopSimplify can preserve MemorySSA after r360270.
But the MemorySSA analysis is retrieved and preserved only when the
EnableMSSALoopDependency is set to true. Use the same conditional to
mark the pass as preserved, otherwise subsequent passes will get an
invalid analysis.
Resolves PR41853.

llvm-svn: 360697

5 years agoFix a release mode warning introduced in r360694
Philip Reames [Tue, 14 May 2019 17:50:06 +0000 (17:50 +0000)]
Fix a release mode warning introduced in r360694

llvm-svn: 360696

5 years agobuild: use the correct variable
Saleem Abdulrasool [Tue, 14 May 2019 17:24:45 +0000 (17:24 +0000)]
build: use the correct variable

Adjust the variable that controls whether the unit tests use `lldb-server`.
This should repair the default build on Windows.

llvm-svn: 360695

5 years ago[IndVars] Extend reasoning about loop invariant exits to non-header blocks
Philip Reames [Tue, 14 May 2019 17:20:10 +0000 (17:20 +0000)]
[IndVars] Extend reasoning about loop invariant exits to non-header blocks

Noticed while glancing through the code for other reasons.  The extension is trivial enough, decided to just do it.

llvm-svn: 360694

5 years agolldb-server: rename `llgs::terminate` (NFC)
Saleem Abdulrasool [Tue, 14 May 2019 17:07:36 +0000 (17:07 +0000)]
lldb-server: rename `llgs::terminate` (NFC)

`terminate` overlaps with a C function on Windows:

```
D:\a\1\s\lldb\tools\lldb-server\lldb-server.cpp(45,13):  warning: 'terminate' redeclared without 'dllimport' attribute: 'dllexport' attribute added [-Winconsistent-dllimport]
static void terminate() { g_debugger_lifetime->Terminate(); }
            ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\corecrt_terminate.h(29,48):  note: previous declaration is here
    _ACRTIMP __declspec(noreturn) void __cdecl terminate() throw();
                                               ^
D:\a\1\s\lldb\tools\lldb-server\lldb-server.cpp(45,61):  warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
static void terminate() { g_debugger_lifetime->Terminate(); }
                                                            ^
```

Rename the function to `terminate_debugger` to avoid the errant match.

llvm-svn: 360693

5 years agoSupport FNeg in SpeculativeExecution pass
Cameron McInally [Tue, 14 May 2019 16:51:18 +0000 (16:51 +0000)]
Support FNeg in SpeculativeExecution pass

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

llvm-svn: 360692

5 years agoRename MacOS X -> macOS where applicable.
Adrian Prantl [Tue, 14 May 2019 16:37:43 +0000 (16:37 +0000)]
Rename MacOS X -> macOS where applicable.

llvm-svn: 360691

5 years ago[Test] Autogen a test for ease of later changing
Philip Reames [Tue, 14 May 2019 16:37:29 +0000 (16:37 +0000)]
[Test] Autogen a test for ease of later changing

llvm-svn: 360690

5 years ago[AMDGPU] Fixed handling of imemdiate i1 literals
Stanislav Mekhanoshin [Tue, 14 May 2019 16:18:00 +0000 (16:18 +0000)]
[AMDGPU] Fixed handling of imemdiate i1 literals

This bug was exposed by the rL360395.

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

llvm-svn: 360689

5 years ago[AMDGPU] Fixed +DumpCode
Tim Renouf [Tue, 14 May 2019 16:17:14 +0000 (16:17 +0000)]
[AMDGPU] Fixed +DumpCode

The +DumpCode attribute is a horrible hack in AMDGPU to embed the
disassembly of the generated code into the elf file. It is used by LLPC
to implement an extension that allows the application to read back the
disassembly of the code. Longer term, we should re-implement that by
using the LLVM disassembler from the Vulkan driver.

Recent LLVM changes broke +DumpCode. With -filetype=asm it crashed, and
with -filetype=obj I think it did not include any instructions, only the
labels. Fixed with this commit: now it has no effect with -filetype=asm,
and works as intended with -filetype=obj.

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

Change-Id: I6436d86fe2ea220d74a643a85e64753747c9366b
llvm-svn: 360688