OSDN Git Service

android-x86/external-llvm.git
7 years agoRevert r303375 "LLVM_FALLTHROUGH instead of fall-through comment."
Rui Ueyama [Thu, 18 May 2017 20:18:24 +0000 (20:18 +0000)]
Revert r303375 "LLVM_FALLTHROUGH instead of fall-through comment."

This reverts commit r303375 since it didn't compile.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303377 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLLVM_FALLTHROUGH instead of fall-through comment.
Galina Kistanova [Thu, 18 May 2017 20:01:52 +0000 (20:01 +0000)]
LLVM_FALLTHROUGH instead of fall-through comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303375 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r302938 "Add LiveRangeShrink pass to shrink live range within BB."
Hans Wennborg [Thu, 18 May 2017 18:50:05 +0000 (18:50 +0000)]
Revert r302938 "Add LiveRangeShrink pass to shrink live range within BB."

This also reverts follow-ups r303292 and r303298.

It broke some Chromium tests under MSan, and apparently also internal
tests at Google.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303369 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse existing helper. NFC.
Rafael Espindola [Thu, 18 May 2017 18:24:11 +0000 (18:24 +0000)]
Use existing helper. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303368 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstSimplify] Add test cases for missing fold (A & B) | ~(A ^ B) -> ~(A ^ B).
Craig Topper [Thu, 18 May 2017 18:14:40 +0000 (18:14 +0000)]
[InstSimplify] Add test cases for missing fold (A & B) | ~(A ^ B) -> ~(A ^ B).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303367 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReduce gcc-7 warnings by fall-through comments.
Galina Kistanova [Thu, 18 May 2017 17:53:47 +0000 (17:53 +0000)]
Reduce gcc-7 warnings by fall-through comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303365 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] move test and use better checks; NFC
Sanjay Patel [Thu, 18 May 2017 17:48:07 +0000 (17:48 +0000)]
[InstCombine] move test and use better checks; NFC

Previously, this test was checking for 'or i1', but that was actually matched by 'xor i1'.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303364 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[IR] De-virtualize ~Value to save a vptr
Reid Kleckner [Thu, 18 May 2017 17:24:10 +0000 (17:24 +0000)]
[IR] De-virtualize ~Value to save a vptr

Summary:
Implements PR889

Removing the virtual table pointer from Value saves 1% of RSS when doing
LTO of llc on Linux. The impact on time was positive, but too noisy to
conclusively say that performance improved. Here is a link to the
spreadsheet with the original data:

https://docs.google.com/spreadsheets/d/1F4FHir0qYnV0MEp2sYYp_BuvnJgWlWPhWOwZ6LbW7W4/edit?usp=sharing

This change makes it invalid to directly delete a Value, User, or
Instruction pointer. Instead, such code can be rewritten to a null check
and a call Value::deleteValue(). Value objects tend to have their
lifetimes managed through iplist, so for the most part, this isn't a big
deal.  However, there are some places where LLVM deletes values, and
those places had to be migrated to deleteValue.  I have also created
llvm::unique_value, which has a custom deleter, so it can be used in
place of std::unique_ptr<Value>.

I had to add the "DerivedUser" Deleter escape hatch for MemorySSA, which
derives from User outside of lib/IR. Code in IR cannot include MemorySSA
headers or call the MemoryAccess object destructors without introducing
a circular dependency, so we need some level of indirection.
Unfortunately, no class derived from User may have any virtual methods,
because adding a virtual method would break User::getHungOffOperands(),
which assumes that it can find the use list immediately prior to the
User object. I've added a static_assert to the appropriate OperandTraits
templates to help people avoid this trap.

Reviewers: chandlerc, mehdi_amini, pete, dberlin, george.burgess.iv

Reviewed By: chandlerc

Subscribers: krytarowski, eraman, george.burgess.iv, mzolotukhin, Prazek, nlewycky, hans, inglorion, pcc, tejohnson, dberlin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303362 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LSR] Call canonicalize after we generate a new Formula in GenerateTruncates. Fix...
Wei Mi [Thu, 18 May 2017 17:21:22 +0000 (17:21 +0000)]
[LSR] Call canonicalize after we generate a new Formula in GenerateTruncates. Fix PR33077.

The testcase in PR33077 generates a LSR Use Formula with two SCEVAddRecExprs for the same
loop. Such uncommon formula will become non-canonical after GenerateTruncates adds sign
extension to the ScaledReg of the Formula, and it will break the assertion that every
Formula to be inserted is canonical.

The fix is to call canonicalize for the raw Formula generated by GenerateTruncates
before inserting it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303361 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LegacyPassManager] Remove TargetMachine constructors
Francis Visoiu Mistrih [Thu, 18 May 2017 17:21:13 +0000 (17:21 +0000)]
[LegacyPassManager] Remove TargetMachine constructors

This provides a new way to access the TargetMachine through
TargetPassConfig, as a dependency.

The patterns replaced here are:

* Passes handling a null TargetMachine call
  `getAnalysisIfAvailable<TargetPassConfig>`.

* Passes not handling a null TargetMachine
  `addRequired<TargetPassConfig>` and call
  `getAnalysis<TargetPassConfig>`.

* MachineFunctionPasses now use MF.getTarget().

* Remove all the TargetMachine constructors.
* Remove INITIALIZE_TM_PASS.

This fixes a crash when running `llc -start-before prologepilog`.

PEI needs StackProtector, which gets constructed without a TargetMachine
by the pass manager. The StackProtector pass doesn't handle the case
where there is no TargetMachine, so it segfaults.

Related to PR30324.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303360 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[git-llvm] Don't attempt to propget files that don't exist yet in SVN
Reid Kleckner [Thu, 18 May 2017 17:17:17 +0000 (17:17 +0000)]
[git-llvm] Don't attempt to propget files that don't exist yet in SVN

