platform/upstream/llvm.git
7 years agoUse a 2 bit pointer in ValueHandleBase::PrevPair; NFC
Sanjoy Das [Mon, 1 May 2017 17:36:12 +0000 (17:36 +0000)]
Use a 2 bit pointer in ValueHandleBase::PrevPair; NFC

This was an omission in r301813.  I had made the supporting changes to
make this happen, but I forgot to actually update the PrevPair
declaration.

llvm-svn: 301817

7 years agoTake indirect branch into account as well when folding.
Xin Tong [Mon, 1 May 2017 17:15:37 +0000 (17:15 +0000)]
Take indirect branch into account as well when folding.

We may not be able to rewrite indirect branch target, but we also want to take it into
account when folding, i.e. if it and all its successor's predecessors go to the same
destination, we can fold, i.e. no need to thread.

llvm-svn: 301816

7 years agoAdapt to LLVM's rename of WeakVH to WeakTrackingVH; NFC
Sanjoy Das [Mon, 1 May 2017 17:08:00 +0000 (17:08 +0000)]
Adapt to LLVM's rename of WeakVH to WeakTrackingVH; NFC

llvm-svn: 301815

7 years agoUse WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts
Sanjoy Das [Mon, 1 May 2017 17:07:56 +0000 (17:07 +0000)]
Use WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts

In cases where an instruction (a call site, say) is RAUW'ed with some
other value (this is possible via the `returned` attribute, for
instance), we want the slot in UnknownInsts to point to the original
Instruction we wanted to track, not the value it got replaced by.

Fixes PR32587.

This relands r301426.

llvm-svn: 301814

7 years agoAdd a new WeakVH value handle; NFC
Sanjoy Das [Mon, 1 May 2017 17:07:54 +0000 (17:07 +0000)]
Add a new WeakVH value handle; NFC

This relands r301425.

llvm-svn: 301813

7 years agoRename WeakVH to WeakTrackingVH; NFC
Sanjoy Das [Mon, 1 May 2017 17:07:49 +0000 (17:07 +0000)]
Rename WeakVH to WeakTrackingVH; NFC

This relands r301424.

llvm-svn: 301812

7 years ago[WebAssembly] Fix use of SDNodeFlags after API change in r301803
Derek Schuff [Mon, 1 May 2017 16:49:39 +0000 (16:49 +0000)]
[WebAssembly] Fix use of SDNodeFlags after API change in r301803

llvm-svn: 301811

7 years ago[PDB/CodeView] Rename some classes.
Zachary Turner [Mon, 1 May 2017 16:46:39 +0000 (16:46 +0000)]
[PDB/CodeView] Rename some classes.

In preparation for introducing writing capabilities for each of
these classes, I would like to adopt a Foo / FooRef naming
convention, where Foo indicates that the class can manipulate and
serialize Foos, and FooRef indicates that it is an immutable view of
an existing Foo.  In other words, Foo is a writer and FooRef is a
reader.  This patch names some existing readers to conform to the
FooRef convention, while offering no functional change.

llvm-svn: 301810

7 years agoEmulate TrackingVH using WeakVH
Sanjoy Das [Mon, 1 May 2017 16:28:58 +0000 (16:28 +0000)]
Emulate TrackingVH using WeakVH

Summary:
This frees up one slot in the HandleBaseKind enum, which I will use
later to add a new kind of value handle.  The size of the
HandleBaseKind enum is important because we store a HandleBaseKind in
the low two bits of a (in the worst case) 4 byte aligned pointer.

Reviewers: davide, chandlerc

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 301809

7 years ago[JumpThread] Add some assertions for expected ConstantInt/BlockAddress
Xin Tong [Mon, 1 May 2017 16:19:59 +0000 (16:19 +0000)]
[JumpThread] Add some assertions for expected ConstantInt/BlockAddress

llvm-svn: 301808

7 years agoRemove unnecessary conditions as suggested by clang-tidy. NFC
Gabor Horvath [Mon, 1 May 2017 16:18:42 +0000 (16:18 +0000)]
Remove unnecessary conditions as suggested by clang-tidy. NFC

Patch by: Gergely Angeli!

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

llvm-svn: 301807

7 years ago[SelectionDAG] Use known ones to provide a better bound for the known zeros for CTTZ...
Craig Topper [Mon, 1 May 2017 16:08:06 +0000 (16:08 +0000)]
[SelectionDAG] Use known ones to provide a better bound for the known zeros for CTTZ/CTLZ operations.

This is the SelectionDAG version of D32521. If know where at least one 1 is located in the input to these intrinsics we can place an upper bound on the number of bits needed to represent the count and thus increase the number of known zeros in the output.

I think we can also refine this further for CTTZ_UNDEF/CTLZ_UNDEF by assuming that the answer will never be BitWidth. I've left this out for now because it caused other test failures across multiple targets. Usually because of turning ADD into OR based on this new information.

I'll fix CTPOP in a future patch.

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

llvm-svn: 301806

7 years agoRelax testcase to fix a PS4 buildbot failure.
Adrian Prantl [Mon, 1 May 2017 15:49:40 +0000 (15:49 +0000)]
Relax testcase to fix a PS4 buildbot failure.

llvm-svn: 301805

7 years ago[JumpThread] Do RAUW in case Cond folds to a constant in the CFG
Xin Tong [Mon, 1 May 2017 15:34:17 +0000 (15:34 +0000)]
[JumpThread] Do RAUW in case Cond folds to a constant in the CFG

