platform/upstream/llvm.git
8 years agoSimplify handling of R_PPC64_TOC. NFC.
Rafael Espindola [Wed, 27 Apr 2016 11:54:07 +0000 (11:54 +0000)]
Simplify handling of R_PPC64_TOC. NFC.

llvm-svn: 267698

8 years agoclang-tidy -list-checks should exit with non-zero code when no checks are enabled.
Alexander Kornienko [Wed, 27 Apr 2016 11:45:14 +0000 (11:45 +0000)]
clang-tidy -list-checks should exit with non-zero code when no checks are enabled.

llvm-svn: 267697

8 years ago[Clang][BuiltIn][AVX512] Adding intrinsics without mask for VBROADCAST and VPBROADCAS...
Michael Zuckerman [Wed, 27 Apr 2016 11:43:14 +0000 (11:43 +0000)]
[Clang][BuiltIn][AVX512] Adding intrinsics without mask for VBROADCAST and VPBROADCAST instruction set .

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

llvm-svn: 267696

8 years ago[OPENMP] Fix crash on initialization of classes with no init clause in
Alexey Bataev [Wed, 27 Apr 2016 11:38:05 +0000 (11:38 +0000)]
[OPENMP] Fix crash on initialization of classes with no init clause in
declare reductions.

If reduction clause is applied to instance of class with user-defined
reduction operation without initialization clause, it may cause a crash.
Patch fixes this issue.

llvm-svn: 267695

8 years ago[mips][microMIPS] Add CodeGen support for SUBU16, SUB, SUBU, DSUB and DSUBU instructions
Zlatko Buljan [Wed, 27 Apr 2016 11:31:44 +0000 (11:31 +0000)]
[mips][microMIPS] Add CodeGen support for SUBU16, SUB, SUBU, DSUB and DSUBU instructions
Differential Revision: http://reviews.llvm.org/D16676

llvm-svn: 267694

8 years ago[mips][microMIPS] Add CodeGen support for SLL16, SRL16, SLL, SLLV, SRA, SRAV, SRL...
Zlatko Buljan [Wed, 27 Apr 2016 11:02:23 +0000 (11:02 +0000)]
[mips][microMIPS] Add CodeGen support for SLL16, SRL16, SLL, SLLV, SRA, SRAV, SRL and SRLV instructions
Differential Revision: http://reviews.llvm.org/D17989

llvm-svn: 267693

8 years agoisSafeToLoadUnconditionally support queries without a context
Artur Pilipenko [Wed, 27 Apr 2016 11:00:48 +0000 (11:00 +0000)]
isSafeToLoadUnconditionally support queries without a context

This is required to use this function from isSafeToSpeculativelyExecute

Reviewed By: hfinkel

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

llvm-svn: 267692

8 years ago[modules] Fix Decl's Used invariant.
Vassil Vassilev [Wed, 27 Apr 2016 10:46:06 +0000 (10:46 +0000)]
[modules] Fix Decl's Used invariant.

The Decl::isUsed has a value for every decl. In non-module builds it is very
difficult (but possible) to break this invariant but when we walk up the redecl
chain we find the neccessary information.

When deserializing the decls from a module it is much more difficult to update
correctly this invariant. The patch centralizes the information whether a decl
is used in the canonical decl marking the entire entity as being used.

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

Patch by Cristina Cristescu and me.

Thanks to Richard Smith who helped to debug and understand the issue!

Reviewed by Richard Smith.

llvm-svn: 267691

8 years ago[Clang][BuiltIn][AVX512]Adding intrinsics for vmovntdqa vmovntpd vmovntps instruction set
Michael Zuckerman [Wed, 27 Apr 2016 10:44:15 +0000 (10:44 +0000)]
[Clang][BuiltIn][AVX512]Adding intrinsics for vmovntdqa vmovntpd vmovntps instruction set

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

llvm-svn: 267690

8 years agoUse DL preferred alignment for alloca in Value::getPointerAlignment
Artur Pilipenko [Wed, 27 Apr 2016 10:42:29 +0000 (10:42 +0000)]
Use DL preferred alignment for alloca in Value::getPointerAlignment

Teach Value::getPointerAlignment that allocas with no explicit alignment are aligned to preferred alignment of the allocated type.

Reviewed By: hfinkel

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

llvm-svn: 267689

8 years agoFix compiler warnings in SymbolFilePDBTests
Pavel Labath [Wed, 27 Apr 2016 10:40:52 +0000 (10:40 +0000)]
Fix compiler warnings in SymbolFilePDBTests

llvm-svn: 267688

8 years agoDon't search compilation database in explain-check test.
Haojian Wu [Wed, 27 Apr 2016 10:22:31 +0000 (10:22 +0000)]
Don't search compilation database in explain-check test.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 267687

8 years ago[InstCombine][SSE] Added DemandedBits tests for MOVMSK instructions
Simon Pilgrim [Wed, 27 Apr 2016 09:53:09 +0000 (09:53 +0000)]
[InstCombine][SSE] Added DemandedBits tests for MOVMSK instructions

MOVMSK zeros the upper bits of the gpr - we should be able to use this.

