platform/upstream/llvm.git
7 years ago[asan] Reduce prototype duplication with decltype
Reid Kleckner [Tue, 15 Nov 2016 18:38:41 +0000 (18:38 +0000)]
[asan] Reduce prototype duplication with decltype

NFC

llvm-svn: 287000

7 years ago[LSR] Allow formula containing Reg for SCEVAddRecExpr related with outerloop.
Wei Mi [Tue, 15 Nov 2016 18:35:53 +0000 (18:35 +0000)]
[LSR] Allow formula containing Reg for SCEVAddRecExpr related with outerloop.

In RateRegister of existing LSR, if a formula contains a Reg which is a SCEVAddRecExpr,
and this SCEVAddRecExpr's loop is an outerloop, the formula will be marked as Loser
and dropped.

Suppose we have an IR that %for.body is outerloop and %for.body2 is innerloop. LSR only
handle inner loop now so only %for.body2 will be handled.

Using the logic above, formula like
reg(%array) + reg({1,+, %size}<%for.body>) + 1*reg({0,+,1}<%for.body2>) will be dropped
no matter what because reg({1,+, %size}<%for.body>) is a SCEVAddRecExpr type reg related
with outerloop. Only formula like
reg(%array) + 1*reg({{1,+, %size}<%for.body>,+,1}<nuw><nsw><%for.body2>) will be kept
because the SCEVAddRecExpr related with outerloop is folded into the initial value of the
SCEVAddRecExpr related with current loop.

But in some cases, we do need to share the basic induction variable
reg{0 ,+, 1}<%for.body2> among LSR Uses to reduce the final total number of induction
variables used by LSR, so we don't want to drop the formula like
reg(%array) + reg({1,+, %size}<%for.body>) + 1*reg({0,+,1}<%for.body2>) unconditionally.

From the existing comment, it tries to avoid considering multiple level loops at the same time.
However, existing LSR only handles innermost loop, so for any SCEVAddRecExpr with a loop other
than current loop, it is an invariant and will be simple to handle, and the formula doesn't have
to be dropped.

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

llvm-svn: 286999

7 years agoInteger legalization: fix MUL expansion
Pawel Bylica [Tue, 15 Nov 2016 18:29:24 +0000 (18:29 +0000)]
Integer legalization: fix MUL expansion

Summary:
This fixes the runtime results produces by the fallback multiplication expansion introduced in r270720.

For tests I created a fuzz tester that compares the results with Boost.Multiprecision.

Reviewers: hfinkel

Subscribers: llvm-commits

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

llvm-svn: 286998

7 years ago[asan] Don't assert that a target is within 2GB on 32-bit Windows
Reid Kleckner [Tue, 15 Nov 2016 18:29:17 +0000 (18:29 +0000)]
[asan] Don't assert that a target is within 2GB on 32-bit Windows

Summary:
In a 32-bit address space, PC-relative jump targets are wrapped, so a
direct branch at 0x90000001 can reach address 0x10000000 with a
displacement of 0x7FFFFFFFF. This can happen in applications, such as
Chrome, that are linked with /LARGEADDRESSAWARE.

Reviewers: etienneb

Subscribers: mgorny, llvm-commits

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

llvm-svn: 286997

7 years agoFixed spelling in comments. NFCI.
Simon Pilgrim [Tue, 15 Nov 2016 18:28:07 +0000 (18:28 +0000)]
Fixed spelling in comments. NFCI.

llvm-svn: 286996

7 years agovector load store with length (left justified) clang portion
Zaara Syeda [Tue, 15 Nov 2016 18:04:13 +0000 (18:04 +0000)]
vector load store with length (left justified) clang portion

llvm-svn: 286994

7 years agovector load store with length (left justified) llvm portion
Zaara Syeda [Tue, 15 Nov 2016 17:54:19 +0000 (17:54 +0000)]
vector load store with length (left justified) llvm portion

llvm-svn: 286993

7 years agoRename variables of type SymbolVersion.
Rui Ueyama [Tue, 15 Nov 2016 17:51:09 +0000 (17:51 +0000)]
Rename variables of type SymbolVersion.

In this file, `sym` was used for both SymbolBody and SymbolVersion
although the two are completely different.

llvm-svn: 286992

7 years agoRename function to avoid function overloading.
Rui Ueyama [Tue, 15 Nov 2016 17:51:07 +0000 (17:51 +0000)]
Rename function to avoid function overloading.

We had two functions with the same name to read completely different
things. That was confusing.

llvm-svn: 286991

7 years ago[clang-tidy] Change readability-redundant-member-init to get base type from constructor
Malcolm Parsons [Tue, 15 Nov 2016 17:49:00 +0000 (17:49 +0000)]
[clang-tidy] Change readability-redundant-member-init to get base type from constructor

Summary: Fixes PR30835

Reviewers: alexfh, hokein, aaron.ballman

Subscribers: Prazek, cfe-commits

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

llvm-svn: 286990

7 years agofix formatting; NFC
Sanjay Patel [Tue, 15 Nov 2016 17:47:13 +0000 (17:47 +0000)]
fix formatting; NFC

llvm-svn: 286989

7 years ago[IndVars] Change the order to compute WidenAddRec in widenIVUse.
Wei Mi [Tue, 15 Nov 2016 17:34:52 +0000 (17:34 +0000)]
[IndVars] Change the order to compute WidenAddRec in widenIVUse.

When both WidenIV::getWideRecurrence and WidenIV::getExtendedOperandRecurrence
return non-null but different WideAddRec, if getWideRecurrence is called
before getExtendedOperandRecurrence, we won't bother to call
getExtendedOperandRecurrence again. But As we know it is possible that after
SCEV folding, we cannot prove the legality using the SCEVAddRecExpr returned
by getWideRecurrence. Meanwhile if getExtendedOperandRecurrence returns non-null
WideAddRec, we know for sure that it is legal to do widening for current instruction.
So it is better to put getExtendedOperandRecurrence before getWideRecurrence, which
will increase the chance of successful widening.

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

llvm-svn: 286987

