platform/upstream/llvm.git
7 years agoRevert "Revert "Revert "Replace trivial use of external rc.exe by writing our own...
Eric Beckmann [Wed, 5 Jul 2017 23:45:50 +0000 (23:45 +0000)]
Revert "Revert "Revert "Replace trivial use of external rc.exe by writing our own .res file."""

This reverts commit 5fecbbbe5049665d86834cf69d8f75db4f392308.

The initial revert was done in order to prevent ongoing errors on
chromium bots such as CrWinClangLLD.  However, this was done haphazardly
and I didn't realize there were test and compilation failures, so this
revert was reverted.  Now that those have been fixed, we can revert the
revert of the revert.

llvm-svn: 307226

7 years agoMove fabricateDefaultCommands earlier.
Rafael Espindola [Wed, 5 Jul 2017 23:36:24 +0000 (23:36 +0000)]
Move fabricateDefaultCommands earlier.

It is now just after the OutputSections are created, which is as early
as it can possibly go.

llvm-svn: 307225

7 years ago[IR] Use CmpInst::isFPPredicate/isIntPredicate in a few other places. NFC
Craig Topper [Wed, 5 Jul 2017 23:35:46 +0000 (23:35 +0000)]
[IR] Use CmpInst::isFPPredicate/isIntPredicate in a few other places. NFC

llvm-svn: 307224

7 years agoRemove dummy cast.
Rafael Espindola [Wed, 5 Jul 2017 23:16:38 +0000 (23:16 +0000)]
Remove dummy cast.

llvm-svn: 307220

7 years agoUse Entry::SecSize in a couple of cases.
Rafael Espindola [Wed, 5 Jul 2017 23:06:59 +0000 (23:06 +0000)]
Use Entry::SecSize in a couple of cases.

This avoids having to compute relocation section sizes early, removing
the last use of assignOffsets.

llvm-svn: 307219

7 years agoSuppress -Waligned-allocation-unavailable warning in libc++ test suite
Eric Fiselier [Wed, 5 Jul 2017 22:40:58 +0000 (22:40 +0000)]
Suppress -Waligned-allocation-unavailable warning in libc++ test suite

llvm-svn: 307218

7 years agoSimplify. NFC.
Rafael Espindola [Wed, 5 Jul 2017 22:30:04 +0000 (22:30 +0000)]
Simplify. NFC.

llvm-svn: 307217

7 years ago[GlobalOpt] Remove unreachable blocks before optimizing a function.
Davide Italiano [Wed, 5 Jul 2017 22:28:28 +0000 (22:28 +0000)]
[GlobalOpt] Remove unreachable blocks before optimizing a function.

LLVM's definition of dominance allows instructions that are cyclic
in unreachable blocks, e.g.:

  %pat = select i1 %condition, @global, i16* %pat

because any instruction dominates an instruction in a block that's
not reachable from entry.
So, remove unreachable blocks from the function, because a) there's
no point in analyzing them and b) GlobalOpt should otherwise grow
some more complicated logic to break these cycles.

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

llvm-svn: 307215

7 years agoRemove a function that is now trivial.
Rafael Espindola [Wed, 5 Jul 2017 22:25:38 +0000 (22:25 +0000)]
Remove a function that is now trivial.

llvm-svn: 307214

7 years ago[tsan] Use pthread_sigmask instead of sigprocmask to block signals in a thread on...
Kuba Mracek [Wed, 5 Jul 2017 22:17:44 +0000 (22:17 +0000)]
[tsan] Use pthread_sigmask instead of sigprocmask to block signals in a thread on Darwin

On Darwin, sigprocmask changes the signal mask for the entire process. This has some unwanted consequences, because e.g. internal_start_thread wants to disable signals only in the current thread (to make the new thread inherit the signal mask), which is currently broken on Darwin. This patch switches to pthread_sigmask.

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

llvm-svn: 307212

7 years agoUsing existing variable. NFC.
Rafael Espindola [Wed, 5 Jul 2017 22:15:58 +0000 (22:15 +0000)]
Using existing variable. NFC.

llvm-svn: 307211

7 years ago[IR] Use CmpInst::isIntPredicate()/isFPPredicate in some asserts instead of doing...
Craig Topper [Wed, 5 Jul 2017 22:09:00 +0000 (22:09 +0000)]
[IR] Use CmpInst::isIntPredicate()/isFPPredicate in some asserts instead of doing the equivalent range check. NFC

llvm-svn: 307210

7 years agoRemove two dummy casts. NFC.
Rafael Espindola [Wed, 5 Jul 2017 22:07:20 +0000 (22:07 +0000)]
Remove two dummy casts. NFC.

llvm-svn: 307209

7 years agoFix libcall expansion creating DAG nodes with invalid type post type legalization.
Vadim Chugunov [Wed, 5 Jul 2017 22:01:49 +0000 (22:01 +0000)]
Fix libcall expansion creating DAG nodes with invalid type post type legalization.

If we are lowering a libcall after legalization, we'll split the return type into a pair of legal values.

Patch by Jatin Bhateja and Eli Friedman.

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

llvm-svn: 307207

7 years agoFix wrong website in messages
Jonathan Peyton [Wed, 5 Jul 2017 22:01:05 +0000 (22:01 +0000)]
Fix wrong website in messages