svn propget will fail halfway through, and the patch will fail to apply.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303359 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix some minor issues in PDB parsing library.
Zachary Turner [Thu, 18 May 2017 15:14:44 +0000 (15:14 +0000)]
Fix some minor issues in PDB parsing library.

1) Until now I'd never seen a valid PDB where the DBI stream and
   the PDB Stream disagreed on the "Age" field.  Because of that,
   we had code to assert that they matched.  Recently though I was
   given a PDB where they disagreed, so this assumption has proven
   to be incorrect.  Remove this check.

2) We were walking the entire list of hash values for types up front
   and then throwing away the values.  For large PDBs this was a
   significant slow down.  Remove this.

With this patch, I can dump the list of all compilands from a
1.5GB PDB file in just a few seconds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303351 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[JumpThreading] Dont RAUW condition incorrectly
Anna Thomas [Thu, 18 May 2017 13:12:18 +0000 (13:12 +0000)]
[JumpThreading] Dont RAUW condition incorrectly

Summary:
We have a bug when RAUWing the condition if experimental.guard or assumes is a use of that
condition. This is because LazyValueInfo may have used the guards/assumes to identify the
value of the condition at the end of the block. RAUW replaces the uses
at the guard/assume as well as uses before the guard/assume. Both of
these are incorrect.
For now, disable RAUW for conditions and fix the logic as a next
step: https://reviews.llvm.org/D33257

Reviewers: sanjoy, reames, trentxintong

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303349 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] SDWA operands should not intersect with potential MIs
Sam Kolton [Thu, 18 May 2017 12:12:03 +0000 (12:12 +0000)]
[AMDGPU] SDWA operands should not intersect with potential MIs

Summary:
There should be no intesection between SDWA operands and potential MIs. E.g.:
```
v_and_b32 v0, 0xff, v1 -> src:v1 sel:BYTE_0
v_and_b32 v2, 0xff, v0 -> src:v0 sel:BYTE_0
v_add_u32 v3, v4, v2
```
In that example it is possible that we would fold 2nd instruction into 3rd (v_add_u32_sdwa) and then try to fold 1st instruction into 2nd (that was already destroyed). So if SDWAOperand is also a potential MI then do not apply it.

Reviewers: vpykhtin, arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303347 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[MVT] add v1i1 MVT
Guy Blank [Thu, 18 May 2017 11:29:41 +0000 (11:29 +0000)]
[MVT] add v1i1 MVT

Adds the v1i1 MVT as a preparation for another commit (https://reviews.llvm.org/D32273)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303346 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[GlobalISel][X86] G_ADD/G_SUB vector legalizer/selector support.
Igor Breger [Thu, 18 May 2017 11:10:56 +0000 (11:10 +0000)]
[GlobalISel][X86] G_ADD/G_SUB vector legalizer/selector support.

Summary: G_ADD/G_SUB vector legalizer/selector support.

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, llvm-commits, kristof.beyls

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303345 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][AVX512] Add 512-bit vector ctpop costs + tests
Simon Pilgrim [Thu, 18 May 2017 10:42:34 +0000 (10:42 +0000)]
[X86][AVX512] Add 512-bit vector ctpop costs + tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303342 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRe-commit: [globalisel][tablegen] Import rules containing intrinsic_wo_chain.
Daniel Sanders [Thu, 18 May 2017 10:33:36 +0000 (10:33 +0000)]
Re-commit: [globalisel][tablegen] Import rules containing intrinsic_wo_chain.

Summary:
As of this patch, 1018 out of 3938 rules are currently imported.

Depends on D32275

Reviewers: qcolombet, kristof.beyls, rovka, t.p.northover, ab, aditya_nandakumar

Reviewed By: qcolombet

Subscribers: dberris, igorb, llvm-commits

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

The previous commit failed on test-suite/Bitcode/simd_ops/AArch64_halide_runtime.bc
because isImmOperandEqual() assumed MO was a register operand and that's not
always true.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303341 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Add explicit triple to test invocation
Zvi Rackover [Thu, 18 May 2017 09:32:56 +0000 (09:32 +0000)]
[X86] Add explicit triple to test invocation

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303340 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SCEV][NFC] Remove duplication of isLoopInvariant code
Max Kazantsev [Thu, 18 May 2017 08:26:41 +0000 (08:26 +0000)]
[SCEV][NFC] Remove duplication of isLoopInvariant code

Replace two places that duplicate the code of isLoopInvariant method with
the invocation of this method.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303336 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DWARF] - Simplify RelocVisitor implementation.
George Rimar [Thu, 18 May 2017 08:25:11 +0000 (08:25 +0000)]
[DWARF] - Simplify RelocVisitor implementation.

We do not need to store relocation width field.
Patch removes relative code, that simplifies implementation.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303335 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[lib/Object] - Fix build bot after r303331 "[lib/Object] - Minor API update for llvm...
George Rimar [Thu, 18 May 2017 08:14:43 +0000 (08:14 +0000)]
[lib/Object] - Fix build bot after r303331 "[lib/Object] - Minor API update for llvm::Decompressor".