7 years ago[libcxx] [test] D26627: Fix ordering assumptions in unordered container tests.
Stephan T. Lavavej [Tue, 15 Nov 2016 17:00:38 +0000 (17:00 +0000)]
[libcxx] [test] D26627: Fix ordering assumptions in unordered container tests.

llvm-svn: 286984

7 years ago[libcxx] [test] D26625: future_error::what() is implementation-defined.
Stephan T. Lavavej [Tue, 15 Nov 2016 17:00:32 +0000 (17:00 +0000)]
[libcxx] [test] D26625: future_error::what() is implementation-defined.

llvm-svn: 286983

7 years ago[libcxx] [test] D26624: Fix bucket_count() assumptions.
Stephan T. Lavavej [Tue, 15 Nov 2016 17:00:24 +0000 (17:00 +0000)]
[libcxx] [test] D26624: Fix bucket_count() assumptions.

With a max_load_factor of 1.0, the only guarantee is that
bucket_count() >= size(). (Note: setting max_load_factor without
rehashing isn't supposed to affect this, because setting
max_load_factor is currently specified to be constant time.)

llvm-svn: 286982

7 years ago[ARM] GlobalISel: Remove unused members. NFCI
Diana Picus [Tue, 15 Nov 2016 16:42:10 +0000 (16:42 +0000)]
[ARM] GlobalISel: Remove unused members. NFCI

This silences some warnings that I didn't see with my host compiler.

llvm-svn: 286981

7 years ago[AVX-512] Add AVX-512 vector shift intrinsics to memory santitizer.
Craig Topper [Tue, 15 Nov 2016 16:27:33 +0000 (16:27 +0000)]
[AVX-512] Add AVX-512 vector shift intrinsics to memory santitizer.

Just needed to add the intrinsics to the exist switch. The code is generic enough to support the wider vectors with no changes.

llvm-svn: 286980

7 years ago[X86][SSE] Improve SINT_TO_FP of boolean vector results (signum)
Simon Pilgrim [Tue, 15 Nov 2016 16:24:40 +0000 (16:24 +0000)]
[X86][SSE] Improve SINT_TO_FP of boolean vector results (signum)

This patch helps avoids poor legalization of boolean vector results (e.g. 8f32 -> 8i1 -> 8i16) that feed into SINT_TO_FP by inserting an early SIGN_EXTEND and so help improve the truncation logic.

This is not necessary for AVX512 targets where boolean vectors are legal - AVX512 manages to lower ( sint_to_fp vXi1 ) into some form of ( select mask, 1.0f , 0.0f ) in most cases.

Fix for PR13248

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

llvm-svn: 286979

7 years ago[InstCombine] add tests for bitcasted selects; NFC
Sanjay Patel [Tue, 15 Nov 2016 16:01:16 +0000 (16:01 +0000)]
[InstCombine] add tests for bitcasted selects; NFC

llvm-svn: 286978

7 years agotest commmit
Zaara Syeda [Tue, 15 Nov 2016 15:57:33 +0000 (15:57 +0000)]
test commmit

llvm-svn: 286977

7 years agoRevert "[JumpThreading] Unfold selects that depend on the same condition"
Pablo Barrio [Tue, 15 Nov 2016 15:42:23 +0000 (15:42 +0000)]
Revert "[JumpThreading] Unfold selects that depend on the same condition"

This reverts commit ac54d0066c478a09c7cd28d15d0f9ff8af984afc.

llvm-svn: 286976

7 years agoRevert "[JumpThreading] Prevent non-deterministic use lists"
Pablo Barrio [Tue, 15 Nov 2016 15:42:17 +0000 (15:42 +0000)]
Revert "[JumpThreading] Prevent non-deterministic use lists"

This reverts commit f2c2f5354070469dac253373c66527ca971ddc66.

llvm-svn: 286975

7 years ago[ARM] Make sure GlobalISel is only initialized once. NFCI
Diana Picus [Tue, 15 Nov 2016 15:38:15 +0000 (15:38 +0000)]
[ARM] Make sure GlobalISel is only initialized once. NFCI

Move some code inside the proper 'if' block to make sure it is only run once,
when the subtarget is first created. Things can still break if we use different
ARM target machines or if we have functions with different 'target-cpu' or
'target-features', we should fix that too in the future.

llvm-svn: 286974

7 years ago[clang-format] Fixed line merging of more than two lines
Cameron Desrochers [Tue, 15 Nov 2016 15:07:07 +0000 (15:07 +0000)]
[clang-format] Fixed line merging of more than two lines

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

llvm-svn: 286973

7 years ago[PowerPC] Implement BE VSX load/store builtins - clang portion.
Tony Jiang [Tue, 15 Nov 2016 14:30:56 +0000 (14:30 +0000)]
[PowerPC] Implement BE VSX load/store builtins - clang portion.

This patch implements all the overloads for vec_xl_be and vec_xst_be. On BE,
they behaves exactly the same with vec_xl and vec_xst, therefore they are
simply implemented by defining a matching macro. On LE, they are implemented
by defining new builtins and intrinsics. For int/float/long long/double, it
is just a load (lxvw4x/lxvd2x) or store(stxvw4x/stxvd2x). For char/char/short,
we also need some extra shuffling before or after call the builtins to get the
desired BE order. For int128, simply call vec_xl or vec_xst.

llvm-svn: 286971

7 years ago[LoopVectorizer] When estimating reg usage, unused insts may "end" another use
Robert Lougher [Tue, 15 Nov 2016 14:27:33 +0000 (14:27 +0000)]
[LoopVectorizer] When estimating reg usage, unused insts may "end" another use

The register usage algorithm incorrectly treats instructions whose value is
not used within the loop (e.g. those that do not produce a value).

The algorithm first calculates the usages within the loop.  It iterates over
the instructions in order, and records at which instruction index each use
ends (in fact, they're actually recorded against the next index, as this is
when we want to delete them from the open intervals).

The algorithm then iterates over the instructions again, adding each
instruction in turn to a list of open intervals.  Instructions are then
removed from the list of open intervals when they occur in the list of uses
ended at the current index.