Address user message bug where the messages were sending users to Intel's
website instead of the LLVM OpenMP runtime websites.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=32892

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

llvm-svn: 307206

7 years agoFix std::min ambiguity between uint32 and size_t.
Zachary Turner [Wed, 5 Jul 2017 21:59:20 +0000 (21:59 +0000)]
Fix std::min ambiguity between uint32 and size_t.

llvm-svn: 307205

7 years ago[llvm-pdbutil] Add the ability to truncate stream purpose names.
Zachary Turner [Wed, 5 Jul 2017 21:54:58 +0000 (21:54 +0000)]
[llvm-pdbutil] Add the ability to truncate stream purpose names.

This will be useful for aligning fields to a fixed with in
subsequent patches.

llvm-svn: 307204

7 years ago[DependenceAnalysis] Make sure base objects are the same when comparing GEPs
Brendon Cahoon [Wed, 5 Jul 2017 21:35:47 +0000 (21:35 +0000)]
[DependenceAnalysis] Make sure base objects are the same when comparing GEPs

The dependence analysis was returning incorrect information when using the GEPs
to compute dependences. The analysis uses the GEP indices under certain
conditions, but was doing it incorrectly when the base objects of the GEP are
aliases, but pointing to different locations in the same array.

This patch adds another check for the base objects. If the base pointer SCEVs
are not equal, then the dependence analysis should fall back on the path
that uses the whole SCEV for the dependence check. This fixes PR33567.

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

llvm-svn: 307203

7 years agoFix test case in pre-C++11 mode; address Aaron Ballman's code review.
Douglas Gregor [Wed, 5 Jul 2017 21:12:37 +0000 (21:12 +0000)]
Fix test case in pre-C++11 mode; address Aaron Ballman's code review.

llvm-svn: 307202

7 years agoFix one more reference to lit.util.capture()
Michael Zolotukhin [Wed, 5 Jul 2017 21:06:11 +0000 (21:06 +0000)]
Fix one more reference to lit.util.capture()

The capture method was removed in r306643.

llvm-svn: 307201

7 years agoAdded more info on silent master to the doc.
Galina Kistanova [Wed, 5 Jul 2017 20:45:44 +0000 (20:45 +0000)]
Added more info on silent master to the doc.

llvm-svn: 307200

7 years ago[InstCombine] Use CmpInst::Predicate with m_Cmp instead of ICmpInst::Predicate. NFC
Craig Topper [Wed, 5 Jul 2017 20:31:00 +0000 (20:31 +0000)]
[InstCombine] Use CmpInst::Predicate with m_Cmp instead of ICmpInst::Predicate. NFC

There isn't really an ICmpInst version so we're just accessing the CmpInst version through inheritance.

llvm-svn: 307199

7 years ago[WebAssembly] Fix types for address taken functions
Sam Clegg [Wed, 5 Jul 2017 20:25:08 +0000 (20:25 +0000)]
[WebAssembly] Fix types for address taken functions

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

llvm-svn: 307198

7 years agoCope with Range-v3's CONCEPT_REQUIRES idiom
Douglas Gregor [Wed, 5 Jul 2017 20:20:15 +0000 (20:20 +0000)]
Cope with Range-v3's CONCEPT_REQUIRES idiom

llvm-svn: 307197

7 years agoCustomize the SFINAE diagnostics for enable_if to provide the failed condition.
Douglas Gregor [Wed, 5 Jul 2017 20:20:14 +0000 (20:20 +0000)]
Customize the SFINAE diagnostics for enable_if to provide the failed condition.

When enable_if disables a particular overload resolution candidate,
rummage through the enable_if condition to find the specific condition
that caused the failure. For example, if we have something like:

    template<
      typename Iter,
      typename = std::enable_if_t<Random_access_iterator<Iter> &&
                                  Comparable<Iterator_value_type<Iter>>>>
    void mysort(Iter first, Iter last) {}

and we call "mysort" with "std::list<int>" iterators, we'll get a
diagnostic saying that the "Random_access_iterator<Iter>" requirement
failed. If we call "mysort" with
"std::vector<something_not_comparable>", we'll get a diagnostic saying
that the "Comparable<...>" requirement failed.

llvm-svn: 307196

7 years ago[tablegen] Avoid creating temporary strings
Alexander Shaposhnikov [Wed, 5 Jul 2017 20:14:54 +0000 (20:14 +0000)]
[tablegen] Avoid creating temporary strings

If a method / function returns a StringRef but the
variable is of type const std::string& a temporary string is
created (StringRef has a cast operator to std::string),
which is a suboptimal behavior.

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

Test plan: make check-all

llvm-svn: 307195

7 years ago[WebAssembly] MC: Don't generate extra types for weak alias
Sam Clegg [Wed, 5 Jul 2017 20:09:26 +0000 (20:09 +0000)]
[WebAssembly] MC: Don't generate extra types for weak alias

Previously we were generating a void(void) function type
for a weak alias.  Update the weak-alias test case to
catch this.

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

llvm-svn: 307194

7 years agoAdd docs for -foptimization-record-file=
Brian Gesiak [Wed, 5 Jul 2017 19:55:51 +0000 (19:55 +0000)]
Add docs for -foptimization-record-file=