Error was:
Decompressor.h:33:28: error: extra qualification ‘llvm::object::Decompressor::’ on member ‘resizeAndDecompress’ [-fpermissive]
   template <class T> Error Decompressor::resizeAndDecompress(T &Out) {

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303334 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Replace slow LEA instructions in X86
Lama Saba [Thu, 18 May 2017 08:11:50 +0000 (08:11 +0000)]
[X86] Replace slow LEA instructions in X86

  According to Intel's Optimization Reference Manual for SNB+:
  " For LEA instructions with three source operands and some specific situations, instruction latency has increased to 3 cycles, and must
    dispatch via port 1:
  - LEA that has all three source operands: base, index, and offset
  - LEA that uses base and index registers where the base is EBP, RBP,or R13
  - LEA that uses RIP relative addressing mode
  - LEA that uses 16-bit addressing mode "
  This patch currently handles the first 2 cases only.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303333 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[lib/Object] - Minor API update for llvm::Decompressor.
George Rimar [Thu, 18 May 2017 08:00:01 +0000 (08:00 +0000)]
[lib/Object] - Minor API update for llvm::Decompressor.

I revisited Decompressor API (issue with it was triggered during D32865 review)
and found it is probably provides more then we really need.

Issue was about next method's signature:

Error decompress(SmallString<32> &Out);
It is too strict. At first I wanted to change it to decompress(SmallVectorImpl<char> &Out),
but then found it is still not flexible because sticks to SmallVector.

During reviews was suggested to use templating to simplify code. Patch do that.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303331 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix buildbot failure after rL303327: [BPI] Reduce the probability of unreachable...
Serguei Katkov [Thu, 18 May 2017 07:20:52 +0000 (07:20 +0000)]
Fix buildbot failure after rL303327: [BPI] Reduce the probability of unreachable edge to minimal value greater than 0.

One more test is updated to meet new branch probability for unreachable branches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303329 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Adding tests for scalar bitcasts from vsetcc. NFC.
Zvi Rackover [Thu, 18 May 2017 07:04:48 +0000 (07:04 +0000)]
[X86] Adding tests for scalar bitcasts from vsetcc. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303328 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[BPI] Reduce the probability of unreachable edge to minimal value greater than 0
Serguei Katkov [Thu, 18 May 2017 06:11:56 +0000 (06:11 +0000)]
[BPI] Reduce the probability of unreachable edge to minimal value greater than 0

The probability of edge coming to unreachable block should be as low as possible.
The change reduces the probability to minimal value greater than zero.

The bug https://bugs.llvm.org/show_bug.cgi?id=32214 show the example when
the probability of edge coming to unreachable block is greater than for edge
coming to out of the loop and it causes incorrect loop rotation.

Please note that with this change the behavior of unreachable heuristic is a bit different
than others. Specifically, before this change the sum of probabilities
coming to unreachable blocks have the same weight for all branches
(it was just split over all edges of this block coming to unreachable blocks).
With this change it might be slightly different but not to much due to probability of
taken branch to unreachable block is really small.

Reviewers: chandlerc, sanjoy, vsk, congh, junbuml, davidxl, dexonsmith
Reviewed By: chandlerc, dexonsmith
Subscribers: reames, llvm-commits
Differential Revision: https://reviews.llvm.org/D30633

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303327 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ThinLTO] Do not assert when adding a module with a different but
Akira Hatanaka [Thu, 18 May 2017 03:52:29 +0000 (03:52 +0000)]
[ThinLTO] Do not assert when adding a module with a different but
compatible target triple

Currently, an assertion fails in ThinLTOCodeGenerator::addModule when
the target triple of the module being added doesn't match that of the
one stored in TMBuilder. This patch relaxes the constraint and makes
changes to allow target triples that only differ in their version
numbers on Apple platforms, similarly to what r228999 did.

rdar://problem/30133904

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303326 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Target/X86] Remove unneeded return. NFCI.
Davide Italiano [Thu, 18 May 2017 02:36:42 +0000 (02:36 +0000)]
[Target/X86] Remove unneeded return. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303323 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate three tests I missed in r302979 and r302990
Justin Bogner [Thu, 18 May 2017 00:58:06 +0000 (00:58 +0000)]
Update three tests I missed in r302979 and r302990

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303319 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Statistics] Add a method to atomically update a statistic that contains a maximum
Craig Topper [Thu, 18 May 2017 00:51:39 +0000 (00:51 +0000)]
[Statistics] Add a method to atomically update a statistic that contains a maximum

Summary:
There are several places in the codebase that try to calculate a maximum value in a Statistic object. We currently do this in one of two ways:

  MaxNumFoo = std::max(MaxNumFoo, NumFoo);

or

  MaxNumFoo = (MaxNumFoo > NumFoo) ? MaxNumFoo : NumFoo;

The first version reads from MaxNumFoo one time and uncontionally rwrites to it. The second version possibly reads it twice depending on the result of the first compare.  But we have no way of knowing if the value was changed by another thread between the reads and the writes.

This patch adds a method to the Statistic object that can ensure that we only store if our value is the max and the previous max didn't change after we read it. If it changed we'll recheck if our value should still be the max or not and try again.

This spawned from an audit I'm trying to do of all places we uses the implicit conversion to unsigned on the Statistics objects. See my previous thread on llvm-dev https://groups.google.com/forum/#!topic/llvm-dev/yfvxiorKrDQ

Reviewers: dberlin, chandlerc, hfinkel, dblaikie

Reviewed By: chandlerc

Subscribers: llvm-commits, sanjoy

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303318 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCodeGen: BlockPlacement: Add Message strings to asserts. NFC
Kyle Butt [Wed, 17 May 2017 23:44:41 +0000 (23:44 +0000)]
CodeGen: BlockPlacement: Add Message strings to asserts. NFC

Add message strings to all the unlabeled asserts in the file.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303316 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] add test for xor-of-icmps; NFC
Sanjay Patel [Wed, 17 May 2017 23:22:52 +0000 (23:22 +0000)]
[InstCombine] add test for xor-of-icmps; NFC

This is another form of the problem discussed in D32143.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303315 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Statistics] Use Statistic::operator+= instead of adding and assigning separately.
Craig Topper [Wed, 17 May 2017 23:22:10 +0000 (23:22 +0000)]
[Statistics] Use Statistic::operator+= instead of adding and assigning separately.

I believe this technically fixes a multithreaded race condition in this code. But my primary concern was as part of looking at removing the ability to treat Statistics like a plain unsigned. There are many weird operations on Statistics in the codebase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303314 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[globalisel][tablegen] Import rules containing intrinsic_wo_chain."
Quentin Colombet [Wed, 17 May 2017 23:17:29 +0000 (23:17 +0000)]
Revert "[globalisel][tablegen] Import rules containing intrinsic_wo_chain."