The problem is, instructions which are not used in the loop are skipped.
However, although they aren't used, the last use of a value may have been
recorded against that instruction index.  In this case, the use is not deleted
from the open intervals, which may then bump up the estimated register usage.

This patch fixes the issue by simply moving the "is used" check after the loop
which erases the uses at the current index.

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

llvm-svn: 286969

7 years ago[PowerPC] Implement BE VSX load/store builtins - llvm portion.
Tony Jiang [Tue, 15 Nov 2016 14:25:56 +0000 (14:25 +0000)]
[PowerPC] Implement BE VSX load/store builtins - llvm portion.

This patch implements all the overloads for vec_xl_be and vec_xst_be. On BE,
they behaves exactly the same with vec_xl and vec_xst, therefore they are
simply implemented by defining a matching macro. On LE, they are implemented
by defining new builtins and intrinsics. For int/float/long long/double, it
is just a load (lxvw4x/lxvd2x) or store(stxvw4x/stxvd2x). For char/char/short,
we also need some extra shuffling before or after call the builtins to get the
desired BE order. For int128, simply call vec_xl or vec_xst.

llvm-svn: 286967

7 years agoGet GlobalISel to build on Linux after r286407
Diana Picus [Tue, 15 Nov 2016 14:11:11 +0000 (14:11 +0000)]
Get GlobalISel to build on Linux after r286407

r286407 has introduced calls to llvm::AddLandingPadInfo, which lives in the
SelectionDAG component. Add it to LLVMBuild to avoid linker failures on Linux.

llvm-svn: 286962

7 years ago[X86][FastISel] Assert that we are dealing with arithmetic with overflow intrinsics...
Zvi Rackover [Tue, 15 Nov 2016 13:50:35 +0000 (13:50 +0000)]
[X86][FastISel] Assert that we are dealing with arithmetic with overflow intrinsics. NFC

llvm-svn: 286961

7 years ago[AMDGPU] TableGen: change individual instruction flags to bit type from bits<1>
Sam Kolton [Tue, 15 Nov 2016 13:39:07 +0000 (13:39 +0000)]
[AMDGPU] TableGen: change individual instruction flags to bit type from bits<1>

Summary: This is needed to be able to use this flags in InstrMappings.

Reviewers: tstellarAMD, vpykhtin

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye

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

llvm-svn: 286960

7 years ago[X86][FastISel] Fix lowering of overflow result on AVX512 targets
Zvi Rackover [Tue, 15 Nov 2016 13:29:23 +0000 (13:29 +0000)]
[X86][FastISel] Fix lowering of overflow result on AVX512 targets

    Summary:
    Fix a case where the overflow value of type i1, which is legal on AVX512, was assigned to a VK1 register class.
    We always want this value to be assigned to a GPR since the overflow return value is lowered to a SETO instruction.

    Fixes pr30981.

    Reviewers: mkuper, igorb, craig.topper, guyblank, qcolombet

    Subscribers: qcolombet, llvm-commits

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

llvm-svn: 286958

7 years agoTest commit, remove trailing space.
Florian Hahn [Tue, 15 Nov 2016 13:28:42 +0000 (13:28 +0000)]
Test commit, remove trailing space.

This commit is used to test commit access.

llvm-svn: 286957

7 years agoclang format include/llvm/Support/ELF.h. NFC.
Rafael Espindola [Tue, 15 Nov 2016 13:21:32 +0000 (13:21 +0000)]
clang format include/llvm/Support/ELF.h. NFC.

llvm-svn: 286956

7 years ago[ELF] Don't check Out<ELFT>::RelaPlt as it's always non-zero. NFC
Eugene Leviant [Tue, 15 Nov 2016 13:19:21 +0000 (13:19 +0000)]
[ELF] Don't check Out<ELFT>::RelaPlt as it's always non-zero. NFC

llvm-svn: 286955

7 years agoDWARFAbbreviationDeclaration.h: Fix a typo in r286924. [-Wdocumentation]
NAKAMURA Takumi [Tue, 15 Nov 2016 13:16:50 +0000 (13:16 +0000)]
DWARFAbbreviationDeclaration.h: Fix a typo in r286924. [-Wdocumentation]

llvm-svn: 286954

7 years ago[OPENMP] Fix for PR30632: Name mangling issue.
Alexey Bataev [Tue, 15 Nov 2016 13:15:20 +0000 (13:15 +0000)]
[OPENMP] Fix for PR30632: Name mangling issue.

Reworked fix after comments from Richard Smith. We must skip all
CapturedDecl-based contexts when trying to get correct mangling number
context.

llvm-svn: 286953

7 years ago[test] Correctly include build llvm_shlib_dir in stand-alone builds
Michal Gorny [Tue, 15 Nov 2016 12:54:10 +0000 (12:54 +0000)]
[test] Correctly include build llvm_shlib_dir in stand-alone builds

Add the build llvm_shlib_dir into LD_LIBRARY_PATH before the directory
specified as llvm_libs_dir, in order to fix stand-alone builds
attempting to use installed clang libraries.

In case of stand-alone builds llvm_libs_dir specifies the location of
installed LLVM libraries which can also contain an older version
(previous build) of clang libraries. Therefore, ensure to specify
llvm_shlib_dir (which is always the build tree path) before
the potentially-system llvm_libs_dir.

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

llvm-svn: 286952

7 years agoIntroduce TLI predicative for base-relative Jump Tables.
Joerg Sonnenberger [Tue, 15 Nov 2016 12:39:46 +0000 (12:39 +0000)]
Introduce TLI predicative for base-relative Jump Tables.

For 64bit ABIs it is common practice to use relative Jump Tables with
potentially different relocation bases.  As the logic for the jump table
itself doesn't depend on the relocation base, make it easier for targets
to use the generic logic. Start by dropping the now redundant MIPS logic.

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

llvm-svn: 286951

7 years ago[ELF] Convert DynamicSection to input section.
Eugene Leviant [Tue, 15 Nov 2016 12:26:55 +0000 (12:26 +0000)]
[ELF] Convert DynamicSection to input section.