Summary: [JumpThread] Do RAUW in case Cond folds to a constant in the CFG

Reviewers: sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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

llvm-svn: 301804

7 years agoGeneralize the specialized flag-carrying SDNodes by moving flags into SDNode.
Amara Emerson [Mon, 1 May 2017 15:17:51 +0000 (15:17 +0000)]
Generalize the specialized flag-carrying SDNodes by moving flags into SDNode.

This removes BinaryWithFlagsSDNode, and flags are now all passed by value.

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

llvm-svn: 301803

7 years ago[InstCombine] add multi-use variants for DeMorgan folds; NFC
Sanjay Patel [Mon, 1 May 2017 14:52:17 +0000 (14:52 +0000)]
[InstCombine] add multi-use variants for DeMorgan folds; NFC

llvm-svn: 301802

7 years ago[InstCombine] use FileCheck and auto-generate checks; NFC
Sanjay Patel [Mon, 1 May 2017 14:20:30 +0000 (14:20 +0000)]
[InstCombine] use FileCheck and auto-generate checks; NFC

llvm-svn: 301801

7 years ago[InstCombine] consolidate more DeMorgan tests; NFC
Sanjay Patel [Mon, 1 May 2017 14:10:59 +0000 (14:10 +0000)]
[InstCombine] consolidate more DeMorgan tests; NFC

llvm-svn: 301800

7 years agoFix test for altmacro
Michael Zuckerman [Mon, 1 May 2017 14:00:54 +0000 (14:00 +0000)]
Fix test for altmacro

llvm-svn: 301799

7 years ago[powerpc] deactivate flakey tests on powerpc64le
Bill Seurer [Mon, 1 May 2017 13:56:04 +0000 (13:56 +0000)]
[powerpc] deactivate flakey tests on powerpc64le

These test cases occassionally fail when run on powerpc64le:

ignore_lib1.cc
ignore_lib5.cc
TestCases/Posix/current_allocated_bytes.cc
rtl/TsanRtlTest/Posix.ThreadLocalAccesses
TestCases/Posix/coverage-fork-direct.cc

The failures cause false problem reports to be sent to developers whose
code had nothing to do with the failures.  Reactivate them when the real
problems are fixed.

This could also be related to the same problems as with the tests
ThreadedOneSizeMallocStressTest, ThreadedMallocStressTest, ManyThreadsTest,
and several others that do not run reliably on powerpc.

llvm-svn: 301798

7 years ago[LLVM][inline-asm] Altmacro absolute expression '%' feature
Michael Zuckerman [Mon, 1 May 2017 13:20:12 +0000 (13:20 +0000)]
[LLVM][inline-asm] Altmacro absolute expression '%' feature

In this patch, I introduce a new alt macro feature.
This feature adds meaning for the % when using it as a prefix to the calling macro arguments.