This reverts commit r303259.

This breaks the GISel bot:
http://lab.llvm.org:8080/green/job/Compiler_Verifiers_GlobalISEL/5163/consoleFull#-134276167849ba4694-19c4-4d7e-bec5-911270d8a58c

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303313 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] handle icmp i1 X, C early to avoid creating an unknown pattern
Sanjay Patel [Wed, 17 May 2017 22:29:40 +0000 (22:29 +0000)]
[InstCombine] handle icmp i1 X, C early to avoid creating an unknown pattern

The missing optimization for xor-of-icmps still needs to be added, but by
being more efficient (not generating unnecessary logic ops with constants)
we avoid the bug.

See discussion in post-commit comments:
https://reviews.llvm.org/D32143

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303312 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAttempt to pacify ASan and UBSan reports in CrashRecovery tests
Reid Kleckner [Wed, 17 May 2017 22:23:20 +0000 (22:23 +0000)]
Attempt to pacify ASan and UBSan reports in CrashRecovery tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303311 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] add test for missing icmp bool fold; NFC
Sanjay Patel [Wed, 17 May 2017 22:20:02 +0000 (22:20 +0000)]
[InstCombine] add test for missing icmp bool fold; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303310 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] move icmp bool canonicalizations to helper; NFC
Sanjay Patel [Wed, 17 May 2017 22:15:07 +0000 (22:15 +0000)]
[InstCombine] move icmp bool canonicalizations to helper; NFC

As noted in the post-commit comments in D32143, we should be
catching the constant operand cases sooner to be more efficient
and less likely to expose a missing fold.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303309 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Start defining a calling convention
Matt Arsenault [Wed, 17 May 2017 21:56:25 +0000 (21:56 +0000)]
AMDGPU: Start defining a calling convention

Partially implement callee-side for arguments and return values.
byval doesn't work properly, and most likely sret or other on-stack
return values most as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303308 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCodeGen: Power: Add lowering for shifts of v1i128.
Kyle Butt [Wed, 17 May 2017 21:54:41 +0000 (21:54 +0000)]
CodeGen: Power: Add lowering for shifts of v1i128.

When legalizing vector operations on vNi128, they will be split to v1i128
because that is a legal type on ppc64, but then the compiler will crash in
selection dag because it fails to select for these operations. This patch fixes
shift operations. Logical shift right and left shift can be performed in the
vector unit, but algebraic shift right requires being split.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303307 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix PR33028
Michael Liao [Wed, 17 May 2017 21:48:00 +0000 (21:48 +0000)]
Fix PR33028

- '-verify-mahcineinstrs' starts to complain allocatable live-in physical
  registers on non-entry or non-landing-pad basic blocks.
- Refactor the XBEGIN translation to define EAX on a dedicated fallback code
  path due to XABORT. Add a pseudo instruction to define EAX explicitly to
  avoid add physical register live-in.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303306 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Remove old intrinsic uses
Matt Arsenault [Wed, 17 May 2017 21:38:21 +0000 (21:38 +0000)]
AMDGPU: Remove old intrinsic uses

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303305 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Expand frame indexes to be relative to scratch wave offset
Matt Arsenault [Wed, 17 May 2017 21:23:14 +0000 (21:23 +0000)]
AMDGPU: Expand frame indexes to be relative to scratch wave offset

In order for an arbitrary callee to access an object
in a caller's stack frame, the 32-bit offset used as
the private pointer needs to be relative to the kernel's
scratch wave offset register.

Convert to this by finding the difference from the current
stack frame and scaling by the wavefront size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303303 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Change mubuf soffset register when SP relative
Matt Arsenault [Wed, 17 May 2017 21:02:58 +0000 (21:02 +0000)]
AMDGPU: Change mubuf soffset register when SP relative

Check the MachinePointerInfo for whether the access is
supposed to be relative to the stack pointer.

No tests because this is used in later commits implementing
calls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303301 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][AVX512] Add 512-bit vector ctlz costs + tests
Simon Pilgrim [Wed, 17 May 2017 21:02:18 +0000 (21:02 +0000)]
[X86][AVX512] Add 512-bit vector ctlz costs + tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303300 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-pdbdump] in yaml2pdb, generate default output filename if none given
Bob Haarman [Wed, 17 May 2017 20:46:48 +0000 (20:46 +0000)]
[llvm-pdbdump] in yaml2pdb, generate default output filename if none given

Summary:
llvm-pdbdump yaml2pdb used to fail with a misleading error
message ("An I/O error occurred on the file system") if no output file
was specified. This change adds an assert to PDBFileBuilder to check
that an output file name is specified, and makes llvm-pdbdump generate
an output file name based on the input file name if no output file
name is explicitly specified.

Reviewers: amccarth, zturner

Reviewed By: zturner

Subscribers: fhahn, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303299 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoupdate the test that should have been updated in r303292. (NFC)
Dehao Chen [Wed, 17 May 2017 20:44:08 +0000 (20:44 +0000)]
update the test that should have been updated in r303292. (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303298 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd some helpers for manipulating BinaryStreamRefs.
Zachary Turner [Wed, 17 May 2017 20:42:52 +0000 (20:42 +0000)]
Add some helpers for manipulating BinaryStreamRefs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303297 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Make better use of op_sel with high components
Matt Arsenault [Wed, 17 May 2017 20:30:58 +0000 (20:30 +0000)]
AMDGPU: Make better use of op_sel with high components

Handle more general swizzles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303296 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstSimplify] handle all icmp i1 X, C in one place; NFCI
Sanjay Patel [Wed, 17 May 2017 20:27:55 +0000 (20:27 +0000)]
[InstSimplify] handle all icmp i1 X, C in one place; NFCI