This patch introduces the following changes:
- DynamicSection now inherits InputSection<ELFT> and was moved
  to SyntheticSections.h/.cpp.
- Link and Entsize fields of DynamicSection are propagated to
  its output section
- In<ELFT>::SyntheticSections was removed.
- Finalization of synthetic sections was removed from
  OutputSection<ELFT>::finalize. Now finalizeSyntheticSections is
  used instead.

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

llvm-svn: 286950

7 years ago[ARM] Add machine scheduler for Cortex-R52
Javed Absar [Tue, 15 Nov 2016 11:34:54 +0000 (11:34 +0000)]
[ARM] Add machine scheduler for Cortex-R52

This patch adds the Sched Machine Model for Cortex-R52.

Details of the pipeline and descriptions are in comments
in file ARMScheduleR52.td included in this patch.

Reviewers: rengolin, jmolloy

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

llvm-svn: 286949

7 years agoFix uninitialized members.
Sam McCall [Tue, 15 Nov 2016 10:58:16 +0000 (10:58 +0000)]
Fix uninitialized members.

Summary: Fix uninitialized members.

Reviewers: jingham

Subscribers: jingham, lldb-commits

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

llvm-svn: 286947

7 years agoFix -Wunused introduced in r286945 for release builds.
Daniel Sanders [Tue, 15 Nov 2016 10:13:09 +0000 (10:13 +0000)]
Fix -Wunused introduced in r286945 for release builds.

llvm-svn: 286946

7 years ago[tablegen] Extract portions of AsmMatcherEmitter for re-use by another generator...
Daniel Sanders [Tue, 15 Nov 2016 09:51:02 +0000 (09:51 +0000)]
[tablegen] Extract portions of AsmMatcherEmitter for re-use by another generator. NFC.

Summary:
This change is preparation for a change that will allow targets to verify that the instructions
they emit meet the predicates they specify. This is useful to ensure that C++
legalization/lowering/instruction-selection doesn't incorrectly select code for a different
subtarget than intended. Such cases are not caught by the integrated assembler when emitting
instructions directly to an object file.

Reviewers: qcolombet

Subscribers: qcolombet, beanz, mgorny, llvm-commits, modocache

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

llvm-svn: 286945

7 years ago[OPENMP] Fixed codegen for 'omp cancel' construct.
Alexey Bataev [Tue, 15 Nov 2016 09:11:50 +0000 (09:11 +0000)]
[OPENMP] Fixed codegen for 'omp cancel' construct.

If 'omp cancel' construct is used in a worksharing construct it may cause
hanging of the software in case if reduction clause is used. Patch fixes
this problem by avoiding extra reduction processing for branches that
were canceled.

llvm-svn: 286944

7 years ago[clang-move] Make the output code look more pretty.
Haojian Wu [Tue, 15 Nov 2016 09:06:59 +0000 (09:06 +0000)]
[clang-move] Make the output code look more pretty.

Summary:
Add decent blank lines between declarations:
* Add extra blank line after #define or #includes.
* Add extra blank line between declarations.
* Add extra blank line in front of #endif.

Previously, the new generated code is quite tight:

```
#ifndef FOO_H
#define FOO_H
namespace a {
class A { public: int f(); };
int A::f() { return 0; }
} // namespace a
#endif // FOO_H
```

After this patch, the code looks like:

```
#ifndef FOO_H
#define FOO_H

namespace a {
class A { public: int f(); };

int A::f() { return 0; }
} // namespace a

#endif // FOO_H
```

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 286943

7 years ago[opt-viewer] Add support for libYAML for faster parsing
Adam Nemet [Tue, 15 Nov 2016 08:40:51 +0000 (08:40 +0000)]
[opt-viewer] Add support for libYAML for faster parsing

This results in a speed-up of over 6x on sqlite3.

Before:

$ time -p /org/llvm/utils/opt-viewer/opt-viewer.py ./MultiSource/Applications/sqlite3/CMakeFiles/sqlite3.dir/sqlite3.c.opt.yaml html
  real 415.07
  user 410.00
  sys 4.66

After with libYAML:

$ time -p /org/llvm/utils/opt-viewer/opt-viewer.py ./MultiSource/Applications/sqlite3/CMakeFiles/sqlite3.dir/sqlite3.c.opt.yaml html
  real 63.96
  user 60.03
  sys 3.67

I followed these steps to get libYAML working with PyYAML: http://rmcgibbo.github.io/blog/2013/05/23/faster-yaml-parsing-with-libyaml/

llvm-svn: 286942

7 years ago[ELF] - Do not create reserved symbols in case of relocatable output.
George Rimar [Tue, 15 Nov 2016 08:19:02 +0000 (08:19 +0000)]
[ELF] - Do not create reserved symbols in case of relocatable output.

This patch stops creating symbols like __ehdr_start,
_end/_etext_edata,__tls_get_addr when using -r.

This fixes PR30984.

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

llvm-svn: 286941

7 years ago[ELF] - Better diagnostic for relative relocation to an absolute value error.
George Rimar [Tue, 15 Nov 2016 08:07:14 +0000 (08:07 +0000)]
[ELF] - Better diagnostic for relative relocation to an absolute value error.

Patch adds a filename to that error message.

I faced next error when debugged one of FreeBSD port:
error: relocation R_X86_64_PLT32 cannot refer to absolute symbol __tls_get_addr

error message was poor and this patch improves it to show the locations
of symbol declaration and using.

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

llvm-svn: 286940

7 years ago[ELF] - Allow symbols of STT_NOTYPE to be associated with SHT_SYMTAB sections.
George Rimar [Tue, 15 Nov 2016 07:56:28 +0000 (07:56 +0000)]
[ELF] - Allow symbols of STT_NOTYPE to be associated with SHT_SYMTAB sections.

Found this when tried to link lang/ccl FreeBSD port.
Issue is very close to D23201.
This is the reason of lang/ccl port link fail.