In the altmacro mode, the percent sign '%' before an absolute expression convert the expression first to a string.
As described in the https://sourceware.org/binutils/docs-2.27/as/Altmacro.html
"Expression results as strings
You can write `%expr' to evaluate the expression expr and use the result as a string."

expression assumptions:

1. '%' can only evaluate an absolute expression.
2. Altmacro '%' must be the first character of the evaluated expression.
3. If no '%' is located before the expression, a regular module operation is expected.
4. The result of Absolute Expressions can be only integer.

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

llvm-svn: 301797

7 years agoThe -coverage-file flag was removed in r280306, and this piece was missed; NFC.
Aaron Ballman [Mon, 1 May 2017 13:05:04 +0000 (13:05 +0000)]
The -coverage-file flag was removed in r280306, and this piece was missed; NFC.

llvm-svn: 301796

7 years agotsan: support linker init flag in __tsan_mutex_destroy
Dmitry Vyukov [Mon, 1 May 2017 10:01:13 +0000 (10:01 +0000)]
tsan: support linker init flag in __tsan_mutex_destroy

For a linker init mutex with lazy flag setup
(no __tsan_mutex_create call), it is possible that
no lock/unlock happened before the destroy call.
Then when destroy runs we still don't know that
it is a linker init mutex and will emulate a memory write.
This in turn can lead to false positives as the mutex
is in fact linker initialized.

Support linker init flag in destroy annotation to resolve this.

llvm-svn: 301795

7 years ago[AVR] Implement non-constant bit rotations
Dylan McKay [Mon, 1 May 2017 09:48:55 +0000 (09:48 +0000)]
[AVR] Implement non-constant bit rotations

This lets us do bit rotations of variable amount.

llvm-svn: 301794

7 years ago[GlobalISel][X86] rename test file. NFC.
Igor Breger [Mon, 1 May 2017 08:11:02 +0000 (08:11 +0000)]
[GlobalISel][X86] rename test file. NFC.

llvm-svn: 301793

7 years ago[GlobalISel][X86] Prioritize Tablegen-erated instruction selection. NFC
Igor Breger [Mon, 1 May 2017 07:06:08 +0000 (07:06 +0000)]
[GlobalISel][X86] Prioritize Tablegen-erated instruction selection. NFC

Summary:
Prioritizes Tablegen-erated instruction selection over C++ instruction selection.
Remove G_ADD/G_SUB C++ selection - implemented by Tablegen.

Reviewers: dsanders, zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, llvm-commits, kristof.beyls

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

llvm-svn: 301792

7 years ago[X86] Add tests for opportunities to improve known bits for CTTZ and CTLZ.
Craig Topper [Mon, 1 May 2017 06:33:17 +0000 (06:33 +0000)]
[X86] Add tests for opportunities to improve known bits for CTTZ and CTLZ.

llvm-svn: 301791

7 years ago[GlobalISel][X86] G_SEXT/G_ZEXT support.
Igor Breger [Mon, 1 May 2017 06:30:16 +0000 (06:30 +0000)]
[GlobalISel][X86] G_SEXT/G_ZEXT support.

Reviewers: zvi, guyblank

Reviewed By: zvi

Subscribers: rovka, llvm-commits, kristof.beyls

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

llvm-svn: 301790

7 years agoRemove unneeded struct; NFC
Sanjoy Das [Mon, 1 May 2017 06:12:13 +0000 (06:12 +0000)]
Remove unneeded struct; NFC

Summary:
Unless I'm missing something, the DeferredGlobal struct's GV field is
unused, removing which makes the struct itself trivial.

Reviewers: rafael, chandlerc

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 301789

7 years ago[GlobalISel][X86] G_LOAD/G_STORE pointer selection support.
Igor Breger [Mon, 1 May 2017 06:08:32 +0000 (06:08 +0000)]
[GlobalISel][X86] G_LOAD/G_STORE pointer selection support.

Summary: [GlobalISel][X86] G_LOAD/G_STORE pointer selection support.

Reviewers: zvi, guyblank

Reviewed By: zvi, guyblank

Subscribers: dberris, rovka, kristof.beyls, llvm-commits

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

llvm-svn: 301788

7 years agoFix test that was incorrected merged between patches.
Nick Lewycky [Mon, 1 May 2017 02:20:06 +0000 (02:20 +0000)]
Fix test that was incorrected merged between patches.

llvm-svn: 301787

7 years agoFix line endings (dos -> unix) and clang-format while I'm here
David Blaikie [Mon, 1 May 2017 02:11:39 +0000 (02:11 +0000)]
Fix line endings (dos -> unix) and clang-format while I'm here

llvm-svn: 301786

7 years agoHandle expressions with non-literal types like ignored expressions if we are supposed...
Nick Lewycky [Mon, 1 May 2017 02:03:23 +0000 (02:03 +0000)]
Handle expressions with non-literal types like ignored expressions if we are supposed to continue evaluating them.

Also fix a crash casting a derived nullptr to a virtual base.

llvm-svn: 301785

7 years ago[XRay][compiler-rt] Document and update the XRay Logging API
Dean Michael Berris [Mon, 1 May 2017 00:52:57 +0000 (00:52 +0000)]
[XRay][compiler-rt] Document and update the XRay Logging API

Summary:
In this patch we document the requirements for implementations that want
to install handlers for the dynamically-controlled XRay "framework".
This clarifies what the expectations are for implementations that
want to install their handlers using this API (similar to how the FDR
logging implementation does so). It also gives users some guarantees on
semantics for the APIs.

If all goes well, users can decide to use the XRay APIs to control the
tracing/logging at the application level, without having to depend on
implementation details of the installed logging implementation. This
lets users choose the implementation that comes with compiler-rt, or
potentially multiple other implementations that use the same APIs.

We also add one convenience function (__xray_remove_log_impl()) for
explicitly removing the currently installed log implementation.

Reviewers: kpw, pelikan

Subscribers: llvm-commits

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

llvm-svn: 301784

7 years agoutils: Silence -Wpedantic warning
Saleem Abdulrasool [Mon, 1 May 2017 00:26:59 +0000 (00:26 +0000)]
utils: Silence -Wpedantic warning

llvm/tools/clang/utils/TableGen/ClangAttrEmitter.cpp:1673:67: warning: default argument specified for lambda parameter [-Wpedantic]
                    const Record *Constraint = nullptr) {
                                               ^~~~~~~

Found by gcc 5.4.0.

llvm-svn: 301783

7 years ago[AVR] Fix a bug so that we now emit R_AVR_16 fixups with the correct offset
Dylan McKay [Sun, 30 Apr 2017 23:33:52 +0000 (23:33 +0000)]
[AVR] Fix a bug so that we now emit R_AVR_16 fixups with the correct offset

Before this, the LDS/STS instructions would have their opcodes
overwritten while linking.

llvm-svn: 301782

7 years ago[DAGCombiner] shrink/widen a vselect to match its condition operand size (PR14657)
Sanjay Patel [Sun, 30 Apr 2017 22:44:51 +0000 (22:44 +0000)]
[DAGCombiner] shrink/widen a vselect to match its condition operand size (PR14657)

We discussed shrinking/widening of selects in IR in D26556, and I'll try to get back to that
patch eventually. But I'm hoping that this transform is less iffy in the DAG where we can check
legality of the select that we want to produce.

A few things to note:

1. We can't wait until after legalization and do this generically because (at least in the x86
   tests from PR14657), we'll have PACKSS and bitcasts in the pattern.
2. This might benefit more of the SSE codegen if we lifted the legal-or-custom requirement, but
   that requires a closer look to make sure we don't end up worse.
3. There's a 'vblendv' opportunity that we're missing that results in andn/and/or in some cases.
   That should be fixed next.
4. I'm assuming that AVX1 offers the worst of all worlds wrt uneven ISA support with multiple
   legal vector sizes, but if there are other targets like that, we should add more tests.
5. There's a codegen miracle in the multi-BB tests from PR14657 (the gcc auto-vectorization tests):
   despite IR that is terrible for the target, this patch allows us to generate the optimal loop
   code because something post-ISEL is hoisting the splat extends above the vector loops.

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

llvm-svn: 301781

7 years ago[clang-tidy] Fix naming convention in modernize-use-emplace
Jakub Kuderski [Sun, 30 Apr 2017 21:12:56 +0000 (21:12 +0000)]
[clang-tidy] Fix naming convention in modernize-use-emplace

Summary: Conform to the llvm naming convention for local variables in modernize-use-emplace check.

Reviewers: Prazek, JonasToth, alexfh

Reviewed By: Prazek, JonasToth, alexfh

Subscribers: cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 301780

7 years ago[CMake] Move PollyCore to Polly project folder.
Michael Kruse [Sun, 30 Apr 2017 21:07:05 +0000 (21:07 +0000)]
[CMake] Move PollyCore to Polly project folder.

This keeps the artifacts consistently structured in the "Polly"
folder of Visual Studio solutions.

llvm-svn: 301779

7 years agoFix comments.
Rui Ueyama [Sun, 30 Apr 2017 20:58:20 +0000 (20:58 +0000)]
Fix comments.

llvm-svn: 301778

7 years ago[tsan] Track external tags in thread traces
Kuba Mracek [Sun, 30 Apr 2017 20:35:18 +0000 (20:35 +0000)]
[tsan] Track external tags in thread traces

To make the TSan external API work with Swift and other use cases, we need to track "tags" for individual memory accesses. Since there is no space to store this information in shadow cells, let's use the thread traces for that. This patch stores the tag as an extra frame in the stack traces (by calling FuncEntry and FuncExit with the address of a registered tag), this extra frame is then stripped before printing the backtrace to stderr.

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

llvm-svn: 301777

7 years agoRename isKnownNotFullPoison to programUndefinedIfPoison; NFC
Sanjoy Das [Sun, 30 Apr 2017 19:41:19 +0000 (19:41 +0000)]
Rename isKnownNotFullPoison to programUndefinedIfPoison; NFC

Summary:
programUndefinedIfPoison makes more sense, given what the function
does; and I'm about to add a function with a name similar to
isKnownNotFullPoison (so do the rename to avoid confusion).

Reviewers: broune, majnemer, bjarke.roune

Reviewed By: broune

Subscribers: mcrosier, llvm-commits, mzolotukhin

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

llvm-svn: 301776

7 years agoDo not legalize large add with addc/adde, introduce addcarry and do it with uaddo...
Amaury Sechet [Sun, 30 Apr 2017 19:24:09 +0000 (19:24 +0000)]
Do not legalize large add with addc/adde, introduce addcarry and do it with uaddo/addcarry

Summary: As per discution on how to get better codegen an large int legalization, it became clear that using a glue for the carry was preventing several desirable optimizations. Passing the carry down as a value allow for more flexibility.

Reviewers: jyknight, nemanjai, mkuper, spatel, RKSimon, zvi, bkramer

Subscribers: igorb, llvm-commits

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

llvm-svn: 301775

7 years ago[InstCombine] consolidate tests for DeMorgan folds; NFC
Sanjay Patel [Sun, 30 Apr 2017 18:57:12 +0000 (18:57 +0000)]
[InstCombine] consolidate tests for DeMorgan folds; NFC

I'm proposing to add tests and change behavior in D32665.

llvm-svn: 301774

7 years ago[docs] Simplify some language for Error/cantFail in the programmer's manual.
Lang Hames [Sun, 30 Apr 2017 17:24:52 +0000 (17:24 +0000)]
[docs] Simplify some language for Error/cantFail in the programmer's manual.

llvm-svn: 301773

7 years agoIgnore -no-keep-memory.
Rui Ueyama [Sun, 30 Apr 2017 13:45:06 +0000 (13:45 +0000)]
Ignore -no-keep-memory.

When the -no-keep-memory option is given, BFD linker tries to save
memory in their own way. Since our internal architecture is completely
different from that linker, that option doesn't make sense to us.

llvm-svn: 301772

7 years agoMove LTO options above "all options beyond this are ignored" comment
Rui Ueyama [Sun, 30 Apr 2017 13:44:52 +0000 (13:44 +0000)]
Move LTO options above "all options beyond this are ignored" comment

llvm-svn: 301771

7 years ago[MVT] fix typo in size of v1i8 MVT.
Guy Blank [Sun, 30 Apr 2017 12:47:57 +0000 (12:47 +0000)]
[MVT] fix typo in size of v1i8 MVT.

Ths issue was found in the review of another patch https://reviews.llvm.org/D32540

llvm-svn: 301770

7 years ago[APInt] Remove support for wrapping from APInt::setBits.
Craig Topper [Sun, 30 Apr 2017 07:45:01 +0000 (07:45 +0000)]
[APInt] Remove support for wrapping from APInt::setBits.

This features isn't used anywhere in tree. It's existence seems to be preventing selfhost builds from inlining any of the setBits methods including setLowBits, setHighBits, and setBitsFrom. This is because the code makes the method recursive.

If anyone needs this feature in the future we could consider adding a setBitsWithWrap method. This way only the calls that need it would pay for it.

llvm-svn: 301769

7 years ago[APInt] Replace calls to setBits with more specific calls to setBitsFrom and setLowBi...
Craig Topper [Sun, 30 Apr 2017 07:44:58 +0000 (07:44 +0000)]
[APInt] Replace calls to setBits with more specific calls to setBitsFrom and setLowBits where possible.

llvm-svn: 301768

7 years ago[X86] Clear KnownBits instead of reconstructing it. NFC
Craig Topper [Sun, 30 Apr 2017 07:44:55 +0000 (07:44 +0000)]
[X86] Clear KnownBits instead of reconstructing it. NFC

llvm-svn: 301767

7 years agoInstructionSimplify: Canonicalize shuffle operands. NFC-ish.
Zvi Rackover [Sun, 30 Apr 2017 06:25:04 +0000 (06:25 +0000)]
InstructionSimplify: Canonicalize shuffle operands. NFC-ish.

Summary:
 Apply canonicalization rules:
    1. Input vectors with no elements selected from can be replaced with undef.
    2. If only one input vector is constant it shall be the second one.

This allows constant-folding to cover more ad-hoc simplifications that
were in place and avoid duplication for RHS and LHS checks.

There are more rules we may want to add in the future when we see a
justification. e.g. mask elements that select undef elements can be
replaced with undef.

Reviewers: spatel, RKSimon, andreadb, davide

Reviewed By: spatel, RKSimon

Subscribers: llvm-commits

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

llvm-svn: 301766

7 years agoInstructionSimplify: One getShuffleMask() replacing multiple getMaskValue(). NFC.
Zvi Rackover [Sun, 30 Apr 2017 06:10:54 +0000 (06:10 +0000)]
InstructionSimplify: One getShuffleMask() replacing multiple getMaskValue(). NFC.

Summary: This is a preparatory step for D32338.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon, spatel

Subscribers: spatel, llvm-commits

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

llvm-svn: 301765

7 years agoInstructionSimplify: Simplify a shuffle with a undef mask to undef
Zvi Rackover [Sun, 30 Apr 2017 06:06:26 +0000 (06:06 +0000)]
InstructionSimplify: Simplify a shuffle with a undef mask to undef

Summary:
Following the discussion in pr32486, adding the simplification:
 shuffle %x, %y, undef -> undef

Reviewers: spatel, RKSimon, andreadb, davide

Reviewed By: spatel

Subscribers: jroelofs, davide, llvm-commits

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

llvm-svn: 301764

7 years ago[mips] Emit R_MICROMIPS_TLS_GOTTPREL relocation for %gottprel in case of microMIPS
Simon Atanasyan [Sun, 30 Apr 2017 04:27:23 +0000 (04:27 +0000)]
[mips] Emit R_MICROMIPS_TLS_GOTTPREL relocation for %gottprel in case of microMIPS

In case of microMIPS mode %gottprel operator should emit microMIPS
relocation R_MICROMIPS_TLS_GOTTPREL, not R_MIPS_TLS_GOTTPREL.

Differential Revision: http://reviews.llvm.org/D32617

llvm-svn: 301763

7 years agoclang-tools-extra/test/CMakeLists.txt: Rework r297806 (D29851) to make sure test...
NAKAMURA Takumi [Sun, 30 Apr 2017 03:19:04 +0000 (03:19 +0000)]
clang-tools-extra/test/CMakeLists.txt: Rework r297806 (D29851) to make sure test utils should be built.

FIXME: This may be moved to llvm's add_lit_target().
llvm-svn: 301762

7 years ago[ConstantRange] Fix a couple cases where we were possibly throwing away an APInt...
Craig Topper [Sun, 30 Apr 2017 00:44:05 +0000 (00:44 +0000)]
[ConstantRange] Fix a couple cases where we were possibly throwing away an APInt allocation we could reuse. NFC

This uses setAllBits to replace getMaxValue and operator=(uint64_t) instead of constructing an APInt from uint64_t.

llvm-svn: 301761

7 years agoInclude <cstdio> in PrettyStackTrace.cpp, since it uses vsnprintf(3).
Dimitry Andric [Sat, 29 Apr 2017 23:45:30 +0000 (23:45 +0000)]
Include <cstdio> in PrettyStackTrace.cpp, since it uses vsnprintf(3).

llvm-svn: 301760

7 years agoRename RPath Rpath for consistency. NFC.
Rui Ueyama [Sat, 29 Apr 2017 23:06:43 +0000 (23:06 +0000)]
Rename RPath Rpath for consistency. NFC.

For an option -foo-bar-baz, we have Config->FooBarBaz. Since -rpath is
-rpath and not -r-path, it should be Config->Rpath instead Config->RPath.

llvm-svn: 301759

7 years agoSimplify by using getString instead of getLastArg. NFC.
Rui Ueyama [Sat, 29 Apr 2017 22:56:38 +0000 (22:56 +0000)]
Simplify by using getString instead of getLastArg. NFC.

llvm-svn: 301758

7 years agoReport an error if --compress-debug-sections is given while zlib is not availble.
Rui Ueyama [Sat, 29 Apr 2017 22:56:24 +0000 (22:56 +0000)]
Report an error if --compress-debug-sections is given while zlib is not availble.

llvm-svn: 301757

7 years ago[globalisel][tablegen] Fix the test after silencing the unused variable warning in...
Daniel Sanders [Sat, 29 Apr 2017 19:46:27 +0000 (19:46 +0000)]
[globalisel][tablegen] Fix the test after silencing the unused variable warning in r301755.

llvm-svn: 301756

7 years ago[globalisel][tablegen] Silence unused variable warning.
Daniel Sanders [Sat, 29 Apr 2017 19:10:19 +0000 (19:10 +0000)]
[globalisel][tablegen] Silence unused variable warning.

llvm-svn: 301755

7 years agoPort recent changes to ELF/MapFile.cpp to COFF.
Rui Ueyama [Sat, 29 Apr 2017 18:50:39 +0000 (18:50 +0000)]
Port recent changes to ELF/MapFile.cpp to COFF.

llvm-svn: 301754

7 years ago[ConstantRange] Use APInt::getOneBitSet to shorten some code. NFC
Craig Topper [Sat, 29 Apr 2017 17:59:41 +0000 (17:59 +0000)]
[ConstantRange] Use APInt::getOneBitSet to shorten some code. NFC

llvm-svn: 301753

7 years ago[ConstantRange] Replace getMaxValue+zext with getLowBitsSet. Replace zero-init+setBit...
Craig Topper [Sat, 29 Apr 2017 17:46:13 +0000 (17:46 +0000)]
[ConstantRange] Replace getMaxValue+zext with getLowBitsSet. Replace zero-init+setBit with getOneBitSet. NFC

llvm-svn: 301752

7 years ago[ConstantRange] Use APInt::operator-= to remove temporary APInts.
Craig Topper [Sat, 29 Apr 2017 17:46:11 +0000 (17:46 +0000)]
[ConstantRange] Use APInt::operator-= to remove temporary APInts.

llvm-svn: 301751

7 years ago[globalisel][tablegen] Compute available feature bits correctly.
Daniel Sanders [Sat, 29 Apr 2017 17:30:09 +0000 (17:30 +0000)]
[globalisel][tablegen] Compute available feature bits correctly.

Summary:
Predicate<> now has a field to indicate how often it must be recomputed.
Currently, there are two frequencies, per-module (RecomputePerFunction==0)
and per-function (RecomputePerFunction==1). Per-function predicates are
currently recomputed more frequently than necessary since the only predicate
in this category is cheap to test. Per-module predicates are now computed in
getSubtargetImpl() while per-function predicates are computed in selectImpl().

Tablegen now manages the PredicateBitset internally. It should only be
necessary to add the required includes.

Also fixed a problem revealed by the test case where
constrainSelectedInstRegOperands() would attempt to tie operands that
BuildMI had already tied.

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

Reviewed By: rovka

Subscribers: kristof.beyls, igorb, llvm-commits

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

llvm-svn: 301750

7 years ago[X86][AVX] Added support for _mm256_zext* helper intrinsics (PR32839)
Simon Pilgrim [Sat, 29 Apr 2017 17:17:06 +0000 (17:17 +0000)]
[X86][AVX] Added support for _mm256_zext* helper intrinsics (PR32839)

llvm-svn: 301749

7 years ago[X86][AVX] Added codegen tests for _mm256_zext* helper intrinsics (PR32839)
Simon Pilgrim [Sat, 29 Apr 2017 17:15:12 +0000 (17:15 +0000)]
[X86][AVX] Added codegen tests for _mm256_zext* helper intrinsics (PR32839)

Not great codegen, especially as VEX moves support implicit zeroing of upper bits....

llvm-svn: 301748

7 years ago[KnownBits] Add methods for determining if the known bits represent a negative/nonneg...
Craig Topper [Sat, 29 Apr 2017 16:43:11 +0000 (16:43 +0000)]
[KnownBits] Add methods for determining if the known bits represent a negative/nonnegative number and add methods for changing the negative/nonnegative state

Summary: This patch adds isNegative, isNonNegative for querying whether the sign bit is known. It also adds makeNegative and makeNonNegative for controlling the sign bit.

Reviewers: RKSimon, spatel, davide

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 301747

7 years ago[mips][FastISel] Fix a nullptr deference.
Simon Dardis [Sat, 29 Apr 2017 16:31:40 +0000 (16:31 +0000)]
[mips][FastISel] Fix a nullptr deference.

r301392 introduced a potential nullptr deference causing compilation
failures.

llvm-svn: 301746

7 years agoBring back r301678.
Rafael Espindola [Sat, 29 Apr 2017 15:44:03 +0000 (15:44 +0000)]
Bring back r301678.

This version uses a set to speed up the synchronize method.

Original message:

    Remove LinkerScript::flush.

    This patch replaces flush with a last ditch attempt at synchronizing
    the section list with the linker script "AST".

    The synchronization is a bit of a hack and should in time be avoided
    by creating the AST earlier so that modifications can be made directly
    to it instead of modifying the section list and synchronizing it back.

    This is the main step for fixing
    https://bugs.llvm.org/show_bug.cgi?id=32816. With this in place I
    think the only missing thing would be to have processCommands assign
    section indexes as dummy offsets so that the sort in
    OutputSection::finalize works.

    With this LinkerScript::assignAddresses becomes much simpler, which
    should help with the thunk work.

llvm-svn: 301745

7 years ago[X86][SSE] Add initial <2 x half> tests for PR31088
Simon Pilgrim [Sat, 29 Apr 2017 14:29:06 +0000 (14:29 +0000)]
[X86][SSE] Add initial <2 x half> tests for PR31088

As discussed on D32391, test X86/X64 SSE2 and X64 F16C.

llvm-svn: 301744

7 years ago[clang-tidy] Expand AllowConditional*Casts to binary logical operators
Alexander Kornienko [Sat, 29 Apr 2017 12:06:45 +0000 (12:06 +0000)]
[clang-tidy] Expand AllowConditional*Casts to binary logical operators

llvm-svn: 301743

7 years agoRemove Sema::CheckForIntOverflow, and instead check all full-expressions.
Nick Lewycky [Sat, 29 Apr 2017 09:33:46 +0000 (09:33 +0000)]
Remove Sema::CheckForIntOverflow, and instead check all full-expressions.

CheckForIntOverflow used to implement a whitelist of top-level expressions to
send to the constant expression evaluator, which handled many more expressions
than the CheckForIntOverflow whitelist did.

llvm-svn: 301742

7 years ago[ConstantRange] Use ternary operator instead of 'if' to avoid copying an APInt and...
Craig Topper [Sat, 29 Apr 2017 07:24:13 +0000 (07:24 +0000)]
[ConstantRange] Use ternary operator instead of 'if' to avoid copying an APInt and then possibly copying over it.

llvm-svn: 301741

7 years ago[ConstantRange] Add std::move to a bunch of places that pass local APInts to Constant...
Craig Topper [Sat, 29 Apr 2017 06:40:47 +0000 (06:40 +0000)]
[ConstantRange] Add std::move to a bunch of places that pass local APInts to ConstantRange constructor.

The ConstantRange constructor takes APInt by value so without these moves we are making copies.

llvm-svn: 301740

7 years agoRemove unused private field.
Zachary Turner [Sat, 29 Apr 2017 05:30:19 +0000 (05:30 +0000)]
Remove unused private field.

llvm-svn: 301738

7 years ago[ConstantRange] Remove a temporary APInt I meant to delete in r300621. NFC
Craig Topper [Sat, 29 Apr 2017 05:24:34 +0000 (05:24 +0000)]
[ConstantRange] Remove a temporary APInt I meant to delete in r300621. NFC

llvm-svn: 301737

7 years ago[ConstantRange] Improve the efficiency of one of the ConstantRange constructors.
Craig Topper [Sat, 29 Apr 2017 05:08:52 +0000 (05:08 +0000)]
[ConstantRange] Improve the efficiency of one of the ConstantRange constructors.

We were default constructing the Lower/Upper APInts. Then creating min or max value, then doing a move assignment to Lower and copy assignment to upper. The copy assignment operator in particular has an out of line function call that has to examine whether or not a previous allocation exists that can be reused which of course it can't in this case.

The new code creates the min/max value first, move constructs Lower from it then copy constructs Upper from Lower.

This also seems to have convinced a self host build that this constructor can be inlined more readily into other methods in ConstantRange.

llvm-svn: 301736

7 years agoFix PR32831: 'this capture while instantiating generic lambda call operator specializ...
Faisal Vali [Sat, 29 Apr 2017 03:49:17 +0000 (03:49 +0000)]
Fix PR32831: 'this capture while instantiating generic lambda call operator specialization

When computing the appropriate cv-qualifiers for the 'this' capture, we have to examine each enclosing lambda - but when using the FunctionScopeInfo stack we have to ensure that the lambda below (outer) is the decl-context of the closure-class of the current lambda.

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

llvm-svn: 301735

7 years ago[Polly] Make PollyCore depends on intrinsics_gen
Hongbin Zheng [Sat, 29 Apr 2017 03:12:17 +0000 (03:12 +0000)]
[Polly] Make PollyCore depends on intrinsics_gen

llvm-svn: 301734

7 years agoRemove some apparently-unnecessary 'REQUIRES: system-darwin' from tests.
Richard Smith [Sat, 29 Apr 2017 01:38:29 +0000 (01:38 +0000)]
Remove some apparently-unnecessary 'REQUIRES: system-darwin' from tests.

Let's see if any buildbots actually have trouble with these. (They at least pass on Linux.)

llvm-svn: 301732

7 years agoFix "REQUIRES: system-darwin" failing tests after r301725.
Richard Smith [Sat, 29 Apr 2017 01:29:44 +0000 (01:29 +0000)]
Fix "REQUIRES: system-darwin" failing tests after r301725.

Also remove the apparently-unneeded REQUIRES (the tests also pass on at least
Linux, and don't appear to have anything Darwin-specific in them).

llvm-svn: 301731

7 years agoAMDGPU: Fix copies from physical registers in SIFixSGPRCopies
Matt Arsenault [Sat, 29 Apr 2017 01:26:34 +0000 (01:26 +0000)]
AMDGPU: Fix copies from physical registers in SIFixSGPRCopies

This would assert when there were multiple defs of
a physical register.

We just need to move all of the users of it.

llvm-svn: 301730

7 years ago[ELF] When a rel points to a SHF_MERGE section, don't merge the sec.
Davide Italiano [Sat, 29 Apr 2017 01:24:34 +0000 (01:24 +0000)]
[ELF] When a rel points to a SHF_MERGE section, don't merge the sec.

Fixes PR32785. Thanks to Piotr Padlewski for the report and
Rafael for the fix.

llvm-svn: 301729

7 years ago[llvm-pdbdump] Abstract some of the YAML/Raw printing code.
Zachary Turner [Sat, 29 Apr 2017 01:13:21 +0000 (01:13 +0000)]
[llvm-pdbdump] Abstract some of the YAML/Raw printing code.

There is a lot of duplicate code for printing line info between
YAML and the raw output printer.  This introduces a base class
that can be shared between the two, and makes some minor
cleanups in the process.

llvm-svn: 301728

7 years agoPR26771: don't forget the " 2" (returning from #included file) linemarker after inclu...
Richard Smith [Sat, 29 Apr 2017 00:54:03 +0000 (00:54 +0000)]
PR26771: don't forget the " 2" (returning from #included file) linemarker after including an empty file with -frewrite-includes.

llvm-svn: 301727

7 years agoRemove unused, empty test directories.
Richard Smith [Sat, 29 Apr 2017 00:46:27 +0000 (00:46 +0000)]
Remove unused, empty test directories.

llvm-svn: 301726

7 years agoAdd pragma to perform module import and use it in -E output.
Richard Smith [Sat, 29 Apr 2017 00:34:47 +0000 (00:34 +0000)]
Add pragma to perform module import and use it in -E output.

Many of our supported configurations support modules but do not have any
first-class syntax to perform a module import. This leaves us with a problem:
there is no way to represent the expansion of a #include that imports a module
in the -E output for such languages. (We don't want to just leave it as a
#include because that requires the consumer of the preprocessed source to have
the same file system layout and include paths as the creator.)

This patch adds a new pragma:

  #pragma clang module import MODULE.NAME.HERE

that imports a module, and changes -E and -frewrite-includes to use it when
rewriting a #include that maps to a module import. We don't make any attempt
to use a native language syntax import if one exists, to get more consistent
output. (If in the future, @import and #include have different semantics in
some way, the pragma will track the #include semantics.)

llvm-svn: 301725

7 years ago[ObjCARC] Do not move a release between a call and a
Akira Hatanaka [Sat, 29 Apr 2017 00:23:11 +0000 (00:23 +0000)]
[ObjCARC] Do not move a release between a call and a
retainAutoreleasedReturnValue that retains the returned value.

This commit fixes a bug in ARC optimizer where it moves a release
between a call and a retainAutoreleasedReturnValue, causing the returned
object to be released before the retainAutoreleasedReturnValue can
retain it.

This commit accomplishes that by doing a lookahead and checking whether
the call prevents the release from moving upwards. In the long term, we
should treat the region between the retainAutoreleasedReturnValue and
the call as a critical section and disallow moving anything there
(possibly using operand bundles).

rdar://problem/20449878

llvm-svn: 301724

7 years ago[LoopUnswitch] Make DEBUG output more readable (part 2).
Davide Italiano [Sat, 29 Apr 2017 00:18:26 +0000 (00:18 +0000)]
[LoopUnswitch] Make DEBUG output more readable (part 2).

I fixed my miscompile in r301722 and I hope I don't have to take
a look at this code again now that Chandler has a new LoopUnswitch
pass, but maybe this could be of use for somebody else in the
meanwhile.

llvm-svn: 301723

7 years ago[LoopUnswitch] Don't remove instructions with side effects.
Davide Italiano [Sat, 29 Apr 2017 00:12:18 +0000 (00:12 +0000)]
[LoopUnswitch] Don't remove instructions with side effects.

This fixes PR32818.

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

llvm-svn: 301722

7 years agoObjCBoxedExpr can't be evaluated by the constant expression evaluator.
Nick Lewycky [Sat, 29 Apr 2017 00:07:27 +0000 (00:07 +0000)]
ObjCBoxedExpr can't be evaluated by the constant expression evaluator.

A boxed expression evaluates its subexpr and then calls an objc method to transform it into another value with pointer type. The objc method can never be constexpr and therefore this expression can never be evaluated. Fixes a miscompile boxing expressions with side-effects.

Also make ObjCBoxedExpr handling a normal part of the expression evaluator instead of being the only case besides full-expression where we check for integer overflow.

llvm-svn: 301721

7 years ago[llvm-readobj] Fix incorrect printing of CV column info.
Zachary Turner [Sat, 29 Apr 2017 00:03:32 +0000 (00:03 +0000)]
[llvm-readobj] Fix incorrect printing of CV column info.

llvm-svn: 301720

7 years agoFuzzer: Mark test/cxxstring.test UNSUPPORTED: windows
Duncan P. N. Exon Smith [Fri, 28 Apr 2017 23:59:53 +0000 (23:59 +0000)]
Fuzzer: Mark test/cxxstring.test UNSUPPORTED: windows

This has been mysteriously failing since r301593, which cleaned up the
types of things like size_t and SIZE_MAX for freestanding targets.  Reid
and Kostya suggested marking it as UNSUPPORTED on windows, given that no
one has been able to reproduce locally.

llvm-svn: 301719

7 years ago[llvm-readobj] Use LLVMDebugInfoCodeView to parse line tables.
Zachary Turner [Fri, 28 Apr 2017 23:41:36 +0000 (23:41 +0000)]
[llvm-readobj] Use LLVMDebugInfoCodeView to parse line tables.

The llvm-readobj parsing code currently exists in our CodeView
library, so we use that to parse instead of re-writing the logic
in the tool.

llvm-svn: 301718

7 years ago[Support] Provide unsafe random access for VarStreamArray.
Zachary Turner [Fri, 28 Apr 2017 23:29:33 +0000 (23:29 +0000)]
[Support] Provide unsafe random access for VarStreamArray.

llvm-svn: 301716

7 years agoReplace PrettyPrinter class in MapFile.cpp with a few non-member functions.
Rui Ueyama [Fri, 28 Apr 2017 23:29:15 +0000 (23:29 +0000)]
Replace PrettyPrinter class in MapFile.cpp with a few non-member functions.

Since the output format has been simplified, the class to print
out a map file doesn't seem to be needed anymore. We can replace
it with a few non-member functions.

llvm-svn: 301715