We already handled all of the new tests identically, but several
of those went through a lot of unnecessary processing before
getting folded.

Another motivation for grouping these cases together is that
InstCombine needs a similar fold. Currently, it handles the
'not' cases inefficiently which can lead to bugs as described
in the post-commit comments of:
https://reviews.llvm.org/D32143

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303295 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[BinaryStream] Reduce the amount of boiler plate needed to use.
Zachary Turner [Wed, 17 May 2017 20:23:31 +0000 (20:23 +0000)]
[BinaryStream] Reduce the amount of boiler plate needed to use.

Often you have an array and you just want to use it.  With the current
design, you have to first construct a `BinaryByteStream`, and then create
a `BinaryStreamRef` from it.  Worse, the `BinaryStreamRef` holds a pointer
to the `BinaryByteStream`, so you can't just create a temporary one to
appease the compiler, you have to actually hold onto both the `ArrayRef`
as well as the `BinaryByteStream` *AND* the `BinaryStreamReader` on top of
that.  This makes for very cumbersome code, often requiring one to store a
`BinaryByteStream` in a class just to circumvent this.

At the cost of some added complexity (not exposed to users, but internal
to the library), we can do better than this.  This patch allows us to
construct `BinaryStreamReaders` and `BinaryStreamWriters` directly from
source data (e.g. `StringRef`, `MutableArrayRef<uint8_t>`, etc).  Not only
does this reduce the amount of code you have to type and make it more
obvious how to use it, but it solves real lifetime issues when it's
inconvenient to hold onto a `BinaryByteStream` for a long time.

The additional complexity is in the form of an added layer of indirection.
Whereas before we simply stored a `BinaryStream*` in the ref, we now store
both a `BinaryStream*` **and** a `std::shared_ptr<BinaryStream>`.  When
the user wants to construct a `BinaryStreamRef` directly from an
`ArrayRef` etc, we allocate an internal object that holds ownership over a
`BinaryByteStream` and forwards all calls, and store this in the
`shared_ptr<>`.  This also maintains the ref semantics, as you can copy it
by value and references refer to the same underlying stream -- the one
being held in the object stored in the `shared_ptr`.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303294 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][AVX512] Add 512-bit vector cttz costs + tests
Simon Pilgrim [Wed, 17 May 2017 20:22:54 +0000 (20:22 +0000)]
[X86][AVX512] Add 512-bit vector cttz costs + tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303293 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoOnly enable LiveRangeShrink for x86.
Dehao Chen [Wed, 17 May 2017 20:18:13 +0000 (20:18 +0000)]
Only enable LiveRangeShrink for x86.

Summary: Moving LiveRangeShrink to x86 as this pass is mostly useful for archtectures with great register pressure.

Reviewers: MatzeB, qcolombet

Reviewed By: qcolombet

Subscribers: jholewinski, jyknight, javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303292 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Try to use op_sel when selecting packed instructions
Matt Arsenault [Wed, 17 May 2017 20:00:00 +0000 (20:00 +0000)]
AMDGPU: Try to use op_sel when selecting packed instructions

Avoids instructions to pack a vector when the source is really
a scalar being broadcast.

Also be smarter and look for per-component fneg.

Doesn't yet handle scalar from upper half of register
or other swizzles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303291 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Split ctpop/ctlz/cttz cost tests
Simon Pilgrim [Wed, 17 May 2017 19:57:20 +0000 (19:57 +0000)]
[X86] Split ctpop/ctlz/cttz cost tests

This will make things a lot easier to test all the permutations of avx512

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303290 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReapply part of rL303015, fixing just the DynamicLibaryTest. Add
Dimitry Andric [Wed, 17 May 2017 19:46:49 +0000 (19:46 +0000)]
Reapply part of rL303015, fixing just the DynamicLibaryTest.  Add
retrieval of the original argv[0] from the GoogleTest framework, so it
is more likely the correct main executable path is found.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303289 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[WebAssembly][NFC] Update expected testsuite failures for newly passing tests
Jacob Gravelle [Wed, 17 May 2017 19:45:22 +0000 (19:45 +0000)]
[WebAssembly][NFC] Update expected testsuite failures for newly passing tests

Summary: r303050 fixes crashes when calling scalarizeMaskedMemIntrin pass from WebAssembly backend. This updates expected test failures for that.

Reviewers: sbc100

Subscribers: jfb, llvm-commits, dschuff

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303288 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Use appropriate soffset for spilling
Matt Arsenault [Wed, 17 May 2017 19:37:57 +0000 (19:37 +0000)]
AMDGPU: Use appropriate soffset for spilling

This needs to be the frame offset register, and not the global
scratch wave offset register. For kernels, these are the same.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303287 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r303015, because it has the unintended side effect of breaking
Dimitry Andric [Wed, 17 May 2017 19:33:10 +0000 (19:33 +0000)]
Revert r303015, because it has the unintended side effect of breaking
driver-mode recognition in clang (this is because the sysctl method
always returns one and only one executable path, even for an executable
with multiple links):

Fix DynamicLibraryTest.cpp on FreeBSD and NetBSD

Summary:

After rL301562, on FreeBSD the DynamicLibrary unittests fail, because
the test uses getMainExecutable("DynamicLibraryTests", Ptr), and since
the path does not contain any slashes, retrieving the main executable
will not work.

Reimplement getMainExecutable() for FreeBSD and NetBSD using sysctl(3),
which is more reliable than fiddling with relative or absolute paths.

Also add retrieval of the original argv[] from the GoogleTest framework,
to use as a fallback for other OSes.

Reviewers: emaste, marsupial, hans, krytarowski

Reviewed By: krytarowski

Subscribers: krytarowski, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303285 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Fix min3/max3 combines for f16/i16
Matt Arsenault [Wed, 17 May 2017 19:25:06 +0000 (19:25 +0000)]
AMDGPU: Fix min3/max3 combines for f16/i16