Summary: The Clang option was previously not included in the User's Manual.

Reviewers: anemet, davidxl, hfinkel

Reviewed By: hfinkel

Subscribers: cfe-commits

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

llvm-svn: 307193

7 years agoAdd a test for relocation addend on mips.
Rafael Espindola [Wed, 5 Jul 2017 19:31:07 +0000 (19:31 +0000)]
Add a test for relocation addend on mips.

An lld test found a bug in a llvm patch I am working on. It is better
to have test coverage for that in llvm too.

llvm-svn: 307192

7 years agoRevert "Revert "Replace trivial use of external rc.exe by writing our own .res file.""
Eric Beckmann [Wed, 5 Jul 2017 19:04:48 +0000 (19:04 +0000)]
Revert "Revert "Replace trivial use of external rc.exe by writing our own .res file.""

This reverts commit 8c8dce3b8f15d6ebaefc35ce88f15a85c8cdbd6e.

llvm-svn: 307191

7 years agoRevert "Revert "Switch external cvtres.exe for llvm's own resource library.""
Eric Beckmann [Wed, 5 Jul 2017 19:04:33 +0000 (19:04 +0000)]
Revert "Revert "Switch external cvtres.exe for llvm's own resource library.""

This reverts commit 165e578e47f1cd38191120aad23a9020fb5476dd.

Forgot to run tests on this.

llvm-svn: 307190

7 years agoRevert "Switch external cvtres.exe for llvm's own resource library."
Eric Beckmann [Wed, 5 Jul 2017 18:59:16 +0000 (18:59 +0000)]
Revert "Switch external cvtres.exe for llvm's own resource library."

This reverts commit 600d52c278e123dd08bee24c1f00932b55add8de.

This patch still seems to break CrWinClangLLD, reverting until I can
find root problem.

llvm-svn: 307189

7 years agoRevert "Replace trivial use of external rc.exe by writing our own .res file."
Eric Beckmann [Wed, 5 Jul 2017 18:59:01 +0000 (18:59 +0000)]
Revert "Replace trivial use of external rc.exe by writing our own .res file."

This patch still seems to break CrWinClangLLD, reverting this once more
until I can discover root problem.

This reverts commit 3dbbc8ce43be50ffde2b1c655c6d3a25796fe78b.

llvm-svn: 307188

7 years ago[PDB] Add a test that verifies every known type record.
Zachary Turner [Wed, 5 Jul 2017 18:43:25 +0000 (18:43 +0000)]
[PDB] Add a test that verifies every known type record.

We had a lot of one-off tests for this type and that type,
or "every type that happens to be generated by this program
I built".  Eventually I got a bug report filed where we were
crashing on a type that was not covered by any of these tests.
So this test carefully constructs a minimal C++ program that
will cause every type we support to be emitted.  This ensures
full coverage for type records.

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

llvm-svn: 307187

7 years ago[AMDGPU] Move GISel accessor initialization from TargetMachine to Subtarget.
Quentin Colombet [Wed, 5 Jul 2017 18:40:56 +0000 (18:40 +0000)]
[AMDGPU] Move GISel accessor initialization from TargetMachine to Subtarget.

NFC

llvm-svn: 307186

7 years ago[Power9] Disable removing extra swaps on P9.
Sean Fertile [Wed, 5 Jul 2017 18:37:10 +0000 (18:37 +0000)]
[Power9] Disable removing extra swaps on P9.

On power 8 we sometimes insert swaps to deal with the difference between
Little-Endian and Big-Endian. The swap removal pass is supposed to clean up
these swaps. On power 9 we don't need this pass since we do not need to insert
the swaps in the first place.

Commiting on behalf of Stefan Pintilie.
Differential Revision: https://reviews.llvm.org/D34627

llvm-svn: 307185

7 years ago{DAGCombiner] Fold (rot x, 0) -> x
Simon Pilgrim [Wed, 5 Jul 2017 18:27:11 +0000 (18:27 +0000)]
{DAGCombiner] Fold (rot x, 0) -> x

llvm-svn: 307184

7 years ago[X86] Test bitfield loadstore tests on i686 as well
Simon Pilgrim [Wed, 5 Jul 2017 18:09:30 +0000 (18:09 +0000)]
[X86] Test bitfield loadstore tests on i686 as well

llvm-svn: 307182

7 years ago[PowerPC] Make sure that we remove dead PHI nodes after the PPCCTRLoops pass.
Sean Fertile [Wed, 5 Jul 2017 17:57:57 +0000 (17:57 +0000)]
[PowerPC] Make sure that we remove dead PHI nodes after the PPCCTRLoops pass.

Commiting on behalf of Stefan Pintilie.
Differential Revision: https://reviews.llvm.org/D34829

llvm-svn: 307180

7 years ago[DAGCombiner] visitRotate patch to optimize pair of ROTR/ROTL instructions into one...
Andrew Zhogin [Wed, 5 Jul 2017 17:55:42 +0000 (17:55 +0000)]
[DAGCombiner] visitRotate patch to optimize pair of ROTR/ROTL instructions into one with combined shift operand.

For two ROTR operations with shifts C1, C2; combined shift operand will be (C1 + C2) % bitsize.

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

llvm-svn: 307179

