platform/upstream/llvm.git
7 years ago[Fortran Support] Detect Fortran arrays & metadata from dragonegg output
Siddharth Bhat [Wed, 10 May 2017 13:11:20 +0000 (13:11 +0000)]
[Fortran Support] Detect Fortran arrays & metadata from dragonegg output

Add the ability to tag certain memory accesses as those belonging to
Fortran arrays. We do this by pattern matching against known patterns
of Dragonegg's LLVM IR output from Fortran code.

Fortran arrays have metadata stored with them in a struct. This struct
is called the "Fortran array descriptor", and a reference to this is
stored in each MemoryAccess.

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

llvm-svn: 302653

7 years ago[LLVM][inline-asm] Altmacro string escape character '!'
Michael Zuckerman [Wed, 10 May 2017 13:08:11 +0000 (13:08 +0000)]
[LLVM][inline-asm] Altmacro string escape character '!'

This patch is the fourth patch in a series of reviews for the Altmacro feature.
This patch introduces a new escape character '!' and it depends on D32701.

according to https://sourceware.org/binutils/docs/as/Altmacro.html:
"single-character string escape
To include any single character literally in a string (even if the character would otherwise have some special meaning), you can prefix the character with !' (an exclamation mark). For example, you can write <4.3 !> 5.4!!>' to get the literal text `4.3 > 5.4!'. "

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

llvm-svn: 302652

7 years ago[DAGCombiner] Dropped explicit (sra 0, x) -> 0 and (sra -1, x) -> 0 folds.
Simon Pilgrim [Wed, 10 May 2017 13:06:26 +0000 (13:06 +0000)]
[DAGCombiner] Dropped explicit (sra 0, x) -> 0 and (sra -1, x) -> 0 folds.

These are both handled (and tested) by the earlier ComputeNumSignBits == EltSizeInBits fold.

llvm-svn: 302651

7 years ago[IfConversion] Add missing check in IfConversion/canFallThroughTo
Mikael Holmen [Wed, 10 May 2017 13:06:13 +0000 (13:06 +0000)]
[IfConversion] Add missing check in IfConversion/canFallThroughTo

Summary:
When trying to figure out if MBB could fallthrough to ToMBB (possibly by
falling through a bunch of other MBBs) we didn't actually check if there
was fallthrough between the last two blocks in the chain.

Reviewers: kparzysz, iteratee, MatzeB

Reviewed By: kparzysz, iteratee

Subscribers: javed.absar, llvm-commits

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

llvm-svn: 302650

7 years ago[SystemZ] Implement getRepRegClassFor()
Jonas Paulsson [Wed, 10 May 2017 13:03:25 +0000 (13:03 +0000)]
[SystemZ]  Implement getRepRegClassFor()

This method must return a valid register class, or the list-ilp isel
scheduler will crash. For MVT::Untyped nullptr was previously returned, but
now ADDR128BitRegClass is returned instead. This is needed just as long as
list-ilp (and probably also list-hybrid) is still there.

Review: Ulrich Weigand, A Trick
https://reviews.llvm.org/D32802

llvm-svn: 302649

7 years ago[AMDGPU][MC] Corrected v_madak/madmk to avoid printing "_e32" in disassembler output
Dmitry Preobrazhensky [Wed, 10 May 2017 13:00:28 +0000 (13:00 +0000)]
[AMDGPU][MC] Corrected v_madak/madmk to avoid printing "_e32" in disassembler output

See bug 32927: https://bugs.llvm.org//show_bug.cgi?id=32927

Reviewers: vpykhtin, artem.tamazov, arsenm

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

llvm-svn: 302648

7 years ago[GlobalISel][X86] Split test file. NFC
Igor Breger [Wed, 10 May 2017 12:58:31 +0000 (12:58 +0000)]
[GlobalISel][X86] Split test file. NFC

llvm-svn: 302647

7 years ago[SystemZ] Add decimal integer instructions
Ulrich Weigand [Wed, 10 May 2017 12:42:45 +0000 (12:42 +0000)]
[SystemZ] Add decimal integer instructions

This adds the set of decimal integer (BCD) instructions for
assembler / disassembler use.

llvm-svn: 302646

7 years ago[SystemZ] Add crypto instructions
Ulrich Weigand [Wed, 10 May 2017 12:42:00 +0000 (12:42 +0000)]
[SystemZ] Add crypto instructions

This adds the set of message-security assist instructions for
assembler / disassembler use.

llvm-svn: 302645

7 years ago[SystemZ] Add translate/convert instructions
Ulrich Weigand [Wed, 10 May 2017 12:41:12 +0000 (12:41 +0000)]
[SystemZ] Add translate/convert instructions

This adds the set of character-set translate and convert instructions
for assembler / disassembler use.

llvm-svn: 302644

7 years ago[SystemZ] Add missing memory/string instructions
Ulrich Weigand [Wed, 10 May 2017 12:40:15 +0000 (12:40 +0000)]
[SystemZ] Add missing memory/string instructions

This adds a number of missing memory and string instructions
for assembler / disassembler use.

llvm-svn: 302643

7 years ago[SystemZ] Reformat assembler/disassembler tests
Ulrich Weigand [Wed, 10 May 2017 12:39:11 +0000 (12:39 +0000)]
[SystemZ] Reformat assembler/disassembler tests

The assembler and disassmebler test cases started out formatted and
sorted in a particular way, but this got lost over time as patches
were added.  Reformat them again.  NFC.

llvm-svn: 302642

7 years ago[DAGCombiner] Add vector support to fold (shl/srl 0, x) -> 0
Simon Pilgrim [Wed, 10 May 2017 12:34:27 +0000 (12:34 +0000)]
[DAGCombiner] Add vector support to fold (shl/srl 0, x) -> 0

llvm-svn: 302641

7 years agoRevert r301950: SpeculativeExecution: Stop using whitelist for costs
Chandler Carruth [Wed, 10 May 2017 12:30:07 +0000 (12:30 +0000)]
Revert r301950: SpeculativeExecution: Stop using whitelist for costs

This pass doesn't correctly handle testing for when it is legal to hoist
arbitrary instructions. The whitelist happens to make it safe, so before
it is removed the pass's legality checks will need to be enhanced.

Details have been added to the code review thread for the patch.

llvm-svn: 302640

7 years ago[msan] Fix getmntent{_r} for empty /etc/fstab
Adhemerval Zanella [Wed, 10 May 2017 12:18:25 +0000 (12:18 +0000)]
[msan] Fix getmntent{_r} for empty /etc/fstab

Some configuration (for instance default docker ubuntu images) uses
a default empty and invalid /etc/fstab configuration file.  It makes
any call to getmntent return NULL and it leads to failures on
Msan-aarch64{-with-call}-Test/MemorySanitizer.getmntent{_r}.

This patch fixes it by creating a temporary file with some valid
entries (although not valid for the system) to use along with
setmntent/getmntent.

llvm-svn: 302639

7 years ago[GPUJIT] Disabled gcc's -Wpedantic for use of dlsym
Siddharth Bhat [Wed, 10 May 2017 11:51:44 +0000 (11:51 +0000)]
[GPUJIT] Disabled gcc's -Wpedantic for use of dlsym

GCC's ISO C standard does not strictly define the bahavior of converting
a `void*` pointer to a function pointer, but dlsym's POSIX standard
does.

The retrieval of function pointers through dlsym in this case
generates an unnecessary amount of warnings for every API function
assignment, bloating the output.

This patch removes GCC's `-Wpedantic` flag for retrieval and assignment
of these functions. This simplifies debugging the output of GPUJIT.

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

llvm-svn: 302638

7 years ago[clang-tidy] Add new cert-dcl21-cpp check
Gabor Horvath [Wed, 10 May 2017 11:16:55 +0000 (11:16 +0000)]
[clang-tidy] Add new cert-dcl21-cpp check

This check flags postfix operator++/-- declarations,
where the return type is not a const object.

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

llvm-svn: 302637

7 years ago[Polly] Canonicalize arrays according to base-ptr equivalence class
Tobias Grosser [Wed, 10 May 2017 10:59:58 +0000 (10:59 +0000)]
[Polly] Canonicalize arrays according to base-ptr equivalence class

Summary:
    In case two arrays share base pointers in the same invariant load equivalence
    class, we canonicalize all memory accesses to the first of these arrays
    (according to their order in the equivalence class).

    This enables us to optimize kernels such as boost::ublas by ensuring that
    different references to the C array are interpreted as accesses to the same
    array. Before this change the runtime alias check for ublas would fail, as it
    would assume models of the C array with differing (but identically valued) base
    pointers would reference distinct regions of memory whereas the referenced
    memory regions were indeed identical.

    As part of this change we remove most of the MemoryAccess::get*BaseAddr
    interface. We removed already all references to get*BaseAddr in previous
    commits to ensure that no code relies on matching base pointers between
    memory accesses and scop arrays -- except for three remaining uses where we
    need the original base pointer. We document for these situations that
    MemoryAccess::getOriginalBaseAddr may return a base pointer that is distinct
    to the base pointer of the scop array referenced by this memory access.

Reviewers: sebpop, Meinersbur, zinob, gareevroman, pollydev, huihuiz, efriedma, jdoerfert

Reviewed By: Meinersbur

Subscribers: etherzhhb

Tags: #polly

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

llvm-svn: 302636

7 years ago[mips] XFAIL getpwnam_r_invalid_user.cc test
Simon Dardis [Wed, 10 May 2017 10:58:11 +0000 (10:58 +0000)]
[mips] XFAIL getpwnam_r_invalid_user.cc test

XFAIL this test while we investigate the root cause.

llvm-svn: 302635

7 years ago[AArch64] Fix a comment to match the code. NFC.
Martin Storsjo [Wed, 10 May 2017 10:51:32 +0000 (10:51 +0000)]
[AArch64] Fix a comment to match the code. NFC.

For the ELF case, the default/preferred form is the generic one, not
the short one as used for Apple - fix the comment to say so. Currently
it is a copy-paste typo.

Make the comments on the darwin default a bit more verbose.

Use enum names instead of literal 0/1 to further increase readability
and reduce fragility.

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

llvm-svn: 302634

7 years ago[OpenCL] Handle OpenCL specific subelement types
Egor Churaev [Wed, 10 May 2017 10:28:34 +0000 (10:28 +0000)]
[OpenCL] Handle OpenCL specific subelement types

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

llvm-svn: 302633

7 years ago[index] Index simple dependent declaration references
Alex Lorenz [Wed, 10 May 2017 09:47:41 +0000 (09:47 +0000)]
[index] Index simple dependent declaration references

This commit implements basic support for indexing of dependent declaration
references. Now the indexer tries to find a suitable match in the base template
for a dependent member ref/decl ref/dependent type.

rdar://29158210

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

llvm-svn: 302632

7 years agoAdd a late IR expansion pass for the experimental reduction intrinsics.
Amara Emerson [Wed, 10 May 2017 09:42:49 +0000 (09:42 +0000)]
Add a late IR expansion pass for the experimental reduction intrinsics.

This pass uses a new target hook to decide whether or not to expand a particular
intrinsic to the shuffevector sequence.

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

llvm-svn: 302631

7 years ago[OpenCL] Added checking OpenCL version for cl_khr_mipmap_image built-ins
Egor Churaev [Wed, 10 May 2017 08:23:01 +0000 (08:23 +0000)]
[OpenCL] Added checking OpenCL version for cl_khr_mipmap_image built-ins

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

llvm-svn: 302630

7 years agoFix use of removed SH test replacement %exec
Eric Fiselier [Wed, 10 May 2017 08:15:40 +0000 (08:15 +0000)]
Fix use of removed SH test replacement %exec

llvm-svn: 302629

7 years ago[Safestack] Fix the canary test to catch the libc's message regarding stack smashing
Ivan A. Kosarev [Wed, 10 May 2017 08:06:42 +0000 (08:06 +0000)]
[Safestack] Fix the canary test to catch the libc's message regarding stack smashing

By default glibc writes its diagnostics directly to tty so the `2>&1 |`
redirection in the test doesn't catch the *** stack smashing detected ***
message, which in turn breaks printing the lit's progress bar. By defining
the LIBC_FATAL_STDERR_ environment variable we force glibc to direct
diagnostic messages to stderr.

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

llvm-svn: 302628

7 years agoAttempt to speculatively unbreak Apple build bots
Eric Fiselier [Wed, 10 May 2017 08:04:50 +0000 (08:04 +0000)]
Attempt to speculatively unbreak Apple build bots

llvm-svn: 302627

7 years ago[APInt] Fix indentation of tcDivide. Combine variable declaration and initialization.
Craig Topper [Wed, 10 May 2017 07:50:17 +0000 (07:50 +0000)]
[APInt] Fix indentation of tcDivide. Combine variable declaration and initialization.

llvm-svn: 302626

7 years ago[APInt] Use getNumWords function in udiv/urem/udivrem instead of reimplementinging it.
Craig Topper [Wed, 10 May 2017 07:50:15 +0000 (07:50 +0000)]
[APInt] Use getNumWords function in udiv/urem/udivrem instead of reimplementinging it.

llvm-svn: 302625

7 years agoAdd ASTMatchRefactorer and ReplaceNodeWithTemplate to RefactoringCallbacks
Eric Liu [Wed, 10 May 2017 07:48:45 +0000 (07:48 +0000)]
Add ASTMatchRefactorer and ReplaceNodeWithTemplate to RefactoringCallbacks

Summary: This is the first change as part of developing a clang-query based search and replace tool.

Reviewers: klimek, bkramer, ioeric, sbenza, jbangert

Reviewed By: ioeric, jbangert

Subscribers: sbenza, ioeric, cfe-commits

Patch by Julian Bangert!

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

llvm-svn: 302624

7 years ago[GlobalISel][X86] G_ZEXT i1 to i32/i64 support.
Igor Breger [Wed, 10 May 2017 06:52:58 +0000 (06:52 +0000)]
[GlobalISel][X86] G_ZEXT i1 to i32/i64 support.

Summary: Support G_ZEXT i1 to i32/i64 instruction selection.

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, llvm-commits, kristof.beyls

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

llvm-svn: 302623

7 years ago[UnreachableBlockElim] Check return value of constrainRegClass().
Mikael Holmen [Wed, 10 May 2017 06:33:43 +0000 (06:33 +0000)]
[UnreachableBlockElim] Check return value of constrainRegClass().

Summary:
MachineRegisterInfo::constrainRegClass() can fail if two register classes
don't have a common subclass or if the register class doesn't contain
enough registers. Check the return value before trying to remove Phi nodes,
and if we can't constrain, we output a COPY instead of simply replacing
registers.

Reviewers: kparzysz, david2050, wmi

Reviewed By: kparzysz

Subscribers: llvm-commits

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

llvm-svn: 302622

7 years agoAdd noreturn attribute to avoid warnings about missing initialization
Tobias Grosser [Wed, 10 May 2017 05:20:56 +0000 (05:20 +0000)]
Add noreturn attribute to avoid warnings about missing initialization

Before this change we saw warnings such as:

  tools/GPURuntime/GPUJIT.c:1566:3:
  warning: variable 'DevPtr' is used uninitialized whenever switch default is
  taken [-Wsometimes-uninitialized]
    default:

llvm-svn: 302621

7 years agoFix formatting in Polly
Tobias Grosser [Wed, 10 May 2017 04:53:59 +0000 (04:53 +0000)]
Fix formatting in Polly

llvm-svn: 302620

7 years agoRename Appveyor install helper script.
Eric Fiselier [Wed, 10 May 2017 02:43:02 +0000 (02:43 +0000)]
Rename Appveyor install helper script.

I'm really lazy and the old name for the helper script
killed 2 letter tab completion for the include directory.
This patch renames it to avoid that problem and enable
lazyness.

llvm-svn: 302619

7 years agoUpdate Polly for LLVM API change r302571 that removed varargs functions
Chandler Carruth [Wed, 10 May 2017 02:39:35 +0000 (02:39 +0000)]
Update Polly for LLVM API change r302571 that removed varargs functions
with a nullptr sentinel in favor of nicely typed variadic templates.

llvm-svn: 302618

7 years agoSupport using MinGW POSIX threads on Windows
Eric Fiselier [Wed, 10 May 2017 02:36:48 +0000 (02:36 +0000)]
Support using MinGW POSIX threads on Windows

llvm-svn: 302617

7 years agoattempt to fix appveyor syntax error
Eric Fiselier [Wed, 10 May 2017 02:34:56 +0000 (02:34 +0000)]
attempt to fix appveyor syntax error

llvm-svn: 302616

7 years agoWhen we see a '<' operator, check whether it's a probable typo for a template-id.
Richard Smith [Wed, 10 May 2017 02:30:28 +0000 (02:30 +0000)]
When we see a '<' operator, check whether it's a probable typo for a template-id.

The heuristic that we use here is:
 * the left-hand side must be a simple identifier or a class member access
 * the right-hand side must be '<' followed by either a '>' or by a type-id that
   cannot be an expression (in particular, not followed by '(' or '{')
 * there is a '>' token matching the '<' token

The second condition guarantees the expression would otherwise be ill-formed.

If we're confident that the user intended the name before the '<' to be
interpreted as a template, diagnose the fact that we didn't interpret it
that way, rather than diagnosing that the template arguments are not valid
expressions.

llvm-svn: 302615

7 years agoAdd MinGW64 builder to Appveyor.
Eric Fiselier [Wed, 10 May 2017 02:30:16 +0000 (02:30 +0000)]
Add MinGW64 builder to Appveyor.

With the amount of work happening on Windows we should
have a MinGW bot to make sure we don't regress that functionality.
Currently it doesn't build :-(

llvm-svn: 302614

7 years ago[Core] Make parallel algorithms match C++ Parallelism TS.
Zachary Turner [Wed, 10 May 2017 01:16:22 +0000 (01:16 +0000)]
[Core] Make parallel algorithms match C++ Parallelism TS.

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

llvm-svn: 302613

7 years ago[CodeGen] Don't require AA in TwoAddress at -O0.
Ahmed Bougacha [Wed, 10 May 2017 00:56:00 +0000 (00:56 +0000)]
[CodeGen] Don't require AA in TwoAddress at -O0.

This is a follow-up to r302611, which moved an -O0 computation of DT
from SDAGISel to TwoAddress.

Don't use it here either, and avoid computing it completely.  The only
use was forwarding the analysis as an optional argument to utility
functions.

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

llvm-svn: 302612

7 years ago[CodeGen] Don't require AA in SDAGISel at -O0.
Ahmed Bougacha [Wed, 10 May 2017 00:39:30 +0000 (00:39 +0000)]
[CodeGen] Don't require AA in SDAGISel at -O0.

Before r247167, the pass manager builder controlled which AA
implementations were used, exporting them all in the AliasAnalysis
analysis group.

Now, AAResultsWrapperPass always uses BasicAA, but still uses other AA
implementations if made available in the pass pipeline.

But regardless, SDAGISel is required at O0, and really doesn't need to
be doing fancy optimizations based on useful AA results.

Don't require AA at CodeGenOpt::None, and only use it otherwise.

This does have a functional impact (and one testcase is pessimized
because we can't reuse a load).  But I think that's desirable no matter
what.

Note that this alone doesn't result in less DT computations: TwoAddress
was previously able to reuse the DT we computed for SDAG.  That will be
fixed separately.

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

llvm-svn: 302611

7 years ago[CodeGen] Compute DT/LI lazily in SafeStackLegacyPass. NFC.
Ahmed Bougacha [Wed, 10 May 2017 00:39:25 +0000 (00:39 +0000)]
[CodeGen] Compute DT/LI lazily in SafeStackLegacyPass. NFC.

We currently require SCEV, which requires DT/LI.  Those are expensive to
compute, but the pass only runs for functions that have the safestack
attribute.

Compute DT/LI to build SCEV lazily, only when the pass is actually going
to transform the function.

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

llvm-svn: 302610

7 years ago[CodeGen] Split SafeStack into a LegacyPass and a utility. NFC.
Ahmed Bougacha [Wed, 10 May 2017 00:39:22 +0000 (00:39 +0000)]
[CodeGen] Split SafeStack into a LegacyPass and a utility. NFC.

This lets the pass focus on gathering the required analyzes, and the
utility class focus on the transformation.

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

llvm-svn: 302609

7 years ago[CodeGen] Add an -O0 backend pipeline test. NFC.
Ahmed Bougacha [Wed, 10 May 2017 00:39:17 +0000 (00:39 +0000)]
[CodeGen] Add an -O0 backend pipeline test. NFC.

This should hopefully makes changes to the O0 pipeline obvious; it's
easy to require expensive passes, and this helps make informed
decisions.

Case in point: in the few weeks separating the time when I initially
wrote this patch to the time when I committed, the test regressed as
r302103 added another use of DT!

llvm-svn: 302608

7 years agoImprove how LIT reports the added environment variables
Eric Fiselier [Wed, 10 May 2017 00:23:58 +0000 (00:23 +0000)]
Improve how LIT reports the added environment variables

llvm-svn: 302607

7 years ago[WebAssembly] Fix build error in wasm YAML code
Sam Clegg [Wed, 10 May 2017 00:14:04 +0000 (00:14 +0000)]
[WebAssembly] Fix build error in wasm YAML code

This warning didn't show up on my local build
but is causing the bots to fail.  Seems like a
bad idea to have types and variables with the
same name anyhow.

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

llvm-svn: 302606

7 years ago[InstCombine] add helper function for add X, C folds; NFCI
Sanjay Patel [Wed, 10 May 2017 00:07:16 +0000 (00:07 +0000)]
[InstCombine] add helper function for add X, C folds; NFCI

llvm-svn: 302605

7 years agoAttempt to unbreak Libc++ test configuration
Eric Fiselier [Wed, 10 May 2017 00:05:04 +0000 (00:05 +0000)]
Attempt to unbreak Libc++ test configuration

llvm-svn: 302604

7 years agoWhen instantiating a friend function template, don't forget to inherit default templa...
Richard Smith [Wed, 10 May 2017 00:01:13 +0000 (00:01 +0000)]
When instantiating a friend function template, don't forget to inherit default template arguments from other declarations.

llvm-svn: 302603

7 years agoFix test runtime environment on Windows
Eric Fiselier [Tue, 9 May 2017 23:57:22 +0000 (23:57 +0000)]
Fix test runtime environment on Windows

llvm-svn: 302602

7 years ago[WebAssembly] Improve libObject support for wasm imports and exports
Sam Clegg [Tue, 9 May 2017 23:48:41 +0000 (23:48 +0000)]
[WebAssembly] Improve libObject support for wasm imports and exports

Previously we had only supported the importing and
exporting of functions and globals.

Also, add usefull overload of getWasmSymbol() and
getNumberOfSymbols() in support of lld port.

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

llvm-svn: 302601

7 years agoFix misspelling of environment throughout libc++
Eric Fiselier [Tue, 9 May 2017 23:47:20 +0000 (23:47 +0000)]
Fix misspelling of environment throughout libc++

llvm-svn: 302600

7 years ago[InstCombine] add tests for andn; NFC
Sanjay Patel [Tue, 9 May 2017 23:40:13 +0000 (23:40 +0000)]
[InstCombine] add tests for andn; NFC

llvm-svn: 302599

7 years ago[ubsan] Mark overflow checks with !nosanitize
Vedant Kumar [Tue, 9 May 2017 23:34:49 +0000 (23:34 +0000)]
[ubsan] Mark overflow checks with !nosanitize

Sanitizer instrumentation generally needs to be marked with !nosanitize,
but we're not doing this properly for ubsan's overflow checks.

r213291 has more information about why this is needed.

llvm-svn: 302598

7 years ago[ProfileSummary] Make getProfileCount a non-static member function.
Easwaran Raman [Tue, 9 May 2017 23:21:10 +0000 (23:21 +0000)]
[ProfileSummary] Make getProfileCount a non-static member function.

This change is required because the notion of count is different for
sample profiling and getProfileCount will need to determine the
underlying profile type.

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

llvm-svn: 302597

7 years agoDon't mark a member as a member specialization until we know we're keeping the specia...
Richard Smith [Tue, 9 May 2017 23:02:10 +0000 (23:02 +0000)]
Don't mark a member as a member specialization until we know we're keeping the specialization.

This improves our behavior in a few ways:

 * We now guarantee that if a member is marked as being a member
   specialization, there will actually be a member specialization declaration
   somewhere on its redeclaration chain. This fixes a crash in modules builds
   where we would try to check that there was a visible declaration of the
   member specialization and be surprised to not find any declaration of it at
   all.

 * We don't set the source location of the in-class declaration of the member
   specialization to the out-of-line declaration's location until we have
   actually finished merging them. This fixes some very silly looking
   diagnostics, where we'd point a "previous declaration is here" note at the
   same declaration we're complaining about. Ideally we wouldn't mess with the
   prior declaration's location at all, but too much code assumes that the
   first declaration of an entity is a reasonable thing to use as an indication
   of where it was declared, and that's not really true for a member
   specialization unless we fake it like this.

llvm-svn: 302596

7 years agoFunctionImport: Simplify function llvm::thinLTOInternalizeModule. NFCI.
Peter Collingbourne [Tue, 9 May 2017 22:43:31 +0000 (22:43 +0000)]
FunctionImport: Simplify function llvm::thinLTOInternalizeModule. NFCI.

llvm-svn: 302595

7 years agoFix clang_cl argument in fsanitize.c driver test.
Evgeniy Stepanov [Tue, 9 May 2017 22:28:57 +0000 (22:28 +0000)]
Fix clang_cl argument in fsanitize.c driver test.

llvm-svn: 302594

7 years ago[Sema] Implement Core 2094: Trivial copy/move constructor for class with volatile...
Eric Fiselier [Tue, 9 May 2017 22:21:24 +0000 (22:21 +0000)]
[Sema] Implement Core 2094: Trivial copy/move constructor for class with volatile member

Summary: This patch implements http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2094 which reverts Core 496.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 302593

7 years agoUpdate Clang C++ DR documentation for new issue list
Eric Fiselier [Tue, 9 May 2017 22:17:23 +0000 (22:17 +0000)]
Update Clang C++ DR documentation for new issue list

llvm-svn: 302592

7 years ago[asan] A clang flag to enable ELF globals-gc.
Evgeniy Stepanov [Tue, 9 May 2017 21:57:43 +0000 (21:57 +0000)]
[asan] A clang flag to enable ELF globals-gc.

This feature is subtly broken when the linker is gold 2.26 or
earlier. See the following bug for details:
  https://sourceware.org/bugzilla/show_bug.cgi?id=19002

Since the decision needs to be made at compilation time, we can not
test the linker version. The flag is off by default on ELF targets,
and on otherwise.

llvm-svn: 302591

7 years agoRemove unnecessary calls to MakeArgString.
Evgeniy Stepanov [Tue, 9 May 2017 21:57:39 +0000 (21:57 +0000)]
Remove unnecessary calls to MakeArgString.

llvm-svn: 302590

7 years ago[ExecutionEngine] Make RuntimeDyld::MemoryManager responsible for tracking EH
Lang Hames [Tue, 9 May 2017 21:32:18 +0000 (21:32 +0000)]
[ExecutionEngine] Make RuntimeDyld::MemoryManager responsible for tracking EH
frames.

RuntimeDyld was previously responsible for tracking allocated EH frames, but it
makes more sense to have the RuntimeDyld::MemoryManager track them (since the
frames are allocated through the memory manager, and written to memory owned by
the memory manager). This patch moves the frame tracking into
RTDyldMemoryManager, and changes the deregisterFrames method on
RuntimeDyld::MemoryManager from:

void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size);

to:

void deregisterEHFrames();

Separating this responsibility will allow ORC to continue to throw the
RuntimeDyld instances away post-link (saving a few dozen bytes per lazy
function) while properly deregistering frames when modules are unloaded.

This patch also updates ORC to call deregisterEHFrames when modules are
unloaded. This fixes a bug where an exception that tears down the JIT can then
unwind through dangling EH frames that have been deallocated but not
deregistered, resulting in UB.

For people using SectionMemoryManager this should be pretty much a no-op. For
people with custom allocators that override registerEHFrames/deregisterEHFrames,
you will now be responsible for tracking allocated EH frames.

Reviewed in https://reviews.llvm.org/D32829

llvm-svn: 302589

7 years agoFix CGObjCGNU::init bug introduced by r302572
Serge Guelton [Tue, 9 May 2017 21:19:44 +0000 (21:19 +0000)]
Fix CGObjCGNU::init bug introduced by r302572

llvm-svn: 302588

7 years ago[GVN] Fix a crash on encountering non-integral pointers
Keno Fischer [Tue, 9 May 2017 21:07:20 +0000 (21:07 +0000)]
[GVN] Fix a crash on encountering non-integral pointers

Summary:
This fixes the immediate crash caused by introducing an incorrect inttoptr
before attempting the conversion. There may still be a legality
check missing somewhere earlier for non-integral pointers, but this change
seems necessary in any case.

Reviewers: sanjoy, dberlin

Reviewed By: dberlin

Subscribers: llvm-commits

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

llvm-svn: 302587

7 years ago[AMDGPU] Fixed typo in GCNRegPressure, NFC
Stanislav Mekhanoshin [Tue, 9 May 2017 20:50:04 +0000 (20:50 +0000)]
[AMDGPU] Fixed typo in GCNRegPressure, NFC

VGRP -> VGPR, SGRP -> SGPR

llvm-svn: 302586

7 years ago[InstCombine] update test file to use FileCheck; NFC
Sanjay Patel [Tue, 9 May 2017 20:46:12 +0000 (20:46 +0000)]
[InstCombine] update test file to use FileCheck; NFC

llvm-svn: 302585

7 years agoImport sys in repo.py.
Lang Hames [Tue, 9 May 2017 20:37:01 +0000 (20:37 +0000)]
Import sys in repo.py.

The find function in repo.py calls sys.exit on error. Without this import that
call to exit will fail, masking the actual error message. This patch fixes that.

llvm-svn: 302584

7 years agoDAGCombine: Combine shuffles of splat-shuffles
Zvi Rackover [Tue, 9 May 2017 20:25:38 +0000 (20:25 +0000)]
DAGCombine: Combine shuffles of splat-shuffles

Summary: Reapply r299047, but this time handle correctly splat-masks with undef elements.

Reviewers: spatel, RKSimon, eli.friedman, andreadb

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 302583

7 years ago[AArch64] Consider widening instructions in cost calculations
Matthew Simpson [Tue, 9 May 2017 20:18:12 +0000 (20:18 +0000)]
[AArch64] Consider widening instructions in cost calculations

The AArch64 instruction set has a few "widening" instructions (e.g., uaddl,
saddl, uaddw, etc.) that take one or more doubleword operands and produce
quadword results. The operands are automatically sign- or zero-extended as
appropriate. However, in LLVM IR, these extends are explicit. This patch
updates TTI to consider these widening instructions as single operations whose
cost is attached to the arithmetic instruction. It marks extends that are part
of a widening operation "free" and applies a sub-target specified overhead
(zero by default) to the arithmetic instructions.

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

llvm-svn: 302582

7 years ago[InstCombine] clean up matchDeMorgansLaws(); NFCI
Sanjay Patel [Tue, 9 May 2017 20:05:05 +0000 (20:05 +0000)]
[InstCombine] clean up matchDeMorgansLaws(); NFCI

The motivation for getting rid of dyn_castNotVal is to allow fixing:
https://bugs.llvm.org/show_bug.cgi?id=32706

So this was supposed to be functional-change-intended for the case
of inverting constants and applying DeMorgan. However, I can't find
any cases where that pattern will actually get to matchDeMorgansLaws()
because we have other folds in visitAnd/visitOr that do the same
thing. So this ends up just being a clean-up patch with slight efficiency
improvement, but no-functional-change-intended.

llvm-svn: 302581

7 years agoclang-format: [JS] Don't indent JavaScript IIFEs.
Martin Probst [Tue, 9 May 2017 20:04:09 +0000 (20:04 +0000)]
clang-format: [JS] Don't indent JavaScript IIFEs.

Because IIFEs[1] are often used like an anonymous namespace around large
sections of JavaScript code, it's useful not to indent to them (which
effectively reduces the column limit by the indent amount needlessly).

It's also common for developers to wrap these around entire files or
libraries. When adopting clang-format, changing the indent entire file
can reduce the usefulness of the blame annotations.

Patch by danbeam, thanks!

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

llvm-svn: 302580

7 years ago[NewGVN] Simplify a DEBUG() statement. NFCI.
Davide Italiano [Tue, 9 May 2017 20:02:48 +0000 (20:02 +0000)]
[NewGVN] Simplify a DEBUG() statement. NFCI.

llvm-svn: 302579

7 years ago[codeview] Check for a DIExpression offset for local variables
Reid Kleckner [Tue, 9 May 2017 19:59:29 +0000 (19:59 +0000)]
[codeview] Check for a DIExpression offset for local variables

Fixes inalloca parameters, which previously all pointed to the same
offset. Extend the test to use llvm-readobj so that we can test the
offset in a readable way.

llvm-svn: 302578

7 years agoUpdate testcase for upstream LLVM changes (r302469).
Adrian Prantl [Tue, 9 May 2017 19:47:41 +0000 (19:47 +0000)]
Update testcase for upstream LLVM changes (r302469).

llvm-svn: 302577

7 years agoMake it illegal for two Functions to point to the same DISubprogram
Adrian Prantl [Tue, 9 May 2017 19:47:37 +0000 (19:47 +0000)]
Make it illegal for two Functions to point to the same DISubprogram

As recently discussed on llvm-dev [1], this patch makes it illegal for
two Functions to point to the same DISubprogram and updates
FunctionCloner to also clone the debug info of a function to conform
to the new requirement. To simplify the implementation it also factors
out the creation of inlineAt locations from the Inliner into a
general-purpose utility in DILocation.

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-May/112661.html
<rdar://problem/31926379>

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

This reapplies r302469 with a fix for a bot failure (reparentDebugInfo
now checks for the case the orig and new function are identical).

llvm-svn: 302576

7 years agoNFC: refactor replaceDominatedUsesWith
Piotr Padlewski [Tue, 9 May 2017 19:39:44 +0000 (19:39 +0000)]
NFC: refactor replaceDominatedUsesWith

Summary:
Since I will post patch with some changes to
replaceDominatedUsesWith, it would be good to avoid
duplicating code again.

Reviewers: davide, dberlin

Subscribers: llvm-commits

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

llvm-svn: 302575

7 years ago[DWARF] Fix a parsing issue with type unit headers.
Wolfgang Pieb [Tue, 9 May 2017 19:38:38 +0000 (19:38 +0000)]
[DWARF] Fix a parsing issue with type unit headers.

Reviewers: dblaikie

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

llvm-svn: 302574

7 years agoFix the Endianness bug by adding the little endian UTF marker.
Eric Beckmann [Tue, 9 May 2017 19:35:45 +0000 (19:35 +0000)]
Fix the Endianness bug by adding the little endian UTF marker.

Summary: Quick fix

Reviewers: zturner, uweigand

Subscribers: llvm-commits

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

llvm-svn: 302573

7 years agoSuppress all uses of LLVM_END_WITH_NULL. NFC.
Serge Guelton [Tue, 9 May 2017 19:31:30 +0000 (19:31 +0000)]
Suppress all uses of LLVM_END_WITH_NULL. NFC.

Use variadic templates instead of relying on <cstdarg> + sentinel.

This enforces better type checking and makes code more readable.

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

llvm-svn: 302572

7 years agoSuppress all uses of LLVM_END_WITH_NULL. NFC.
Serge Guelton [Tue, 9 May 2017 19:31:13 +0000 (19:31 +0000)]
Suppress all uses of LLVM_END_WITH_NULL. NFC.

Use variadic templates instead of relying on <cstdarg> + sentinel.
This enforces better type checking and makes code more readable.

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

llvm-svn: 302571

7 years ago[mips] XFAIL dfsan's custom.cc test on mips64.
Simon Dardis [Tue, 9 May 2017 19:17:16 +0000 (19:17 +0000)]
[mips] XFAIL dfsan's custom.cc test on mips64.

Test was already marked as failing for mips64el. Now that it's being
tested on mips64, it has to be XFAILed there as well.

llvm-svn: 302570

7 years ago[WebAssembly] Fix failing wasm-toolchain test
Sam Clegg [Tue, 9 May 2017 18:44:23 +0000 (18:44 +0000)]
[WebAssembly] Fix failing wasm-toolchain test

This test was broken in r302558.

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

llvm-svn: 302569

7 years ago[lanai] Add computeKnownBitsForTargetNode for Lanai.
Jacques Pienaar [Tue, 9 May 2017 18:35:26 +0000 (18:35 +0000)]
[lanai] Add computeKnownBitsForTargetNode for Lanai.

Summary: computeKnownBitsForTargetNode was not defined for Lanai which resulted in additional AND's with 0x1 for the output of SETCC instructions.

Reviewers: eliben, majnemer

Reviewed By: majnemer

Subscribers: llvm-commits

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

llvm-svn: 302568

7 years ago[mips] Remove XFAIL from sanitizer_coverage_no_prune.cc
Simon Dardis [Tue, 9 May 2017 18:29:44 +0000 (18:29 +0000)]
[mips] Remove XFAIL from sanitizer_coverage_no_prune.cc

Test is XPASSing, so remove the XFAIL marker.

llvm-svn: 302567

7 years ago[NewGVN] Explain why sorting by pointer values doesn't introduce non-determinism.
Davide Italiano [Tue, 9 May 2017 18:29:37 +0000 (18:29 +0000)]
[NewGVN] Explain why sorting by pointer values doesn't introduce non-determinism.

Thanks to Eli for pointing out in a post-commit review comment.

llvm-svn: 302566

7 years ago[SystemZ] Support missing relocation types in RuntimeDyldELF
Ulrich Weigand [Tue, 9 May 2017 18:27:39 +0000 (18:27 +0000)]
[SystemZ] Support missing relocation types in RuntimeDyldELF

Handle some more relocation types in
RuntimeDyldELF::resolveSystemZRelocation

This fixes a number of failing LLDB test cases.

llvm-svn: 302565

7 years agoAdd memory ORIGIN and LENGTH expression support
Rui Ueyama [Tue, 9 May 2017 18:24:38 +0000 (18:24 +0000)]
Add memory ORIGIN and LENGTH expression support

Adds support for the ORIGIN and LENGTH linker script built in functions.

  ORIGIN(memory) Return the origin of the memory region
  LENGTH(memory) Return the length of the memory region

Redo of D29775 for refactored linker script parsing.

Patch by Robert Clarke

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

llvm-svn: 302564

7 years ago[SystemZ] Remove XFAIL on sanitizer_coverage_no_prune.cc
Ulrich Weigand [Tue, 9 May 2017 18:17:26 +0000 (18:17 +0000)]
[SystemZ] Remove XFAIL on sanitizer_coverage_no_prune.cc

This test case works fine on SystemZ as well.

llvm-svn: 302563

7 years ago[SystemZ] Fix failures after D32542
Ulrich Weigand [Tue, 9 May 2017 18:07:50 +0000 (18:07 +0000)]
[SystemZ] Fix failures after D32542

This commit made ubsan use the fast unwinder.  On SystemZ this requires
test cases to be compiled with -mbackchain.  That was already done for
asan, but not ubsan.  Add the flag for ubsan as well.

llvm-svn: 302562

7 years ago[compiler-rt][mips] Fix a test for mips.
Simon Dardis [Tue, 9 May 2017 17:58:33 +0000 (17:58 +0000)]
[compiler-rt][mips] Fix a test for mips.

GCC 4.9.2 likes the specialize one of the memcpys in msan_interceptors.cc,
leading to test failure.

llvm-svn: 302561

7 years ago[WebAssembly] Fix validation of start function
Sam Clegg [Tue, 9 May 2017 17:51:38 +0000 (17:51 +0000)]
[WebAssembly] Fix validation of start function

The check for valid start function was inverted.  Added a new
test in test/Object to check this case and fixed the existing
tests in for ObjectYAML.

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

llvm-svn: 302560

7 years ago[X86][LWP] Remove MSVC LWP intrinsics stubs.
Simon Pilgrim [Tue, 9 May 2017 17:50:16 +0000 (17:50 +0000)]
[X86][LWP] Remove MSVC LWP intrinsics stubs.

Now provided in lwpintrin.h

llvm-svn: 302559

7 years ago[WebAssembly] Fix location and -flavor when running lld
Sam Clegg [Tue, 9 May 2017 17:47:50 +0000 (17:47 +0000)]
[WebAssembly] Fix location and -flavor when running lld

Add the toolchain installation directory to the program
path so that lld can be found.

Change -flavor to wasm.  Although this new flavor hasn't
yet landed in upstream lld yet there are no point in
passing wasm objects the gnu flavor.

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

llvm-svn: 302558

7 years ago[X86][LWP] Removing LWP todo comment. NFCI.
Simon Pilgrim [Tue, 9 May 2017 17:43:16 +0000 (17:43 +0000)]
[X86][LWP] Removing LWP todo comment. NFCI.

LWP / lwpintrin.h is now supported

llvm-svn: 302557

7 years agoBuild the Apple-style stage2 with modules
Adrian Prantl [Tue, 9 May 2017 17:27:03 +0000 (17:27 +0000)]
Build the Apple-style stage2 with modules

Green dragon had a green stage2 modules bot for a long time now[1] and
it is time to retire it and make a modules build the default for
Apple-style stage2 builds.

This patch turns on LLVM_ENABLE_MODULES.

[1] http://green.lab.llvm.org/green/job/clang-stage2-cmake-modulesRDA_build/
rdar://problem/28672159

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

llvm-svn: 302556

7 years agoRevert r302547 ([mips] Impose a threshold for coercion of aggregates)
Petar Jovanovic [Tue, 9 May 2017 17:20:06 +0000 (17:20 +0000)]
Revert r302547 ([mips] Impose a threshold for coercion of aggregates)

Reverting
  Modified MipsABIInfo::classifyArgumentType so that it now coerces
  aggregate structures only if the size of said aggregate is less than 16/64
  bytes, depending on the ABI.
as it broke clang-with-lto-ubuntu builder.

llvm-svn: 302555

7 years ago[RegScavenger] Rangify a loop, NFC
Krzysztof Parzyszek [Tue, 9 May 2017 17:16:52 +0000 (17:16 +0000)]
[RegScavenger] Rangify a loop, NFC

llvm-svn: 302554