Fix missing instruction definitions for min3/max3.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303284 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][AVX512] Add 512-bit vector bitreverse costs + tests
Simon Pilgrim [Wed, 17 May 2017 19:20:20 +0000 (19:20 +0000)]
[X86][AVX512] Add 512-bit vector bitreverse costs + tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303283 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd back a dummy --use-processes.
Rafael Espindola [Wed, 17 May 2017 18:55:01 +0000 (18:55 +0000)]
Add back a dummy --use-processes.

Some bots are using it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303282 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAlways use the multiprocess module.
Rafael Espindola [Wed, 17 May 2017 18:20:01 +0000 (18:20 +0000)]
Always use the multiprocess module.

This seems to work on freebsd and openbsd these days.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303280 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRe-land r303274: "[CrashRecovery] Use SEH __try instead of VEH when available"
Reid Kleckner [Wed, 17 May 2017 18:16:17 +0000 (18:16 +0000)]
Re-land r303274: "[CrashRecovery] Use SEH __try instead of VEH when available"

We have to check gCrashRecoveryEnabled before using __try.

In other words, SEH works too well and we ended up recovering from
crashes in implicit module builds that we weren't supposed to. Only
libclang is supposed to enable CrashRecoveryContext to allow implicit
module builds to crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303279 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[GISel]: Fix undefined behavior in IRTranslator
Aditya Nandakumar [Wed, 17 May 2017 17:41:55 +0000 (17:41 +0000)]
[GISel]: Fix undefined behavior in IRTranslator

Make sure IRTranslator->MachineIRBuilder->DebugLoc doesn't
outlive the DILocation. Clear it at the end of
IRTranslator::runOnMachineFunction

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303277 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[CrashRecovery] Use SEH __try instead of VEH when available"
Reid Kleckner [Wed, 17 May 2017 17:15:00 +0000 (17:15 +0000)]
Revert "[CrashRecovery] Use SEH __try instead of VEH when available"

This reverts commit r303274, it appears to break some clang tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303275 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CrashRecovery] Use SEH __try instead of VEH when available
Reid Kleckner [Wed, 17 May 2017 17:02:16 +0000 (17:02 +0000)]
[CrashRecovery] Use SEH __try instead of VEH when available

Summary:
It avoids problems when other libraries raise exceptions. In particular,
OutputDebugString raises an exception that the debugger is supposed to
catch and suppress. VEH kicks in first right now, and that is entirely
incorrect.

Unfortunately, GCC does not support SEH, so I've kept the old buggy VEH
codepath around. We could fix it with SetUnhandledExceptionFilter, but
that is not per-thread, so a well-behaved library shouldn't set it.

Reviewers: zturner

Subscribers: llvm-commits, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303274 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoWorkaround for incorrect Win32 header on GCC.
Zachary Turner [Wed, 17 May 2017 16:39:33 +0000 (16:39 +0000)]
Workaround for incorrect Win32 header on GCC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303272 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CodeView] Simplify the use of visiting type records & streams.
Zachary Turner [Wed, 17 May 2017 16:39:06 +0000 (16:39 +0000)]
[CodeView] Simplify the use of visiting type records & streams.

There is often a lot of boilerplate code required to visit a type
record or type stream.  The #1 use case is that you have a sequence
of bytes that represent one or more records, and you want to
deserialize each one, switch on it, and call a callback with the
deserialized record that the user can examine.  Currently this
requires at least 6 lines of code:

  codeview::TypeVisitorCallbackPipeline Pipeline;
  Pipeline.addCallbackToPipeline(Deserializer);
  Pipeline.addCallbackToPipeline(MyCallbacks);

  codeview::CVTypeVisitor Visitor(Pipeline);
  consumeError(Visitor.visitTypeRecord(Record));

With this patch, it becomes one line of code:

  consumeError(codeview::visitTypeRecord(Record, MyCallbacks));

This is done by having the deserialization happen internally inside
of the visitTypeRecord function.  Since this is occasionally not
desirable, the function provides a 3rd parameter that can be used
to change this behavior.

Hopefully this can significantly reduce the barrier to entry
to using the visitation infrastructure.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303271 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[BitVector] Add find_[first,last]_[set,unset]_in.
Zachary Turner [Wed, 17 May 2017 15:49:45 +0000 (15:49 +0000)]
[BitVector] Add find_[first,last]_[set,unset]_in.

A lot of code is duplicated between the first_last and the
next / prev methods.  All of this code can be shared if they
are implemented in terms of find_first_in(Begin, End) etc,
in which case find_first = find_first_in(0, Size) and find_next
is find_first_in(Prev+1, Size), with similar reductions for
the other methods.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303269 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] add isCanonicalPredicate() helper function and use it; NFCI
Sanjay Patel [Wed, 17 May 2017 14:21:19 +0000 (14:21 +0000)]
[InstCombine] add isCanonicalPredicate() helper function and use it; NFCI

There should be a slight efficiency improvement from handling icmp/fcmp with one matcher and reducing duplicated code.

The larger motivation is that there are questions about how predicate canonicalization is handled, and the refactoring
should make it easier if we want to change any of that behavior.

1. As noted in the code comment, we've chosen 3 of the 16 FCMP preds as not canonical. Why those 3? It goes back to
   rL32751 from what I can tell, but I'm not sure if there's a justification for that rule.
2. We currently do not canonicalize integer select conditions. Should we use the same rule that applies to branches
   for selects?
3. We currently do canonicalize some FP select conditions, and those rules would conflict with the rule shown here.
   Should one or both be changed?

No-functional-change-intended, but adding tests anyway because there's no coverage for most of the predicates.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303261 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[globalisel][tablegen] Import rules containing intrinsic_wo_chain.
Daniel Sanders [Wed, 17 May 2017 13:39:49 +0000 (13:39 +0000)]
[globalisel][tablegen] Import rules containing intrinsic_wo_chain.