7 years agoMerge createOrphanCommands into addOrphanSections.
Rafael Espindola [Wed, 5 Jul 2017 17:50:43 +0000 (17:50 +0000)]
Merge createOrphanCommands into addOrphanSections.

This is a bit simpler and avoids a walk over OutputSections.

llvm-svn: 307178

7 years ago[X86][SSE] Dropped -mcpu from bitcast+setcc mask tests
Simon Pilgrim [Wed, 5 Jul 2017 17:30:30 +0000 (17:30 +0000)]
[X86][SSE] Dropped -mcpu from bitcast+setcc mask tests

Use triple and attribute only for consistency

llvm-svn: 307176

7 years ago[Sema] Don't allow -Wunguarded-availability to be silenced with redecls
Erik Pilkington [Wed, 5 Jul 2017 17:08:56 +0000 (17:08 +0000)]
[Sema] Don't allow -Wunguarded-availability to be silenced with redecls

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

llvm-svn: 307175

7 years ago[Power9] Exploit vector extract with variable index.
Tony Jiang [Wed, 5 Jul 2017 16:55:00 +0000 (16:55 +0000)]
[Power9] Exploit vector extract with variable index.

This patch adds the exploitation for new power 9 instructions which extract
variable elements from vectors:
VEXTUBLX
VEXTUBRX
VEXTUHLX
VEXTUHRX
VEXTUWLX
VEXTUWRX

Differential Revision: https://reviews.llvm.org/D34032
Commit on behalf of Zaara Syeda (syzaara@ca.ibm.com)

llvm-svn: 307174

7 years agoPrefix the name of the calling host function in the name of callee GPU kernel
Singapuram Sanjay Srivallabh [Wed, 5 Jul 2017 16:48:21 +0000 (16:48 +0000)]
Prefix the name of the calling host function in the name of callee GPU kernel

Summary:
Provide more context to the name of a GPU kernel by prefixing its name with the host function that calls it. E.g. The first kernel called by `gemm` would be `FUNC_gemm_KERNEL_0`.