GNU assembler 2.17.50 [FreeBSD] 2007-07-03 could generate broken objects,
where notype symbols are associated with symtab:
...
[ 9] .symtab           SYMTAB           0000000000000000  00003c78
     0000000000006858  0000000000000018          10   803     8
...
192: 000000000000000d     0 NOTYPE  LOCAL  DEFAULT    9 _cons_org

Patch allows to handle such objects.

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

llvm-svn: 286939

7 years agoDAGCombiner: fix combine of trunc and select
Asaf Badouh [Tue, 15 Nov 2016 07:55:22 +0000 (07:55 +0000)]
DAGCombiner: fix combine of trunc and select

bugzilla:
https://llvm.org/bugs/show_bug.cgi?id=29002
pr29002

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

llvm-svn: 286938

7 years agoAvoid creating reference from nullptr.
Vitaly Buka [Tue, 15 Nov 2016 07:32:51 +0000 (07:32 +0000)]
Avoid creating reference from nullptr.

Summary:
getFile() can return nullptr. This usually happens when Rels is empty so
the reference is never used. Still UBSAN complains.

Reviewers: rafael

Subscribers: llvm-commits

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

llvm-svn: 286937

7 years agoTableGen: Add operator !or
Matt Arsenault [Tue, 15 Nov 2016 06:49:28 +0000 (06:49 +0000)]
TableGen: Add operator !or

llvm-svn: 286936

7 years ago[X86][GlobalISel] Add minimal call lowering support to the IRTranslator
Zvi Rackover [Tue, 15 Nov 2016 06:34:33 +0000 (06:34 +0000)]
[X86][GlobalISel] Add minimal call lowering support to the IRTranslator

Summary:
    Add basic functionality to support call lowering for X86.
    Currently only supports functions which return void and take zero arguments.
    Inspired by commit 286573.

Reviewers: ab, qcolombet, t.p.northover

Subscribers: llvm-commits

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

llvm-svn: 286935

7 years ago[AVX-512] Add an example test case for PR31018.
Craig Topper [Tue, 15 Nov 2016 05:21:55 +0000 (05:21 +0000)]
[AVX-512] Add an example test case for PR31018.

llvm-svn: 286934

7 years ago[X86] Add LLVM version number for each intrinsic handled by auto upgrade for age...
Craig Topper [Tue, 15 Nov 2016 05:04:51 +0000 (05:04 +0000)]
[X86] Add LLVM version number for each intrinsic handled by auto upgrade for age tracking.

One day we'd like to remove some of this autoupgrade support and it will be easier if we know how long some of it has been around.

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

llvm-svn: 286933