Summary:
As of this patch, 1018 out of 3938 rules are currently imported.

Depends on D32275

Reviewers: qcolombet, kristof.beyls, rovka, t.p.northover, ab, aditya_nandakumar

Reviewed By: qcolombet

Subscribers: dberris, igorb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303259 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] Update tests in psubus.ll; NFC
Sanjay Patel [Wed, 17 May 2017 13:39:16 +0000 (13:39 +0000)]
[x86] Update tests in psubus.ll; NFC

Remove unnecessary memops to minimize tests.

Patch by Yulia Koval!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303258 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PPC] Properly update register save area offsets
Krzysztof Parzyszek [Wed, 17 May 2017 13:25:09 +0000 (13:25 +0000)]
[PPC] Properly update register save area offsets

The variables MinGPR/MinG8R were not updated properly when resetting the
offsets, which in the included testcase lead to saving the CR register
in the same location as R30.

This fixes another issue reported in PR26519.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303257 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[GlobalISel][X86] Support add i64 in IA32.
Igor Breger [Wed, 17 May 2017 12:48:08 +0000 (12:48 +0000)]
[GlobalISel][X86] Support add i64 in IA32.

Summary: support G_UADDE instruction selection.

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303255 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SystemZ] Modelling of costs of divisions with a constant power of 2.
Jonas Paulsson [Wed, 17 May 2017 12:46:26 +0000 (12:46 +0000)]
[SystemZ]  Modelling of costs of divisions with a constant power of 2.

Such divisions will eventually be implemented with shifts which should
be reflected in the cost function.

Review: Ulrich Weigand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303254 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[globalisel][tablegen] Require that all registers between instructions of a match...
Daniel Sanders [Wed, 17 May 2017 12:43:30 +0000 (12:43 +0000)]
[globalisel][tablegen] Require that all registers between instructions of a match are virtual.

Summary:
Without this, it's possible to encounter multiple defs for a register.

This is triggered by the current version of D32868 when applied to trunk.

Reviewers: qcolombet, ab, t.p.northover, rovka, kristof.beyls

Reviewed By: qcolombet

Subscribers: llvm-commits, igorb

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303253 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReland r303247: [ARM] GlobalISel: Remove dead instruction selection code
Diana Picus [Wed, 17 May 2017 12:42:52 +0000 (12:42 +0000)]
Reland r303247: [ARM] GlobalISel: Remove dead instruction selection code

It only failed on llvm-clang-x86_64-expensive-checks-win, probably
because the TableGen stuff hasn't been regenerated.
Requires a clean build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303252 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DWARF] - Cleanup relocations proccessing.
George Rimar [Wed, 17 May 2017 12:10:51 +0000 (12:10 +0000)]
[DWARF] - Cleanup relocations proccessing.

RelocAddrMap was a pair of <width, address>, where width is relocation size (4/8/x, x < 8),
and width field was never used in code.

Relocations proccessing loop had checks for width field. Does not look like DWARF parser
should do that. There is probably no much sense to validate relocations during proccessing
them in parser.

Patch removes relocation's width relative code from DWARFContext.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303251 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[ARM] GlobalISel: Remove dead instruction selection code"
Diana Picus [Wed, 17 May 2017 11:56:07 +0000 (11:56 +0000)]
Revert "[ARM] GlobalISel: Remove dead instruction selection code"

This reverts commit r303247 because the tests are failing on some bots.
Sorry!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303249 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] GlobalISel: Remove dead instruction selection code
Diana Picus [Wed, 17 May 2017 11:39:26 +0000 (11:39 +0000)]
[ARM] GlobalISel: Remove dead instruction selection code

We can now generate code for selecting G_ADD, G_SUB and G_MUL. Remove
the hand-written versions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303247 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Sparc] Remove execute permissions from non-executable text files
Daniel Cederman [Wed, 17 May 2017 11:05:20 +0000 (11:05 +0000)]
[Sparc] Remove execute permissions from non-executable text files

Reviewers: jyknight, lero_chris, venkatra

Reviewed By: jyknight

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303245 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFixup r303240: Use llvm::to_string instead of std::to_string
Diana Picus [Wed, 17 May 2017 09:25:08 +0000 (09:25 +0000)]
Fixup r303240: Use llvm::to_string instead of std::to_string

It turns out some of the buildbots don't have std::to_string around,
even in this day and age...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303243 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DebugInfo/DWARF] - Make comments to be in doxygen style. NFCi.
George Rimar [Wed, 17 May 2017 09:00:10 +0000 (09:00 +0000)]
[DebugInfo/DWARF] - Make comments to be in doxygen style. NFCi.

This changes "//" to "///" in llvm/DebugInfo/DWARF folder where appropriate
and also removes few trailing whitespaces.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303241 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[GlobalISel][TableGen] Fix handling of default operands
Diana Picus [Wed, 17 May 2017 08:57:28 +0000 (08:57 +0000)]
[GlobalISel][TableGen] Fix handling of default operands

When looping through a destination pattern's operands to decide how many
default operands we need to introduce, we used to count the "expanded"
number of operands. So if one default operand would be rendered as 2
values, we'd count it as 2 operands, when in fact it needs to count as
only 1 operand regardless of how many values it expands to.

This turns out to be a problem only in some very specific cases, e.g.
when we have one operand with multiple default values followed by more
operands with default values (see the new test). In such a situation
we'd stop looping before looking at all the operands, and then error out
assuming that we don't have enough default operands to make up the
shortfall.

At the moment this only affects ARM.

The patch removes the loop counting default operands entirely and
assumes that we'll have to introduce values for any default operand that
we find (i.e. we're assuming it cannot be given as a child at all). It
also extracts the code for adding renderers for default operands into a
helper method.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303240 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RuntimeDyld] Fix debug section relocation (pr20457)
Pavel Labath [Wed, 17 May 2017 08:47:28 +0000 (08:47 +0000)]
[RuntimeDyld] Fix debug section relocation (pr20457)