Kernels currently follow the "kernel_#" (# = 0,1,2,3,...) nomenclature. This patch makes it easier to map host caller and device callee, especially when there are many kernels produced by Polly-ACC.

Reviewers: grosser, Meinersbur, bollu, philip.pfaffe, kbarton!

Reviewed By: grosser

Subscribers: nemanjai, pollydev

Tags: #polly

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

llvm-svn: 307173

7 years agoAddress comments that escaped D33333
Erich Keane [Wed, 5 Jul 2017 16:43:45 +0000 (16:43 +0000)]
Address comments that escaped D33333

Patch By: Jen Yu

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

llvm-svn: 307172

7 years agoFix a bug in regex_Iterator where it would report zero-length matches forever. Report...
Marshall Clow [Wed, 5 Jul 2017 16:37:19 +0000 (16:37 +0000)]
Fix a bug in regex_Iterator where it would report zero-length matches forever. Reported as llvm.org/PR33681. Thanks to Karen Arutyunov for the report.

llvm-svn: 307171

7 years ago[lldb] Add a testcase for MainThreadCheckerRuntime plugin
Kuba Mracek [Wed, 5 Jul 2017 16:29:36 +0000 (16:29 +0000)]
[lldb] Add a testcase for MainThreadCheckerRuntime plugin

This adds a simple testcase for MainThreadCheckerRuntime. The tool (Main Thread Checker) is only available on Darwin, so the test also detects the presence of libMainThreadChecker.dylib and is skipped if the tool is not available.

llvm-svn: 307170

7 years ago[Power9] Exploit vector integer extend instructions when indices aren't correct.
Tony Jiang [Wed, 5 Jul 2017 16:00:38 +0000 (16:00 +0000)]
[Power9] Exploit vector integer extend instructions when indices aren't correct.

This patch adds on to the exploitation added by https://reviews.llvm.org/D33510.
This now catches build vector nodes where the inputs are coming from sign
extended vector extract elements where the indices used by the vector extract
are not correct. We can still use the new hardware instructions by adding a
shuffle to move the elements to the correct indices. I introduced a new PPCISD
node here because adding a vector_shuffle and changing the elements of the
vector_extracts was getting undone by another DAG combine.

Commit on behalf of Zaara Syeda (syzaara@ca.ibm.com)
Differential Revision: https://reviews.llvm.org/D34009

llvm-svn: 307169

7 years ago[globalisel][tablegen] Fix another unused variable warning introduced by r307159
Daniel Sanders [Wed, 5 Jul 2017 15:34:16 +0000 (15:34 +0000)]
[globalisel][tablegen] Fix another unused variable warning introduced by r307159

llvm-svn: 307168

7 years agoUse LoadedObjectInfoHelper to simplify/delegate the implementation of 'clone'
David Blaikie [Wed, 5 Jul 2017 15:24:42 +0000 (15:24 +0000)]
Use LoadedObjectInfoHelper to simplify/delegate the implementation of 'clone'

llvm-svn: 307167

7 years agoDebugInfo: Generalize LoadedObjectInfoHelper from RuntimeDyld
David Blaikie [Wed, 5 Jul 2017 15:23:56 +0000 (15:23 +0000)]
DebugInfo: Generalize LoadedObjectInfoHelper from RuntimeDyld

Make it usable by any class derived (even indirectly) from
LoadedObjectInfo by allowing a custom base class to be specified and
perfect forwarding to the ctor.

llvm-svn: 307166

7 years ago[NFC] Fix breaking build by adding REQUIRES: pollyacc
Siddharth Bhat [Wed, 5 Jul 2017 15:20:28 +0000 (15:20 +0000)]
[NFC] Fix breaking build by adding REQUIRES: pollyacc

llvm-svn: 307165

7 years ago[NFC] [ScopInfo] fix warning about construction order
Siddharth Bhat [Wed, 5 Jul 2017 15:07:28 +0000 (15:07 +0000)]
[NFC] [ScopInfo] fix warning about construction order

llvm-svn: 307164

7 years ago[PPCGCodeGeneration] Teach Polly to start using live range reordering.
Siddharth Bhat [Wed, 5 Jul 2017 14:57:04 +0000 (14:57 +0000)]
[PPCGCodeGeneration] Teach Polly to start using live range reordering.

Polly did not use PPCG's live range reordering feature. Teach
PPCGCodeGeneration to use this.

Documentation on this is sparse, so much of the code is conservative.

We currently kill all phi nodes in a Scop by appending them to the
must_kill map we pass to PPCG. I do not have a proof of correctness,
but it seems to be intuitively correct.

We also do not handle `array_order`, which, quoting PPCG, is:
PPCG/gpu.h: "Order dependences on non-scalars."
It seems to consist of RAW dependences between arrays. We need to
pass this information for more complex privatization cases.

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

llvm-svn: 307163

7 years ago[ELF] Fix nullptr dereference when creating an error message for a synthetic section.
Sean Eveson [Wed, 5 Jul 2017 14:55:43 +0000 (14:55 +0000)]
[ELF] Fix nullptr dereference when creating an error message for a synthetic section.

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

llvm-svn: 307162

7 years agoFix assorted compiler warnings (mismatched signedness and printf specifiers)
Pavel Labath [Wed, 5 Jul 2017 14:54:46 +0000 (14:54 +0000)]
Fix assorted compiler warnings (mismatched signedness and printf specifiers)

llvm-svn: 307161

7 years agoFix "process load" on new android targets
Pavel Labath [Wed, 5 Jul 2017 14:54:41 +0000 (14:54 +0000)]
Fix "process load" on new android targets

Summary:
On older android targets, we needed a dlopen rename workaround to get
"process load" working. Since API 26 this is not required as the targets
have a proper libdl so with the function names one would expect.

To make this work I've had to remove the const qualifier from the
GetLibdlFunctionDeclarations function (as now the declarations can
depend on the connected target). Since I was already modifying the
prototype (and the lower levels were already converted to StringRef) I
took the oportunity to convert this function as well.

llvm-svn: 307160

7 years ago[globalisel][tablegen] Finish fixing compile-time regressions by merging the matcher...
Daniel Sanders [Wed, 5 Jul 2017 14:50:18 +0000 (14:50 +0000)]
[globalisel][tablegen] Finish fixing compile-time regressions by merging the matcher and emitter state machines.

Summary:
Also, made a few minor tweaks to shave off a little more cumulative memory consumption:
* All rules share a single NewMIs instead of constructing their own. Only one
  will end up using it.
* Use MIs.resize(1) instead of MIs.clear();MIs.push_back(I) and prevent
  GIM_RecordInsn from changing MIs[0].

Depends on D33764

Reviewers: rovka, vitalybuka, ab, t.p.northover, qcolombet, aditya_nandakumar

Reviewed By: ab

Subscribers: kristof.beyls, igorb, llvm-commits

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

llvm-svn: 307159

7 years ago[SLPVectorizer] Add an extra parameter to cancelScheduling function, NFCI.
Dinar Temirbulatov [Wed, 5 Jul 2017 13:53:03 +0000 (13:53 +0000)]
[SLPVectorizer] Add an extra parameter to cancelScheduling function, NFCI.

llvm-svn: 307158

7 years ago[IndVarSimplify] Add AShr exact flags using induction variables ranges.
David Green [Wed, 5 Jul 2017 13:25:58 +0000 (13:25 +0000)]
[IndVarSimplify] Add AShr exact flags using induction variables ranges.

This adds exact flags to AShr/LShr flags where we can statically
prove it is valid using the range of induction variables. This
allows further optimisations to remove extra loads.

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

llvm-svn: 307157

7 years ago[SystemZ] Simplify handling of ISA revisions
Ulrich Weigand [Wed, 5 Jul 2017 13:19:47 +0000 (13:19 +0000)]
[SystemZ] Simplify handling of ISA revisions

This moves determination of the ISA revision from the CPU name to
one single place, removing a bunch of duplicated code.  It also
makes the supported ISA revisions available as feature strings.

No functional change.

llvm-svn: 307156

7 years ago[SystemZ] Simplify handling of 128-bit multiply/divide instruction
Ulrich Weigand [Wed, 5 Jul 2017 13:17:31 +0000 (13:17 +0000)]
[SystemZ] Simplify handling of 128-bit multiply/divide instruction

Several integer multiply/divide instructions require use of a
register pair as input and output.  This patch moves setting
up the input register pair from C++ code to TableGen, simplifying
the whole process and making it more easily extensible.

No functional change.

llvm-svn: 307155

7 years ago[SystemZ] Small cleanups to SystemZScheduleZ13.td
Ulrich Weigand [Wed, 5 Jul 2017 13:14:43 +0000 (13:14 +0000)]
[SystemZ] Small cleanups to SystemZScheduleZ13.td

Fixes a couple of whitespace errors, re-sorts the vector floating-point
instructions to make them more easily extensible, and adds a missing
pseudo instruction.

No functional change.

llvm-svn: 307154

7 years ago[Hexagon] Preclude non-memory test from being optimized away. NFC.
Nirav Dave [Wed, 5 Jul 2017 13:08:03 +0000 (13:08 +0000)]
[Hexagon] Preclude non-memory test from being optimized away. NFC.

llvm-svn: 307153

7 years ago[driver][mips] Use AddTargetFeature to check arguments and add feature flags. NFC
Simon Atanasyan [Wed, 5 Jul 2017 12:57:37 +0000 (12:57 +0000)]
[driver][mips] Use AddTargetFeature to check arguments and add feature flags. NFC

llvm-svn: 307152

7 years ago[driver][mips] Remove redundant curly brackets. NFC
Simon Atanasyan [Wed, 5 Jul 2017 12:57:32 +0000 (12:57 +0000)]
[driver][mips] Remove redundant curly brackets. NFC

llvm-svn: 307151

7 years agoCMake: Add LLVM_UTILS_INSTALL_DIR option
Tom Stellard [Wed, 5 Jul 2017 12:57:30 +0000 (12:57 +0000)]
CMake: Add LLVM_UTILS_INSTALL_DIR option

Summary:
This is like the LLVM_TOOLS_INSTALL_DIR option, but for the utils
that are installed when the LLVM_INSTALL_UTILS.  This option
defaults to 'bin' to remain consistent with the current behavior, but
distros may want to install these to libexec/llvm.

Reviewers: beanz

Reviewed By: beanz

Subscribers: llvm-commits, mgorny

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

llvm-svn: 307150

7 years ago[GlobalISel] Refactor Legalizer helpers for libcalls
Diana Picus [Wed, 5 Jul 2017 12:57:24 +0000 (12:57 +0000)]
[GlobalISel] Refactor Legalizer helpers for libcalls

We used to have a helper that replaced an instruction with a libcall.
That turns out to be too aggressive, since sometimes we need to replace
the instruction with at least two libcalls. Therefore, change our
existing helper to only create the libcall and leave the instruction
removal as a separate step. Also rename the helper accordingly.

llvm-svn: 307149

7 years ago[AsmParser] Mnemonic Spell Corrector
Sjoerd Meijer [Wed, 5 Jul 2017 12:39:13 +0000 (12:39 +0000)]
[AsmParser] Mnemonic Spell Corrector

This implements suggesting other mnemonics when an invalid one is specified,
for example:

$ echo "adXd r1,r2,#3" | llvm-mc -triple arm
<stdin>:1:1: error: invalid instruction, did you mean: add, qadd?
adXd r1,r2,#3
^

The implementation is target agnostic, but as a first step I have added it only
to the ARM backend; so the ARM backend is a good example if someone wants to
enable this too for another target.

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

llvm-svn: 307148

7 years ago[clang-format] Fix an uninitialized memory access
Krasimir Georgiev [Wed, 5 Jul 2017 12:24:01 +0000 (12:24 +0000)]
[clang-format] Fix an uninitialized memory access

llvm-svn: 307147

7 years ago[globalisel][tablegen] Fix the misuse of STATISTICS() on release builds (like r307088...
Daniel Sanders [Wed, 5 Jul 2017 12:14:18 +0000 (12:14 +0000)]
[globalisel][tablegen] Fix the misuse of STATISTICS() on release builds (like r307088) after r307133.

r307133 brought back a couple instances of the same mistake that was already
fixed by r307088. Fixed it again.

Using NumPatternEmitted as a unique id for the tables is not valid on release
builds since the counters don't count in that case.

llvm-svn: 307146

7 years ago[ARM] GlobalISel: Extract tiny helper. NFC
Diana Picus [Wed, 5 Jul 2017 11:53:51 +0000 (11:53 +0000)]
[ARM] GlobalISel: Extract tiny helper. NFC

Extract functionality for determining if the target uses AEABI.

llvm-svn: 307145

7 years ago[MachineIRBuilder] Fix formatting. NFC.
Diana Picus [Wed, 5 Jul 2017 11:47:23 +0000 (11:47 +0000)]
[MachineIRBuilder] Fix formatting. NFC.

llvm-svn: 307144

7 years agoAdd const to reference arguments of Diagnostic ctor
Alexander Kornienko [Wed, 5 Jul 2017 11:45:09 +0000 (11:45 +0000)]
Add const to reference arguments of Diagnostic ctor

llvm-svn: 307143

7 years ago[GlobalISel][X86] For now don't handle not trivial function arguments lowering.
Igor Breger [Wed, 5 Jul 2017 11:40:35 +0000 (11:40 +0000)]
[GlobalISel][X86] For now don't handle not trivial function arguments lowering.

llvm-svn: 307142

7 years ago[MachineIRBuilder] Add buildOr helper. NFC.
Diana Picus [Wed, 5 Jul 2017 11:32:12 +0000 (11:32 +0000)]
[MachineIRBuilder] Add buildOr helper. NFC.

This isn't used anywhere yet, but I need it for a future commit.

llvm-svn: 307141

7 years ago[GlobalIsel] allow x86_fp80 values to be dumped.
Igor Breger [Wed, 5 Jul 2017 11:11:10 +0000 (11:11 +0000)]
[GlobalIsel] allow x86_fp80 values to be dumped.

Summary:
Otherwise the fallback path fails with an assertion on x86_64 targets,
when "x86_fp80" is encountered.

Reviewers: t.p.northover, zvi, guyblank

Reviewed By: zvi

Subscribers: rovka, kristof.beyls, llvm-commits

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

llvm-svn: 307140

7 years ago[MachineIRBuilder] Add buildBinaryOp helper. NFC
Diana Picus [Wed, 5 Jul 2017 11:02:31 +0000 (11:02 +0000)]
[MachineIRBuilder] Add buildBinaryOp helper. NFC

Add a helper for building simple binary ops like add, mul, sub, and.
This can be used in the future for quickly adding support for or, xor.

llvm-svn: 307139

7 years ago[globalisel][tablegen] Fix an unused variable warning in release builds after r307133
Daniel Sanders [Wed, 5 Jul 2017 10:16:48 +0000 (10:16 +0000)]
[globalisel][tablegen] Fix an unused variable warning in release builds after r307133

llvm-svn: 307138

7 years ago[ELF] Fix Windows build error
Peter Smith [Wed, 5 Jul 2017 10:15:46 +0000 (10:15 +0000)]
[ELF] Fix Windows build error

Attempt to fix Windows buildbots From 307131 Replaced return {ET, false};
with return std::make_pair(ET, false);

llvm-svn: 307137

7 years ago[ELF] Allow multiple thunks to be added for a symbol.
Peter Smith [Wed, 5 Jul 2017 09:53:33 +0000 (09:53 +0000)]
[ELF] Allow multiple thunks to be added for a symbol.

This change permits there to be more than one thunk to be associated with
a symbol. For interworking thunks we only require one thunk, but range
extension thunks may require more than one.

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

llvm-svn: 307136

7 years agoRevert "[IndVars] Canonicalize comparisons between non-negative values and indvars"
Max Kazantsev [Wed, 5 Jul 2017 09:44:41 +0000 (09:44 +0000)]
Revert "[IndVars] Canonicalize comparisons between non-negative values and indvars"

This patch seems to cause failures of test MathExtras.SaturatingMultiply on
multiple buildbots. Reverting until the reason of that is clarified.

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

llvm-svn: 307135

7 years agoFix invalid warnings for header guards in preambles
Erik Verbruggen [Wed, 5 Jul 2017 09:44:07 +0000 (09:44 +0000)]
Fix invalid warnings for header guards in preambles

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

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

llvm-svn: 307134

7 years ago[globalisel][tablegen] Added instruction emission to the state-machine-based matcher.
Daniel Sanders [Wed, 5 Jul 2017 09:39:33 +0000 (09:39 +0000)]
[globalisel][tablegen] Added instruction emission to the state-machine-based matcher.

Summary:
This further improves the compile-time regressions that will be caused by a
re-commit of r303259.

Also added included preliminary work in preparation for the multi-insn emitter
since I needed to change the relevant part of the API for this patch anyway.

Depends on D33758

Reviewers: rovka, vitalybuka, ab, t.p.northover, qcolombet, aditya_nandakumar

Reviewed By: ab

Subscribers: kristof.beyls, igorb, llvm-commits

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

llvm-svn: 307133

7 years ago[ELF] Introduce Thunk reuse compatibility
Peter Smith [Wed, 5 Jul 2017 09:36:03 +0000 (09:36 +0000)]
[ELF] Introduce Thunk reuse compatibility

On ARM the interworking thunks are only produced for branch instructions
that can't be changed into a blx instruction so only Thumb callers would
call Thumb thunks and only ARM callers would call ARM thunks. With range
extension thunks branch and link instructions may need a Thunk. These
instructions can be rewritten as a blx and can use either ARM or Thumb
thunks.

We introduce an isCompatibleWith() function so that a caller can check if
an existing Thunk is compatible before reusing it.

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

llvm-svn: 307132

7 years ago[ELF] Extract allocateHeaders() from assignAddresses()
Peter Smith [Wed, 5 Jul 2017 09:12:54 +0000 (09:12 +0000)]
[ELF] Extract allocateHeaders() from assignAddresses()

The allocateHeaders() function is called at the end of assignAddresses(), it
decides whether the ELF header and program header table can be allocated to
a PT_LOAD program header. As the function alters state, it prevents
assignAddresses() from being called multiple times.

This change splits out the call to allocateHeaders() from assignAddresses()
this will permit assignAddresses() to be called while processing range
extension thunks without trying to allocateHeaders().

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

llvm-svn: 307131

7 years ago[clang-tidy] Add "MakeSmartPtrFunction" option to modernize-make-shared/unique checks.
Haojian Wu [Wed, 5 Jul 2017 07:49:00 +0000 (07:49 +0000)]
[clang-tidy] Add "MakeSmartPtrFunction" option to modernize-make-shared/unique checks.

Reviewers: alexfh, aaron.ballman

Reviewed By: alexfh

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

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

llvm-svn: 307130

7 years ago[modules ts] Improve merging of module-private declarations.
Richard Smith [Wed, 5 Jul 2017 07:47:11 +0000 (07:47 +0000)]
[modules ts] Improve merging of module-private declarations.

These cases occur frequently for declarations in the global module (above the
module-declaration) in a Modules TS module interface. When we merge a
definition from another module into such a module-private definition, ensure
that we transitively make everything lexically within that definition visible
to that translation unit.

llvm-svn: 307129

7 years ago[asan] Remove check for stack size
Jonas Hahnfeld [Wed, 5 Jul 2017 06:54:43 +0000 (06:54 +0000)]
[asan] Remove check for stack size

This has been introduced in r304598 and fails for increased stack sizes.

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

llvm-svn: 307127

7 years ago[IndVars] Canonicalize comparisons between non-negative values and indvars
Max Kazantsev [Wed, 5 Jul 2017 06:38:49 +0000 (06:38 +0000)]
[IndVars] Canonicalize comparisons between non-negative values and indvars

-If there is a IndVar which is known to be non-negative, and there is a value which is also non-negative,
then signed and unsigned comparisons between them produce the same result. Both of those can be
seen in the same loop. To allow other optimizations to simplify them, we turn all instructions like

  %c = icmp slt i32 %iv, %b
to

  %c = icmp ult i32 %iv, %b

if both %iv and %b are known to be non-negative.

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

llvm-svn: 307126

7 years ago[GlobalISel][X86] Allow graceful fallback for struct/array argument/return value...
Igor Breger [Wed, 5 Jul 2017 06:24:13 +0000 (06:24 +0000)]
[GlobalISel][X86] Allow graceful fallback for struct/array argument/return value lowering. Going to support it in follow patch.

llvm-svn: 307125

7 years agofix trivial typos in comments; NFC
Hiroshi Inoue [Wed, 5 Jul 2017 05:43:31 +0000 (05:43 +0000)]
fix trivial typos in comments; NFC

llvm-svn: 307124

7 years agofix trivial typos in comments; NFC
Hiroshi Inoue [Wed, 5 Jul 2017 05:37:45 +0000 (05:37 +0000)]
fix trivial typos in comments; NFC

llvm-svn: 307123

7 years agoAdd the missing triple to the test case added as part of r307120.
Nemanja Ivanovic [Wed, 5 Jul 2017 05:14:43 +0000 (05:14 +0000)]
Add the missing triple to the test case added as part of r307120.

llvm-svn: 307122

7 years ago[AMDGPU] Fix size and alignment of size_t and pointer types
Yaxun Liu [Wed, 5 Jul 2017 04:58:24 +0000 (04:58 +0000)]
[AMDGPU] Fix size and alignment of size_t and pointer types

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

llvm-svn: 307121

7 years ago[PowerPC] Fix for PR33636
Nemanja Ivanovic [Wed, 5 Jul 2017 04:51:29 +0000 (04:51 +0000)]
[PowerPC] Fix for PR33636

Remove casts to a constant when a node can be an undef.

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

llvm-svn: 307120

7 years agoFix equivalent test on OS X and FreeBSD
Eric Fiselier [Wed, 5 Jul 2017 03:54:38 +0000 (03:54 +0000)]
Fix equivalent test on OS X and FreeBSD

llvm-svn: 307119

7 years agoAdd dummy CMake target for *.pass.cpp tests when LIBCXX_CONFIGURE_IDE=ON.
Eric Fiselier [Wed, 5 Jul 2017 03:50:03 +0000 (03:50 +0000)]
Add dummy CMake target for *.pass.cpp tests when LIBCXX_CONFIGURE_IDE=ON.

In order for IDE's like CLion to correctly parse and highlight the tests
it needs to know roughly how to build them. This patch adds a dummy CMake target
for each/all of the .pass.cpp tests in the test suite to solve this problem.
The target is only created when LIBCXX_CONFIGURE_IDE=ON, so it shouldn't affect
most users.

Originally I wasn't sure that this change deserved to live upstream, but it's
quite frustrating to edit libc++ tests using CLion or Visual Studio without it,
in particular the filesystem tests which rely heavily on macros. Even though the change
should have no effect on non-IDE users/configurations I decided to commit it upstream
with the hopes it will benefit somebody other than me.

llvm-svn: 307118

7 years agoImplement LWG 2937 - equivalent("dne", "exists") is not an error
Eric Fiselier [Wed, 5 Jul 2017 03:37:05 +0000 (03:37 +0000)]
Implement LWG 2937 - equivalent("dne", "exists") is not an error

This patch speculatively implements the PR for LWG 2937, which fixes
two issues with equivalent.

(1) It makes equivalent("dne", "exists") an error. Previously only
    equivalent("dne", "dne") was an error and the former case was not (it returned false).
    Now equivalent reports an error when either input doesn't exist.

(2) It makes equivalent(p1, p2) well-formed when `is_other(p1) && is_other(p2)`.
    Previously this was an error, but there is seemingly no reason why it should be on POSIX system.

llvm-svn: 307117