7 years agoMissed one of the try blocks the first time :-(. Thanks to Renato for the heads up.
Marshall Clow [Tue, 15 Nov 2016 05:03:22 +0000 (05:03 +0000)]
Missed one of the try blocks the first time :-(. Thanks to Renato for the heads up.

llvm-svn: 286932

7 years agoAMDGPU: Fix f16 fabs/fneg
Matt Arsenault [Tue, 15 Nov 2016 02:25:28 +0000 (02:25 +0000)]
AMDGPU: Fix f16 fabs/fneg

llvm-svn: 286931

7 years ago[ORC] Work around an apparent modules/linkage issue.
Lang Hames [Tue, 15 Nov 2016 02:14:57 +0000 (02:14 +0000)]
[ORC] Work around an apparent modules/linkage issue.

<rdar://problem/29247092>

llvm-svn: 286930

7 years ago[asan] Fixup to r286608 that makes the test pass on iOS.
Anna Zaks [Tue, 15 Nov 2016 01:57:29 +0000 (01:57 +0000)]
[asan] Fixup to r286608 that makes the test pass on iOS.

TARGET_OS_IPHONE is defined in TargetConditionals.h. Without the include the
iOS path is never triggered.

llvm-svn: 286929

7 years agoSimplify identify_magic.
Rui Ueyama [Tue, 15 Nov 2016 01:57:05 +0000 (01:57 +0000)]
Simplify identify_magic.

This patch defines a memcmp-ish helper function to simplify identify_magic.

llvm-svn: 286928

7 years ago[analyzer] Rename assumeWithinInclusiveRange*()
Dominic Chen [Tue, 15 Nov 2016 01:54:41 +0000 (01:54 +0000)]
[analyzer] Rename assumeWithinInclusiveRange*()

Summary: The name is slightly confusing, since the constraint is not necessarily within the range unless `Assumption` is true. Split out renaming for ConstraintManager.h from D26061

Reviewers: zaks.anna, dcoughlin

Subscribers: cfe-commits

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

llvm-svn: 286927

7 years agoChange the kernel searching code to not go through the
Jason Molenda [Tue, 15 Nov 2016 01:41:27 +0000 (01:41 +0000)]
Change the kernel searching code to not go through the
memory cache subsystem so we're reading only the 4 bytes
needed to check for the magic word at the start of a mach-o
binary instead of the default 512 block.  It can be a small
performance help to reduce the size of memory reads from
possibly unmapped memory.

<rdar://problem/29256385>

llvm-svn: 286926

7 years ago[analyzer] Minor optimization: avoid setting state if unchanged
Dominic Chen [Tue, 15 Nov 2016 01:40:58 +0000 (01:40 +0000)]
[analyzer] Minor optimization: avoid setting state if unchanged

Summary: Split out optimization from D26061

Reviewers: zaks.anna, dcoughlin

Subscribers: cfe-commits

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

llvm-svn: 286925

7 years agoImprove DWARF parsing speed by improving DWARFAbbreviationDeclaration
Greg Clayton [Tue, 15 Nov 2016 01:23:06 +0000 (01:23 +0000)]
Improve DWARF parsing speed by improving DWARFAbbreviationDeclaration

This patch gets a DWARF parsing speed improvement by having DWARFAbbreviationDeclaration instances know if they have a fixed byte size. If an abbreviation has a fixed byte size that can be calculated given a DWARFUnit, then parsing a DIE becomes two steps: parse ULEB128 abbrev code, and then add constant size to the offset.

This patch also adds a fixed byte size to each DWARFAbbreviationDeclaration::AttributeSpec so that attributes can quickly skip their values if needed without the need to lookup the fixed for size.

Notable improvements:

- DWARFAbbreviationDeclaration::findAttributeIndex() now returns an Optional<uint32_t> instead of a uint32_t and we no longer have to look for the magic -1U return value
- Optional<uint32_t> DWARFAbbreviationDeclaration::findAttributeIndex(dwarf::Attribute attr) const;
- DWARFAbbreviationDeclaration now has a getAttributeValue() function that extracts an attribute value given a DIE offset that takes advantage of the DWARFAbbreviationDeclaration::AttributeSpec::ByteSize
- bool DWARFAbbreviationDeclaration::getAttributeValue(const uint32_t DIEOffset, const dwarf::Attribute Attr, const DWARFUnit &U, DWARFFormValue &FormValue) const;
- A DWARFAbbreviationDeclaration instance can return a fixed byte size for itself so DWARF parsing is faster:
- Optional<size_t> DWARFAbbreviationDeclaration::getFixedAttributesByteSize(const DWARFUnit &U) const;
- Any functions that used to take a "const DWARFUnit *U" that would crash if U was NULL now take a "const DWARFUnit &U" and are only called with a valid DWARFUnit

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

llvm-svn: 286924

7 years agoIdentify object files compiled with cl.exe /GL.
Rui Ueyama [Tue, 15 Nov 2016 01:01:51 +0000 (01:01 +0000)]
Identify object files compiled with cl.exe /GL.

Object files compiled with cl.exe /GL contain intermediate code for LTO.
We can't (and don't want to) interpret such code, but we should print
out a user-friendly error message.

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

llvm-svn: 286921

7 years agoFix -Wswitch.
Rui Ueyama [Tue, 15 Nov 2016 00:58:50 +0000 (00:58 +0000)]
Fix -Wswitch.

llvm-svn: 286920

7 years agoAdd a file magic for CL.exe's object file created with /GL.
Rui Ueyama [Tue, 15 Nov 2016 00:54:54 +0000 (00:54 +0000)]
Add a file magic for CL.exe's object file created with /GL.

This patch makes it possible to identify object files created by CL.exe
with /GL option. Such file contains Microsoft proprietary intermediate
code instead of target machine code to do LTO.

I need this to print out user-friendly error message from LLD.

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

llvm-svn: 286919

7 years ago[ORC] Temporarily disable RPCUtils unit test.
Lang Hames [Tue, 15 Nov 2016 00:49:12 +0000 (00:49 +0000)]
[ORC] Temporarily disable RPCUtils unit test.

This broke s390x due to a bug in the QueueChannel implementation that led to it
infinite-looping. Disabling it while I look into a fix.

llvm-svn: 286917

7 years agoFix some more Printf warnings.
Zachary Turner [Tue, 15 Nov 2016 00:45:23 +0000 (00:45 +0000)]
Fix some more Printf warnings.

llvm-svn: 286916

7 years agoFix some more StringRef printf warnings.
Zachary Turner [Tue, 15 Nov 2016 00:45:18 +0000 (00:45 +0000)]
Fix some more StringRef printf warnings.

llvm-svn: 286915

7 years agollvm-strings: support the `-n` option
Saleem Abdulrasool [Tue, 15 Nov 2016 00:43:52 +0000 (00:43 +0000)]
llvm-strings: support the `-n` option

Permit specifying the match length (the `-n` or `--bytes` option).  The
deprecated `-[length]` form is not supported as an option.  This allows the
strings tool to display only the specified length strings rather than the
hardcoded default length of >= 4.

llvm-svn: 286914

7 years agoAMDGPU: Set hasExtraSrcRegAllocReq on v_div_scale_*
Matt Arsenault [Tue, 15 Nov 2016 00:05:42 +0000 (00:05 +0000)]
AMDGPU: Set hasExtraSrcRegAllocReq on v_div_scale_*

This doesn't solve any problems I know about, but this should have
more conservative assumptions about the operands'

llvm-svn: 286913

7 years agoAMDGPU: Fix formatting of 1/2pi immediate
Matt Arsenault [Tue, 15 Nov 2016 00:04:33 +0000 (00:04 +0000)]
AMDGPU: Fix formatting of 1/2pi immediate

llvm-svn: 286912

7 years agoMIRParser: Add support for parsing vreg reg alloc hints
Tom Stellard [Tue, 15 Nov 2016 00:03:14 +0000 (00:03 +0000)]
MIRParser: Add support for parsing vreg reg alloc hints

Reviewers: qcolombet, MatzeB

Subscribers: wdng, llvm-commits

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

llvm-svn: 286911

7 years agoAvoid calling std::memcmp with nullptr
Vitaly Buka [Tue, 15 Nov 2016 00:01:40 +0000 (00:01 +0000)]
Avoid calling std::memcmp with nullptr

Summary:
UBSAN complains that this is undefined behavior.

We can assume that empty substring (N==1) always satisfy conditions. So
std::memcmp will be called only only for N > 1 and Str.size() > 0.

Reviewers: ruiu, zturner

Subscribers: llvm-commits

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

llvm-svn: 286910

7 years agoFix TestMiniDumpNew.py test for Python 2/3 issue
Adrian McCarthy [Mon, 14 Nov 2016 23:53:45 +0000 (23:53 +0000)]
Fix TestMiniDumpNew.py test for Python 2/3 issue

On Windows, where we use Python 3 for testing, we have to be more explicit about converting between binary and string representations.  I believe this should still work for Python 2, but I don't have a convenient way to try it out.

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

llvm-svn: 286909

7 years agoFix a deadlock issue that would happen when loading an AppleTV or watchOS binary.
Greg Clayton [Mon, 14 Nov 2016 23:45:50 +0000 (23:45 +0000)]
Fix a deadlock issue that would happen when loading an AppleTV or watchOS binary.

This was a regression that was caused by svn revision 269877:

commit 1ded4a2a25d60dd2c81bd432bcf63b6ded58e5d6
Author: Saleem Abdulrasool <compnerd@compnerd.org>
Date:   Wed May 18 01:59:10 2016 +0000

    remove use of Mutex in favour of std::{,recursive_}mutex

    This is a pretty straightforward first pass over removing a number of uses of
    Mutex in favor of std::mutex or std::recursive_mutex. The problem is that there
    are interfaces which take Mutex::Locker & to lock internal locks. This patch
    cleans up most of the easy cases. The only non-trivial change is in
    CommandObjectTarget.cpp where a Mutex::Locker was split into two.

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

This change actually changed the Platform::m_mutex to be non-recursive which caused the regression.

<rdar://problem/29094384>

llvm-svn: 286908

7 years ago[AArch64] Compute the Newton series for reciprocals natively
Evandro Menezes [Mon, 14 Nov 2016 23:29:01 +0000 (23:29 +0000)]
[AArch64] Compute the Newton series for reciprocals natively

Implement the Newton series for square root, its reciprocal and reciprocal
natively using the specialized instructions in AArch64 to perform each
series iteration.

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

llvm-svn: 286907

7 years agoFix some StringRef Printf warnings.
Zachary Turner [Mon, 14 Nov 2016 23:23:31 +0000 (23:23 +0000)]
Fix some StringRef Printf warnings.

llvm-svn: 286906

7 years agoLinker: Remove unnecessary call to copyMetadata in IRLinker::linkGlobalVariable.
Peter Collingbourne [Mon, 14 Nov 2016 23:18:38 +0000 (23:18 +0000)]
Linker: Remove unnecessary call to copyMetadata in IRLinker::linkGlobalVariable.

This was causing us to create duplicate metadata on global variables.
Debug info test case by Adrian Prantl, additional test cases by me.

Fixes PR31012.

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

llvm-svn: 286905

7 years ago[cfi] Mark tests as xfailing on Darwin
Vedant Kumar [Mon, 14 Nov 2016 23:12:52 +0000 (23:12 +0000)]
[cfi] Mark tests as xfailing on Darwin

This allows them to be run on other platforms, undoing damage from
r286902.

llvm-svn: 286904

7 years agoGlobalISel: add tests for G_ZEXT/G_SEXT to types smaller than 32-bits.
Tim Northover [Mon, 14 Nov 2016 22:50:22 +0000 (22:50 +0000)]
GlobalISel: add tests for G_ZEXT/G_SEXT to types smaller than 32-bits.

Support was accidentally added in r286407, but there were no tests at the time.

llvm-svn: 286903

7 years ago[cfi] Mark some tests as requiring additional support from the MachO writer
Vedant Kumar [Mon, 14 Nov 2016 22:50:13 +0000 (22:50 +0000)]
[cfi] Mark some tests as requiring additional support from the MachO writer

These tests need to be marked as unsupported on Darwin:

  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/1545

llvm-svn: 286902

7 years ago[analyzer] Fix crash in NullabilityChecker calling block with too few arguments
Devin Coughlin [Mon, 14 Nov 2016 22:46:02 +0000 (22:46 +0000)]
[analyzer] Fix crash in NullabilityChecker calling block with too few arguments

Fix a crash when checking parameter nullability on a block invocation
with fewer arguments than the block declaration requires.

rdar://problem/29237566

llvm-svn: 286901

7 years ago[InstCombine] add tests to show missing bitcast folds
Sanjay Patel [Mon, 14 Nov 2016 22:44:06 +0000 (22:44 +0000)]
[InstCombine] add tests to show missing bitcast folds

llvm-svn: 286900

7 years agoOne more cleanup to lldb version printing
Chris Bieneman [Mon, 14 Nov 2016 22:43:08 +0000 (22:43 +0000)]
One more cleanup to lldb version printing

With this patch LLDB_VERSION_STRING replaces "lldb version x.x.x" if it is set. This allows builds to not display the open source version numbers if the people making the distribution overrides the LLDB_VERSION_STRING.

Since LLDB_VERSION_STRING is always overridden on Darwin, this means the first line of lldb -version on Darwin is:

lldb-360.99.0 (<repo path> revision <revision>)

llvm-svn: 286899

7 years ago[sanitizer] Passthrough CMAKE_OSX_DEPLOYMENT_TARGET when building compiler-rt from...
Kuba Brecka [Mon, 14 Nov 2016 22:38:57 +0000 (22:38 +0000)]
[sanitizer] Passthrough CMAKE_OSX_DEPLOYMENT_TARGET when building compiler-rt from clang/runtime/CMakeLists.txt

This breaks some Swift builds, because Swift's build scripts explicitly set CMAKE_OSX_DEPLOYMENT_TARGET. This however isn't propagated to the compiler-rt build, causing build errors.

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

llvm-svn: 286898

7 years agoRemove redundant uses of \brief.
Adrian Prantl [Mon, 14 Nov 2016 22:09:18 +0000 (22:09 +0000)]
Remove redundant uses of \brief.

llvm-svn: 286897

7 years agoDon't pass nullptr into memcpy
Vitaly Buka [Mon, 14 Nov 2016 22:05:19 +0000 (22:05 +0000)]
Don't pass nullptr into memcpy

Summary:
It's undefined according UBSAN.
Not sure which CL caused test failures, but seems writeBytes for empty buffer
should be OK.

Reviewers: rnk, zturner

Subscribers: llvm-commits

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

llvm-svn: 286896

7 years agoRegAllocGreedy: Properly initialize this pass, so that -run-pass will work
Tom Stellard [Mon, 14 Nov 2016 21:50:13 +0000 (21:50 +0000)]
RegAllocGreedy: Properly initialize this pass, so that -run-pass will work

Reviewers: qcolombet, MatzeB

Subscribers: wdng, llvm-commits

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

llvm-svn: 286895

7 years ago[tsan] Add support for C++ exceptions into TSan (call __tsan_func_exit during unwindi...
Kuba Brecka [Mon, 14 Nov 2016 21:41:33 +0000 (21:41 +0000)]
[tsan] Add support for C++ exceptions into TSan (call __tsan_func_exit during unwinding), compiler-rt part

This adds support for TSan C++ exception handling, where we need to add extra calls to __tsan_func_exit when a function is exitted via exception mechanisms. Otherwise the shadow stack gets corrupted (leaked). This patch moves and enhances the existing implementation of EscapeEnumerator that finds all possible function exit points, and adds extra EH cleanup blocks where needed.

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

llvm-svn: 286894

7 years ago[tsan] Add support for C++ exceptions into TSan (call __tsan_func_exit during unwindi...
Kuba Brecka [Mon, 14 Nov 2016 21:41:13 +0000 (21:41 +0000)]
[tsan] Add support for C++ exceptions into TSan (call __tsan_func_exit during unwinding), LLVM part

This adds support for TSan C++ exception handling, where we need to add extra calls to __tsan_func_exit when a function is exitted via exception mechanisms. Otherwise the shadow stack gets corrupted (leaked). This patch moves and enhances the existing implementation of EscapeEnumerator that finds all possible function exit points, and adds extra EH cleanup blocks where needed.

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

llvm-svn: 286893

7 years agoUpdate stats-gathering code
Jonathan Peyton [Mon, 14 Nov 2016 21:13:44 +0000 (21:13 +0000)]
Update stats-gathering code

Have developer timers use partitioning scheme which also required that some
redundant developer timers be removed in favor of the already existing normal
timers. Move per thread stats initialization to just after global thread id
assignment which is as early as possible. Also put all global stats
initialization code in __kmp_stats_init() and all global stats destruction code
in __kmp_stats_fini().

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

llvm-svn: 286892

7 years agoRevert "Revert "llvm-strings: support printing the filename""
Saleem Abdulrasool [Mon, 14 Nov 2016 21:10:41 +0000 (21:10 +0000)]
Revert "Revert "llvm-strings: support printing the filename""

Change the dynamic files to static in the hope that it will actually fix the
transient errors that Ive been unable to reproduce.

llvm-svn: 286891

7 years agoIntroduce dynamic affinity dispatch capabilities
Jonathan Peyton [Mon, 14 Nov 2016 21:08:35 +0000 (21:08 +0000)]
Introduce dynamic affinity dispatch capabilities

This set of changes enables the affinity interface (Either the preexisting
native operating system or HWLOC) to be dynamically set at runtime
initialization. The point of this change is that we were seeing performance
degradations when using HWLOC. This allows the user to use the old affinity
mechanisms which on large machines (>64 cores) makes a large difference in
initialization time.

These changes mostly move affinity code under a small class hierarchy:

KMPAffinity
  class Mask {}
KMPNativeAffinity : public KMPAffinity
  class Mask : public KMPAffinity::Mask
KMPHwlocAffinity
  class Mask : public KMPAffinity::Mask

Since all interface functions (for both affinity and the mask implementation)
are virtual, the implementation can be chosen at runtime initialization.

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

llvm-svn: 286890

7 years agoAdd a checkSymbolTable() method to the MachOObjectFile class.
Kevin Enderby [Mon, 14 Nov 2016 20:57:04 +0000 (20:57 +0000)]
Add a checkSymbolTable() method to the MachOObjectFile class.

The philosophy of the error checking in libObject for Mach-O files
is that the constructor will check the load commands so for their
tables the offsets and sizes are properly contained in the file.
But there is no checking of the entries of any of the tables.

For the contents of the tables themselves the methods accessing
the contents of the entries return errors as needed.  In some
cases this however makes it difficult or cumbersome to produce
a good error message which would include the tool name, file name,
archive member, and name of the architecture of a slice of a universal file
the error occurred in.

So idea is that there will be a method to check a table which can
be called up front before using it allowing a good error message
to be produced before a table is used.  And if only verification of
the Mach-O file and its tables are wanted a new possible method
checkAllTables() could be added to call all of the methods to
check all the tables at some time when such methods exist.

The checkSymbolTable() is the first of such methods to check
one of the Mach-O file tables.  This method initially will used in
llvm-objdump’s DisassembleMachO() routine before it gets the
section and symbol information.  As if there are problems with
the symbol table currently the error is first encountered by the
bool operator() in the SymbolSorter() struct which passed to
std::sort().  In this case there is no context as to the file name
the symbol which results a poor error message:

LLVM ERROR: truncated or malformed object (bad string index: 22 for symbol at index 1)

with the added call to the checkSymbolTable() method the
error message includes the tool name and file name:

llvm-objdump: 'macho-invalid-symbol-strx': truncated or malformed object (bad string table index: 22 past the end of string table, for symbol at index 1)
llvm-svn: 286887

7 years ago[Hexagon] Give a predicate function a more meaningful name
Krzysztof Parzyszek [Mon, 14 Nov 2016 20:53:09 +0000 (20:53 +0000)]
[Hexagon] Give a predicate function a more meaningful name

Change "orisadd" to "IsOrAdd" to follow the naming conventions, and
change "isOrAdd" in the C++ code to "isOrEquivalentToAdd".

llvm-svn: 286886

7 years agoTemporarily relax test expectations to fix failures on ppc64.
Evgeniy Stepanov [Mon, 14 Nov 2016 20:46:52 +0000 (20:46 +0000)]
Temporarily relax test expectations to fix failures on ppc64.

Summary: Relax test expectations to fix failures on ppc64.

Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

Patch by Aleksey Shlyapnikov.

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

llvm-svn: 286885

7 years agoP0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and istream_iter...
Marshall Clow [Mon, 14 Nov 2016 20:41:17 +0000 (20:41 +0000)]
P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and istream_iterator. No code changes were needed, but I updated a few tests.  Also resolved P0509 and P0521, which required no changes to the library or tests.

llvm-svn: 286884

7 years agoMissed a test with exceptions disabled earlier. Oops.
Marshall Clow [Mon, 14 Nov 2016 20:38:43 +0000 (20:38 +0000)]
Missed a test with exceptions disabled earlier. Oops.

llvm-svn: 286883