llvm-svn: 267686

8 years agoRemoved dead code. NFC.
George Rimar [Wed, 27 Apr 2016 09:24:03 +0000 (09:24 +0000)]
Removed dead code. NFC.

llvm-svn: 267685

8 years ago[ELF] - Align sections file offsets correctly.
George Rimar [Wed, 27 Apr 2016 09:16:28 +0000 (09:16 +0000)]
[ELF] - Align sections file offsets correctly.

System V ABI 4.1 specifies that program header's p_vaddr should equal p_offset, modulo p_align.
(https://docs.oracle.com/cd/E19683-01/816-1386/chapter6-83432/index.html).
It was possible to violate this using the linkerscript.
Patch fixes the issue.

Differential revision: http://reviews.llvm.org/D19416

llvm-svn: 267684

8 years ago[ClangTidy] Add an 'explain-checks' option to diagnose where each checks comes from.
Haojian Wu [Wed, 27 Apr 2016 09:15:01 +0000 (09:15 +0000)]
[ClangTidy] Add an 'explain-checks' option to diagnose where each checks comes from.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 267683

8 years agotsan: fix windows build
Dmitry Vyukov [Wed, 27 Apr 2016 08:41:31 +0000 (08:41 +0000)]
tsan: fix windows build

warning: '__sanitizer::uptr __sanitizer::GetPreferredBase(const char*)' defined but not used
llvm-svn: 267682

8 years agotsan: fix windows build
Dmitry Vyukov [Wed, 27 Apr 2016 08:39:32 +0000 (08:39 +0000)]
tsan: fix windows build

llvm-svn: 267681

8 years agotsan: add missing file
Dmitry Vyukov [Wed, 27 Apr 2016 08:34:55 +0000 (08:34 +0000)]
tsan: add missing file

llvm-svn: 267680

8 years agotsan: fix compiler warning
Dmitry Vyukov [Wed, 27 Apr 2016 08:28:08 +0000 (08:28 +0000)]
tsan: fix compiler warning

tsan_debugging.cc: In function ‘void* __tsan_get_current_report()’:
tsan_debugging.cc:61:18: warning: cast from type ‘const __tsan::ReportDesc*’
                         to type ‘void*’ casts away qualifiers [-Wcast-qual]
   return (void *)rep;

llvm-svn: 267679

8 years agotsan: split thread into logical and physical state
Dmitry Vyukov [Wed, 27 Apr 2016 08:23:02 +0000 (08:23 +0000)]
tsan: split thread into logical and physical state

This is reincarnation of http://reviews.llvm.org/D17648 with the bug fix pointed out by Adhemerval (zatrazz).

Currently ThreadState holds both logical state (required for race-detection algorithm, user-visible)
and physical state (various caches, most notably malloc cache). Move physical state in a new
Process entity. Besides just being the right thing from abstraction point of view, this solves several
problems:

Cache everything on P level in Go. Currently we cache on a mix of goroutine and OS thread levels.
This unnecessary increases memory consumption.

Properly handle free operations in Go. Frees are issue by GC which don't have goroutine context.
As the result we could not do anything more than just clearing shadow. For example, we leaked
sync objects and heap block descriptors.

This will allow to get rid of libc malloc in Go (now we have Processor context for internal allocator cache).
This in turn will allow to get rid of dependency on libc entirely.

Potentially we can make Processor per-CPU in C++ mode instead of per-thread, which will
reduce resource consumption.
The distinction between Thread and Processor is currently used only by Go, C++ creates Processor per OS thread,
which is equivalent to the current scheme.

llvm-svn: 267678

8 years ago[OPENMP] Fix for codegen of captured variables in inlined directives.
Alexey Bataev [Wed, 27 Apr 2016 07:56:03 +0000 (07:56 +0000)]
[OPENMP] Fix for codegen of captured variables in inlined directives.

Currently there is a problem with codegen of inlined directives inside
lambdas, it may cause a crash during codegen because of incorrect
capturing of variables. Patch fixes this problem.

llvm-svn: 267677

8 years agoUpdated doxygen comments for intrinsics.
Ekaterina Romanova [Wed, 27 Apr 2016 07:14:02 +0000 (07:14 +0000)]
Updated doxygen comments for intrinsics.
(1) Removed \code.. \endcode tags around the instruction name. This matches the doxygen format for all other intrinsics.
(2) Did a better formatting for the comments (to fit into 80 columns more compactly).

llvm-svn: 267676

8 years agoFixed sphinx warning from r267672
Adam Nemet [Wed, 27 Apr 2016 05:59:51 +0000 (05:59 +0000)]
Fixed sphinx warning from r267672

llvm-svn: 267675

8 years ago[Compiler-rt][CFI] Enabling CFI for MIPS64
Mohit K. Bhakkad [Wed, 27 Apr 2016 05:49:42 +0000 (05:49 +0000)]
[Compiler-rt][CFI] Enabling CFI for MIPS64

Reviewers: eugenis

Subscribers: jaydeep, sagar, Sanitizers

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

llvm-svn: 267674

8 years ago[ELF][MIPS] Remove getMipsGpAddr(). NFC
Simon Atanasyan [Wed, 27 Apr 2016 05:31:28 +0000 (05:31 +0000)]
[ELF][MIPS] Remove getMipsGpAddr(). NFC

llvm-svn: 267673

8 years ago[LoopDist] Add llvm.loop.distribute.enable loop metadata
Adam Nemet [Wed, 27 Apr 2016 05:28:18 +0000 (05:28 +0000)]
[LoopDist] Add llvm.loop.distribute.enable loop metadata

Summary:
D19403 adds a new pragma for loop distribution.  This change adds
support for the corresponding metadata that the pragma is translated to
by the FE.

As part of this I had to rethink the flag -enable-loop-distribute.  My
goal was to be backward compatible with the existing behavior:

  A1. pass is off by default from the optimization pipeline
  unless -enable-loop-distribute is specified

  A2. pass is on when invoked directly from opt (e.g. for unit-testing)

The new pragma/metadata overrides these defaults so the new behavior is:

  B1. A1 + enable distribution for individual loop with the pragma/metadata

  B2. A2 + disable distribution for individual loop with the pragma/metadata

The default value whether the pass is on or off comes from the initiator
of the pass.  From the PassManagerBuilder the default is off, from opt
it's on.

I moved -enable-loop-distribute under the pass.  If the flag is
specified it overrides the default from above.

Then the pragma/metadata can further modifies this per loop.

As a side-effect, we can now also use -enable-loop-distribute=0 from opt
to emulate the default from the optimization pipeline.  So to be precise
this is the new behavior:

  C1. pass is off by default from the optimization pipeline
  unless -enable-loop-distribute or the pragma/metadata enables it

  C2. pass is on when invoked directly from opt
  unless -enable-loop-distribute=0 or the pragma/metadata disables it

Reviewers: hfinkel

Subscribers: joker.eph, mzolotukhin, llvm-commits

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

llvm-svn: 267672

8 years ago[Cloning] cloneLoopWithPreheader(): add assert to ensure no sub-loops
Vaivaswatha Nagaraj [Wed, 27 Apr 2016 05:25:09 +0000 (05:25 +0000)]
[Cloning] cloneLoopWithPreheader(): add assert to ensure no sub-loops

Summary:
cloneLoopWithPreheader() does not update LoopInfo for sub-loop of
the original loop being cloned. Add assert to ensure no sub-loops for loop being cloned.

Reviewers: anemet, ashutosh.nema, hfinkel

Subscribers: mzolotukhin, llvm-commits

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

llvm-svn: 267671

8 years ago[Support][X86] Add a few more Intel model numbers to getHostCPUName for airmont and...
Craig Topper [Wed, 27 Apr 2016 05:17:00 +0000 (05:17 +0000)]
[Support][X86] Add a few more Intel model numbers to getHostCPUName for airmont and knl.

llvm-svn: 267670

8 years ago[Support][X86] Change the case values in the Intel family 6 code to hex so its easier...
Craig Topper [Wed, 27 Apr 2016 05:16:58 +0000 (05:16 +0000)]
[Support][X86] Change the case values in the Intel family 6 code to hex so its easier to compare with Intel's docs. NFC

llvm-svn: 267669

8 years agoRevert "Support "preserving" the summary information when using setModule() API in...
Mehdi Amini [Wed, 27 Apr 2016 05:11:44 +0000 (05:11 +0000)]
Revert "Support "preserving" the summary information when using setModule() API in LTOCodeGenerator"

This reverts commit r267665.
ASAN shows that there is a use of undefined value.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 267668

8 years agoCommitting patch from <Michael Woerister <michaelwoerister@posteo.net>
Jason Molenda [Wed, 27 Apr 2016 04:50:51 +0000 (04:50 +0000)]
Committing patch from <Michael Woerister <michaelwoerister@posteo.net>
to use the default clang C/C++ expression parser when debugging
Rust programs.  Ideally there would be a rust language plugin to
support their language natively, but until then this will get simple
variable display to work.

http://reviews.llvm.org/D19545

llvm-svn: 267667

8 years ago[Support][X86] Add a couple more Broadwell CPU models numbers to getHostCPUName.
Craig Topper [Wed, 27 Apr 2016 04:40:03 +0000 (04:40 +0000)]
[Support][X86] Add a couple more Broadwell CPU models numbers to getHostCPUName.

llvm-svn: 267666

8 years agoSupport "preserving" the summary information when using setModule() API in LTOCodeGen...
Mehdi Amini [Wed, 27 Apr 2016 04:24:10 +0000 (04:24 +0000)]
Support "preserving" the summary information when using setModule() API in LTOCodeGenerator

Another attempt at r267655...

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 267665

8 years agoRevert "Support "preserving" the summary information when using setModule() API in...
Mehdi Amini [Wed, 27 Apr 2016 03:34:28 +0000 (03:34 +0000)]
Revert "Support "preserving" the summary information when using setModule() API in LTOCodeGenerator"

This reverts commit r267657, r267656, and r267655.
The test does not pass on multiple bots, I'm unsure why yet but let's unbreak them.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 267664

8 years agoSimplify. NFC.
Rui Ueyama [Wed, 27 Apr 2016 03:04:56 +0000 (03:04 +0000)]
Simplify. NFC.

llvm-svn: 267663

8 years agoThe patch fixes PR27392.
Evgeny Stupachenko [Wed, 27 Apr 2016 03:04:54 +0000 (03:04 +0000)]
The patch fixes PR27392.
Summary:
 It is incorrect to compare TripCount (which is BECount + 1)
  with extraiters (or Count) to check if we should enter unrolled
  loop or not, because TripCount can potentially overflow
  (when BECount is max unsigned integer).
 While comparing BECount with (Count - 1) is overflow safe and
  therefore correct.

Reviewer: hfinkel

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

From: Evgeny Stupachenko <evstupac@gmail.com>
llvm-svn: 267662

8 years ago[LVI] Delete stale and misleading comment.
Philip Reames [Wed, 27 Apr 2016 03:03:15 +0000 (03:03 +0000)]
[LVI] Delete stale and misleading comment.

llvm-svn: 267661

8 years ago[ppc64] fix bug in prologue that mfocrf's cr operand should be explict state instead...
Chuang-Yu Cheng [Wed, 27 Apr 2016 02:59:28 +0000 (02:59 +0000)]
[ppc64] fix bug in prologue that mfocrf's cr operand should be explict state instead of implicit

This fixes PR27414

Reviewers: kbarton mgrang tjablin

http://reviews.llvm.org/D19255

llvm-svn: 267660

8 years agoRemove unnecessary trailing semicolons.
Rui Ueyama [Wed, 27 Apr 2016 02:58:27 +0000 (02:58 +0000)]
Remove unnecessary trailing semicolons.

Since this semicolon existed in an early test file,
it has spread to many files.

llvm-svn: 267659

8 years ago[X86] Set AddPristinesAndCSRs to FixupBW LivePhysRegs. NFC.
Ahmed Bougacha [Wed, 27 Apr 2016 01:51:38 +0000 (01:51 +0000)]
[X86] Set AddPristinesAndCSRs to FixupBW LivePhysRegs. NFC.

We run after PEI, so we need to AddPristinesAndCSRs.
In practice, that makes no difference here, because we only ask about
liveness of super-registers of defined GR8/GR16 registers, so they
can't be pristine. Still, it's the correct thing to do.

Thanks to Quentin for noticing!

Follow-up to r267495.

llvm-svn: 267658

8 years agoFix the test from r267656: Support "preserving" the summary information when using...
Mehdi Amini [Wed, 27 Apr 2016 01:49:11 +0000 (01:49 +0000)]
Fix the test from r267656: Support "preserving" the summary information when using setModule() API in LTOCodeGenerator

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 267657

8 years agoAdd a test for r267655: Support "preserving" the summary information when using setMo...
Mehdi Amini [Wed, 27 Apr 2016 01:47:46 +0000 (01:47 +0000)]
Add a test for r267655: Support "preserving" the summary information when using setModule() API in LTOCodeGenerator

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 267656

8 years agoSupport "preserving" the summary information when using setModule() API in LTOCodeGen...
Mehdi Amini [Wed, 27 Apr 2016 01:46:48 +0000 (01:46 +0000)]
Support "preserving" the summary information when using setModule() API in LTOCodeGenerator

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 267655

8 years agoFix = that should have been == in test. Thanks to STL@microsoft for the catch
Marshall Clow [Wed, 27 Apr 2016 01:46:43 +0000 (01:46 +0000)]
Fix = that should have been == in test. Thanks to STL@microsoft for the catch

llvm-svn: 267654

8 years agoFix typo in comment; NFC
Sanjoy Das [Wed, 27 Apr 2016 01:44:31 +0000 (01:44 +0000)]
Fix typo in comment; NFC

llvm-svn: 267653

8 years ago[X86] Don't assume that MMX extractelts are from index 0.
Ahmed Bougacha [Wed, 27 Apr 2016 01:35:29 +0000 (01:35 +0000)]
[X86] Don't assume that MMX extractelts are from index 0.

It's probably the case for all 3 MMX users out there, but with
hand-crafted IR, you can trigger selection failures. Fix that.

llvm-svn: 267652

8 years ago[X86] Re-enable MMX i32 extractelt combine.
Ahmed Bougacha [Wed, 27 Apr 2016 01:35:25 +0000 (01:35 +0000)]
[X86] Re-enable MMX i32 extractelt combine.

This effectively adds back the extractelt combine removed by r262358:
the direct case can still occur (because x86_mmx is special, see
r262446), but it's the indirect case that's now superseded by the
generic combine.

llvm-svn: 267651

8 years agoDetects the SAD pattern on X86 so that much better code will be emitted once the...
Cong Hou [Wed, 27 Apr 2016 01:29:18 +0000 (01:29 +0000)]
Detects the SAD pattern on X86 so that much better code will be emitted once the pattern is matched.

Differential revision: http://reviews.llvm.org/D14840

llvm-svn: 267649

8 years ago[LVI] Add a comment explaining a subtle piece of code
Philip Reames [Wed, 27 Apr 2016 01:02:25 +0000 (01:02 +0000)]
[LVI] Add a comment explaining a subtle piece of code

Or at least, I didn't understand the implications the first several times I read it it.

llvm-svn: 267648

8 years ago[Docs] Try to clarify the concept of domains for noalias scope
Adam Nemet [Wed, 27 Apr 2016 00:52:48 +0000 (00:52 +0000)]
[Docs] Try to clarify the concept of domains for noalias scope

Summary:
This tries to anchor down the concept of domains a bit better.  I had
trouble initially relating this to anything.  Also talking to David
Majnemer on IRC suggested that I wasn't the only one.

Reviewers: hfinkel

Subscribers: llvm-commits, majnemer

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

llvm-svn: 267647

8 years agoThinLTO: do not promote GlobalVariable that have a specific section.
Mehdi Amini [Wed, 27 Apr 2016 00:32:13 +0000 (00:32 +0000)]
ThinLTO: do not promote GlobalVariable that have a specific section.

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 267646

8 years agoSLSR: Use UnknownAddressSpace instead of 0 for pure arithmetic.
Matt Arsenault [Wed, 27 Apr 2016 00:32:09 +0000 (00:32 +0000)]
SLSR: Use UnknownAddressSpace instead of 0 for pure arithmetic.

In the case where isLegalAddressingMode is used for cases
not related to addressing modes, such as pure adds and muls,
it should not be using address space 0. LSR already passes -1
as the address space in these cases.

llvm-svn: 267645

8 years agoLTOCodeGenerator: turns linkonce(_odr) into weak_(odr) when present "MustPreserve...
Mehdi Amini [Wed, 27 Apr 2016 00:32:02 +0000 (00:32 +0000)]
LTOCodeGenerator: turns linkonce(_odr) into weak_(odr) when present "MustPreserve" set

Summary:
If the linker requested to preserve a linkonce function, we should
honor this even if we drop all uses.

Reviewers: dexonsmith

Subscribers: llvm-commits, joker.eph

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 267644

8 years ago[LoopDist] Split main class. NFC
Adam Nemet [Wed, 27 Apr 2016 00:31:03 +0000 (00:31 +0000)]
[LoopDist] Split main class. NFC

This splits out the per-loop functionality from the Pass class.

With this the fact whether the loop is forced-distribute with the new
metadata/pragma can be cached in the per-loop class rather than passed
around.

llvm-svn: 267643

8 years ago[LVI] Reduce compile time by lazily scanning blocks if needed
Philip Reames [Wed, 27 Apr 2016 00:30:55 +0000 (00:30 +0000)]
[LVI] Reduce compile time by lazily scanning blocks if needed

When encountering a non-local pointer, LVI would eagerly scan the block for dereferences of the given object to prove the pointer to be non null.  That's all well and good, but *then* we'd go recurse through our input blocks.  As a result, we could end up scanning each and every block we traverse, even if the final definition was obviously non null or we found a constant value somewhere up the chain.  The previous code papered over this by using the isKnownNonNull routine from value tracking.  This made the duplication less painful in the common case.

Instead, we know do the block scan only *after* we've gotten the recursive results back.  This lets us stop scanning individual blocks as soon as we've determined it to be non-null in any predecessor block and use our usual merge rules to propagate that information cheaply through successor blocks.  For a pointer which can be found non-null, this does strictly less work and sometimes substaintially so.

Note that the case where we *can't* prove something non-null is still the really expensive case.  We end up scanning each and every block looking for a dereference and never end up finding one.

llvm-svn: 267642

8 years ago[MachineInstrBundle] Actually set the PartialDeadDef flag only when the register
Quentin Colombet [Wed, 27 Apr 2016 00:16:29 +0000 (00:16 +0000)]
[MachineInstrBundle] Actually set the PartialDeadDef flag only when the register
is defined!

The users were checking the proper thing (Defined + PartialDeadDef), but the
information may have been wrong for other use cases, so fix that.

llvm-svn: 267641

8 years agoELF: Merge UndefinedBitcode and UndefinedElf. NFC.
Peter Collingbourne [Wed, 27 Apr 2016 00:05:06 +0000 (00:05 +0000)]
ELF: Merge UndefinedBitcode and UndefinedElf. NFC.

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

llvm-svn: 267640

8 years agoELF: Re-implement -u directly and remove CanKeepUndefined flag.
Peter Collingbourne [Wed, 27 Apr 2016 00:05:03 +0000 (00:05 +0000)]
ELF: Re-implement -u directly and remove CanKeepUndefined flag.

The semantics of the -u flag are to load the lazy symbol named by the flag. We
were previously relying on this behavior falling out of symbol resolution
against a synthetic undefined symbol, but that didn't quite give us the
correct behavior, so we needed a flag to mark symbols created with -u so
we could treat them specially in the writer. However, it's simpler and less
error prone to implement the required behavior directly and remove the flag.

This fixes an issue where symbols loaded with -u would receive hidden
visibility even when the definition in an object file had wider visibility.

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

llvm-svn: 267639

8 years ago[MachineInstrBundle] Update the comment for PhysRegInfo::DeadDef.
Quentin Colombet [Tue, 26 Apr 2016 23:55:41 +0000 (23:55 +0000)]
[MachineInstrBundle] Update the comment for PhysRegInfo::DeadDef.

I missed read the comment when I commited r267621 and thought the
comment did not need update. Matthias kindly proved me wrong.
Fixing that.

llvm-svn: 267638

8 years agoELF: Move code to where it is used, and related cleanups. NFC.
Peter Collingbourne [Tue, 26 Apr 2016 23:52:44 +0000 (23:52 +0000)]
ELF: Move code to where it is used, and related cleanups. NFC.

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

llvm-svn: 267637

8 years agoAdd optimization bisect opt-in calls for SystemZ passes
Andrew Kaylor [Tue, 26 Apr 2016 23:49:41 +0000 (23:49 +0000)]
Add optimization bisect opt-in calls for SystemZ passes

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

llvm-svn: 267636

8 years agoAdd optimization bisect opt-in calls for NVPTX passes
Andrew Kaylor [Tue, 26 Apr 2016 23:44:31 +0000 (23:44 +0000)]
Add optimization bisect opt-in calls for NVPTX passes

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

llvm-svn: 267635

8 years ago[X86] Make sure it is safe to clobber EFLAGS, if need be, when choosing
Quentin Colombet [Tue, 26 Apr 2016 23:44:14 +0000 (23:44 +0000)]
[X86] Make sure it is safe to clobber EFLAGS, if need be, when choosing
the prologue.

Do not use basic blocks that have EFLAGS live-in as prologue if we need
to realign the stack. Realigning the stack uses AND instruction and this
clobbers EFLAGS.

An other alternative would have been to save and restore EFLAGS around
the stack realignment code, but this is likely inefficient.

Fixes PR27531.

llvm-svn: 267634

8 years agoModule debugging: Add an assertion.
Adrian Prantl [Tue, 26 Apr 2016 23:42:43 +0000 (23:42 +0000)]
Module debugging: Add an assertion.

llvm-svn: 267633

8 years agoPR27513: When determining which declaration to put into an exported lookup
Richard Smith [Tue, 26 Apr 2016 23:40:43 +0000 (23:40 +0000)]
PR27513: When determining which declaration to put into an exported lookup
table for a module / PCH, never map from a normal declaration of a class to an
injected-class-name declaration (or vice versa). Those declarations live in
distinct lookup tables and should not be confused.

We really shouldn't be using a CXXRecordDecl to represent an
injected-class-name in the first place; I've filed PR27532 so we don't forget.

llvm-svn: 267632

8 years agoPM: Port Reassociate to the new pass manager
Justin Bogner [Tue, 26 Apr 2016 23:39:29 +0000 (23:39 +0000)]
PM: Port Reassociate to the new pass manager

llvm-svn: 267631

8 years agoModule debugging: Also correctly handle typedef'd foward-declared members.
Adrian Prantl [Tue, 26 Apr 2016 23:37:38 +0000 (23:37 +0000)]
Module debugging: Also correctly handle typedef'd foward-declared members.
Thanks again to Richard Smith for pointing this out.

llvm-svn: 267630

8 years ago[X86] Replace -mcpu with -mattr in several tests
Mitch Bodart [Tue, 26 Apr 2016 23:36:38 +0000 (23:36 +0000)]
[X86] Replace -mcpu with -mattr in several tests
Differential Revision: http://reviews.llvm.org/D19568

llvm-svn: 267629

8 years agoReassociate: Convert another functor into a lambda. NFC
Justin Bogner [Tue, 26 Apr 2016 23:32:00 +0000 (23:32 +0000)]
Reassociate: Convert another functor into a lambda. NFC

Also move the explanatory comment with it.

llvm-svn: 267628

8 years ago[LVI] Cut short search if we know we can't return a useful result
Philip Reames [Tue, 26 Apr 2016 23:27:33 +0000 (23:27 +0000)]
[LVI] Cut short search if we know we can't return a useful result

Previously we were recursing on our operands for unary and binary operators regardless of whether we knew how to reason about the operator in question.  This has the effect of doing a potentially large amount of work, only to throw it away.  By checking whether the operation is one LVI can handle, we can cut short the search and return the (overdefined) answer more quickly.  The quality of the results produced should not change.

llvm-svn: 267626

8 years agoCheck 'r' and 'y specifiers of freebsd_kernel_printf format strings on PS4
Sunil Srivastava [Tue, 26 Apr 2016 23:19:00 +0000 (23:19 +0000)]
Check 'r' and 'y specifiers of freebsd_kernel_printf format strings on PS4

This is an addendum to r229921.

llvm-svn: 267625

8 years ago[SimplifyCFG] propagate branch metadata when creating select
Sanjay Patel [Tue, 26 Apr 2016 23:15:48 +0000 (23:15 +0000)]
[SimplifyCFG] propagate branch metadata when creating select

llvm-svn: 267624

8 years ago[X86] Teach the expansion of copy instructions how to do proper liveness.
Quentin Colombet [Tue, 26 Apr 2016 23:14:32 +0000 (23:14 +0000)]
[X86] Teach the expansion of copy instructions how to do proper liveness.

When the simple analysis provided by MachineBasicBlock::computeRegisterLiveness
fails, fall back on the LivePhysReg utility.

llvm-svn: 267623

8 years ago[MachineBasicBlock] Take advantage of the partially dead information.
Quentin Colombet [Tue, 26 Apr 2016 23:14:29 +0000 (23:14 +0000)]
[MachineBasicBlock] Take advantage of the partially dead information.

Thanks to that information we wouldn't lie on a register being live whereas it
is not.

llvm-svn: 267622

8 years ago[MachineInstrBundle] Improvement the recognition of dead definitions.
Quentin Colombet [Tue, 26 Apr 2016 23:14:24 +0000 (23:14 +0000)]
[MachineInstrBundle] Improvement the recognition of dead definitions.

Now, it is possible to know that partial definitions are dead definitions and
recognize that clobbered registers are also dead.

llvm-svn: 267621

8 years ago[LVI] Apply transfer rule for overdefine inputs for binary operators
Philip Reames [Tue, 26 Apr 2016 23:10:35 +0000 (23:10 +0000)]
[LVI] Apply transfer rule for overdefine inputs for binary operators

As pointed out by John Regehr over in http://reviews.llvm.org/D19485, LVI was being incredibly stupid about applying its transfer rules.  Rather than gathering local facts from the expression itself, it was simply giving up entirely if one of the inputs was overdefined.  This greatly impacts the precision of the overall analysis and makes it far more fragile as well.

This patch builds on 267609 which did the same thing for unary casts.

llvm-svn: 267620

8 years ago[NVPTX] Fix some usages of CodeGenOpt::None.
Jingyue Wu [Tue, 26 Apr 2016 22:59:25 +0000 (22:59 +0000)]
[NVPTX] Fix some usages of CodeGenOpt::None.

NVPTXLowerKernelArgs is required for correctness, so it should not be guarded
by CodeGenOpt::None.

NVPTXPeephole is optimization only, so it should be skipped when
CodeGenOpt::None.

llvm-svn: 267619

8 years ago[LVI] A better fix for the assertion error introduced by 267609
Philip Reames [Tue, 26 Apr 2016 22:52:30 +0000 (22:52 +0000)]
[LVI] A better fix for the assertion error introduced by 267609

Essentially, I was using the wrong size function.  For types which were sized, but not primitive, I wasn't getting a useful size for the operand and failed an assert.  I fixed this, and also added a guard that the input is a sized type.  Test case is for the original mistake.  I'm not sure how to actually exercise the sized type check.

llvm-svn: 267618

8 years ago[LVI] Speculative fix for assertion seen in clang bots
Philip Reames [Tue, 26 Apr 2016 22:31:53 +0000 (22:31 +0000)]
[LVI] Speculative fix for assertion seen in clang bots

I'll clean this up and add a test case shortly.  I want to make sure this does actually fix the bots; if not, I'll revert.

llvm-svn: 267617

8 years agoFix TestRegisterVariables.py on Windows
Adrian McCarthy [Tue, 26 Apr 2016 22:25:40 +0000 (22:25 +0000)]
Fix TestRegisterVariables.py on Windows

Use __attribute__((regparm(x))) to ensure the compiler enregisters at least some arguments when calling functions.

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

llvm-svn: 267616

8 years ago[LowerExpectIntrinsic] make default likely/unlikely ratio bigger
Sanjay Patel [Tue, 26 Apr 2016 22:23:38 +0000 (22:23 +0000)]
[LowerExpectIntrinsic] make default likely/unlikely ratio bigger

We need the default ratio to be sufficiently large that it triggers transforms
based on block frequency info (BFI) and plays well with the recently introduced
BranchProbability used by CGP.

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

llvm-svn: 267615

8 years agoReassociate: Simplify using lambdas. NFC
Justin Bogner [Tue, 26 Apr 2016 22:22:18 +0000 (22:22 +0000)]
Reassociate: Simplify using lambdas. NFC

llvm-svn: 267614

8 years agoReturn R_GOTREL for R_MIPS_GPREL*.
Rafael Espindola [Tue, 26 Apr 2016 22:00:04 +0000 (22:00 +0000)]
Return R_GOTREL for R_MIPS_GPREL*.

This lets Writer.cpp know that they are got relative, which will allow
further simplifications.

llvm-svn: 267613

8 years agoModule debugging: Add testcase for member classes of class template specializations.
Adrian Prantl [Tue, 26 Apr 2016 21:58:23 +0000 (21:58 +0000)]
Module debugging: Add testcase for member classes of class template specializations.

llvm-svn: 267612

8 years agoModule debugging: Use the definition to determine module-defined types.
Adrian Prantl [Tue, 26 Apr 2016 21:58:18 +0000 (21:58 +0000)]
Module debugging: Use the definition to determine module-defined types.

Follow-up to r267464. Thanks to Richard Smith for pointing this out!

llvm-svn: 267611

8 years ago[sanitizers] rewriting test assuming assert() changes coverage.
Mike Aizatsky [Tue, 26 Apr 2016 21:56:14 +0000 (21:56 +0000)]
[sanitizers] rewriting test assuming assert() changes coverage.

Summary:
On windows platform assert() call creates two distinct CFG edges
which are coverage-instrumented. Simply calling assert would
change coverage numbers on the platform.

Subscribers: kubabrecka

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

llvm-svn: 267610

8 years ago[LVI] Infer local facts from unary expressions
Philip Reames [Tue, 26 Apr 2016 21:48:16 +0000 (21:48 +0000)]
[LVI] Infer local facts from unary expressions

As pointed out by John Regehr over in http://reviews.llvm.org/D19485, LVI was being incredibly stupid about applying its transfer rules. Rather than gathering local facts from the expression itself, it was simply giving up entirely if one of the inputs was overdefined. This greatly impacts the precision of the overall analysis and makes it far more fragile as well.

This patch implements only the unary operation case. Once this is in, I'll implement the same for the binary operations.

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

llvm-svn: 267609

8 years agoOptimization bisect support in X86-specific passes
Andrew Kaylor [Tue, 26 Apr 2016 21:44:24 +0000 (21:44 +0000)]
Optimization bisect support in X86-specific passes

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

llvm-svn: 267608

8 years ago[CodeGen] Add getBuildVector and getSplatBuildVector helpers. NFCI.
Ahmed Bougacha [Tue, 26 Apr 2016 21:15:30 +0000 (21:15 +0000)]
[CodeGen] Add getBuildVector and getSplatBuildVector helpers. NFCI.

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

llvm-svn: 267606

8 years agoRevert "[SimplifyLibCalls] sprintf doesn't copy null bytes"
David Majnemer [Tue, 26 Apr 2016 21:04:47 +0000 (21:04 +0000)]
Revert "[SimplifyLibCalls] sprintf doesn't copy null bytes"

The destination buffer that sprintf uses is restrict qualified, we do
not need to worry about derived pointers referenced via format
specifiers.

This reverts commit r267580.

llvm-svn: 267605

8 years agoTest commit
Erik Pilkington [Tue, 26 Apr 2016 20:55:48 +0000 (20:55 +0000)]
Test commit

llvm-svn: 267604

8 years agoCall repl in getSymbolBody. NFC.
Rafael Espindola [Tue, 26 Apr 2016 20:45:31 +0000 (20:45 +0000)]
Call repl in getSymbolBody. NFC.

Every caller was doing it.

llvm-svn: 267603

8 years agoMove utility functions to DriverUtils.cpp.
Rui Ueyama [Tue, 26 Apr 2016 20:41:32 +0000 (20:41 +0000)]
Move utility functions to DriverUtils.cpp.

llvm-svn: 267602

8 years agoTry to get at_file_missing.c passing after LLVM r267556.
Nico Weber [Tue, 26 Apr 2016 20:40:23 +0000 (20:40 +0000)]
Try to get at_file_missing.c passing after LLVM r267556.

r267556 made backslashes escape the next character
unconditionally in rsp files.  This test echos a path into
a rsp file, and paths contain backslashes on Windows. Since
it's not important for this test to get the filename from
the rsp file, just pass it regularly.

llvm-svn: 267601

8 years agoHandle Windows drive letters and ".." for --reproduce.
Rui Ueyama [Tue, 26 Apr 2016 20:36:46 +0000 (20:36 +0000)]
Handle Windows drive letters and ".." for --reproduce.

When --reproduce <path> is given, then we need to concatenate input
file paths to the given path to save input files to the directory.
Previously, path concatenation didn't handle Windows drive letters
so it could generate invalid paths such as "C:\D:\foo". It also didn't
handle ".." path components, so it could produce some bad paths
such as "foo/../../etc/passwd".

In this patch, Windows drive letters and ".." are removed before
concatenating paths.

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

llvm-svn: 267600

8 years agoTry to get ResponseFile.ll passing on Windows after r267556.
Nico Weber [Tue, 26 Apr 2016 20:32:51 +0000 (20:32 +0000)]
Try to get ResponseFile.ll passing on Windows after r267556.

llvm-svn: 267599

8 years agoRemove more unused variables.
Zachary Turner [Tue, 26 Apr 2016 20:32:35 +0000 (20:32 +0000)]
Remove more unused variables.

llvm-svn: 267598

8 years agoMasked Store in Loop Vectorizer - bugfix
Elena Demikhovsky [Tue, 26 Apr 2016 20:18:04 +0000 (20:18 +0000)]
Masked Store in Loop Vectorizer - bugfix

Fixed a bug in loop vectorization with conditional store.

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

llvm-svn: 267597

8 years agoPM: Port Internalize to the new pass manager
Justin Bogner [Tue, 26 Apr 2016 20:15:52 +0000 (20:15 +0000)]
PM: Port Internalize to the new pass manager

llvm-svn: 267596