Summary:
Debug info sections, (or non-SHF_ALLOC sections in general) should be
linked as if their load address was zero to emulate the behavior of the
static linker.

This bug was discovered because it was breaking lldb expression evaluation on
linux.

Reviewers: lhames

Subscribers: aprantl, eugene, clayborg, lldb-commits, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303239 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMake sure -optimize-regalloc=false is used correctly by user.
Jonas Paulsson [Wed, 17 May 2017 07:36:03 +0000 (07:36 +0000)]
Make sure -optimize-regalloc=false is used correctly by user.

Don't allow -optimize-regalloc=false with -regalloc given for anything other
than 'fast'. The other register allocators depend on the supporting passes
added by addOptimizedRegAlloc().

Reviewers: Quentin Colombet, Matthias Braun
https://reviews.llvm.org/D33181

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303238 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[APInt] Use getWord to shorten some code. NFC
Craig Topper [Wed, 17 May 2017 06:45:30 +0000 (06:45 +0000)]
[APInt] Use getWord to shorten some code. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303236 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SCEV] Always sort AddRecExprs from different loops by dominance
Max Kazantsev [Wed, 17 May 2017 04:09:14 +0000 (04:09 +0000)]
[SCEV] Always sort AddRecExprs from different loops by dominance

Sorting of AddRecExprs by loop nesting does not make sense since we only invoke
the CompareSCEVComplexity for AddRecExprs that are used by one SCEV. This
guarantees that there is always a dominance relationship between them. This
patch removes the sorting by nesting which is a dead code in current usage of
this function.

Reviewed By: sanjoy

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303235 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SCEV][NFC] Replace redundant dyn_cast with cast in getAddExpr
Max Kazantsev [Wed, 17 May 2017 03:58:42 +0000 (03:58 +0000)]
[SCEV][NFC] Replace redundant dyn_cast with cast in getAddExpr

Replace dyn_cast which is ensured by isa just one line above with cast.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303234 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[coroutines] Handle spills before catchswitch
Gor Nishanov [Wed, 17 May 2017 03:09:22 +0000 (03:09 +0000)]
[coroutines] Handle spills before catchswitch

If we need to spill the result of the PHI instruction, we insert the spill after
all of the PHIs and EHPads, however, in a catchswitch block there is no
room to insert the spill. Make room by splitting away catchswitch into a separate
block.

Before the fix:

    catch.dispatch:
       %val = phi i32 [ 1, %if.then ], [ 2, %if.else ]
       %switch = catchswitch within none [label %catch] unwind label %cleanuppad

After:

    catch.dispatch:
       %val = phi i32 [ 1, %if.then ], [ 2, %if.else ]
       %tok = cleanuppad within none []
       ; spill goes here
       cleanupret from %tok unwind label %catch.dispatch.switch
    catch.dispatch.switch:
       %switch = catchswitch within none [label %catch] unwind label %cleanuppad

https://reviews.llvm.org/D31846

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303232 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdded LLVM_DUMP_METHOD attributes for MatchableInfo::dump(). Defined it only if dump...
Galina Kistanova [Wed, 17 May 2017 02:20:05 +0000 (02:20 +0000)]
Added LLVM_DUMP_METHOD attributes for MatchableInfo::dump(). Defined it only if dump is enabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303229 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoBitVector: add iterators for set bits
Francis Visoiu Mistrih [Wed, 17 May 2017 01:07:53 +0000 (01:07 +0000)]
BitVector: add iterators for set bits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303227 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ADT] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
Eugene Zelenko [Tue, 16 May 2017 23:10:25 +0000 (23:10 +0000)]
[ADT] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303221 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix for compilers with older CRT header libraries.
Zachary Turner [Tue, 16 May 2017 22:59:34 +0000 (22:59 +0000)]
Fix for compilers with older CRT header libraries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303220 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Support] Ignore OutputDebugString exceptions in our crash recovery.
Zachary Turner [Tue, 16 May 2017 22:50:32 +0000 (22:50 +0000)]
[Support] Ignore OutputDebugString exceptions in our crash recovery.

Since we use AddVectoredExceptionHandler, we get notified of
every exception that gets raised by a program.  Sometimes these
are not necessarily errors though, and this can be especially
true when linking against a library that we have no control
over, and may raise an exception internally which it intends
to catch.

In particular, the Windows API OutputDebugString does exactly
this.  It raises an exception inside of a __try / __except,
giving the debugger a chance to handle the exception to print
the message to the debug console.

But this doesn't interoperate nicely with our vectored exception
handler, which just sees another exception and decides that we
need to terminate the program.

Add a special case for this so that we ignore ODS exceptions
and continue normally.

Note that a better fix is to simply not use vectored exception
handlers and use SEH instead, but given that MinGW doesn't support
SEH, this is the only solution for MinGW.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303219 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[IR] Prefer use_empty() to !hasNUsesOrMore(1) for clarity.
Davide Italiano [Tue, 16 May 2017 22:38:40 +0000 (22:38 +0000)]
[IR] Prefer use_empty() to !hasNUsesOrMore(1) for clarity.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303218 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[NewGVN] Re-enable test now that the nondeterminism has been fixed.
Davide Italiano [Tue, 16 May 2017 22:27:06 +0000 (22:27 +0000)]
[NewGVN] Re-enable test now that the nondeterminism has been fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303217 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agollvm/test/Transforms/InstCombine/debuginfo-skip.ll REQUIRES +asserts.
NAKAMURA Takumi [Tue, 16 May 2017 22:19:56 +0000 (22:19 +0000)]
llvm/test/Transforms/InstCombine/debuginfo-skip.ll REQUIRES +asserts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303216 91177308-0d34-0410-b5e6-96231b3b80d8