platform/upstream/llvm.git
7 years ago[ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt [take 2]
Kuba Mracek [Fri, 14 Apr 2017 16:53:25 +0000 (16:53 +0000)]
[ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt [take 2]

CodeGenFunction::EmitObjCForCollectionStmt currently emits lifetime markers for the loop variable in an inconsistent way:  lifetime.start is emitted before the loop is entered, but lifetime.end is emitted inside the loop. AddressSanitizer uses these markers to track out-of-scope accesses to local variables, and we get false positives in Obj-C foreach loops (in the 2nd iteration of the loop). This patch keeps the loop variable alive for the whole loop by extending ForScope and registering the cleanup function inside EmitAutoVarAlloca.

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

llvm-svn: 300340

7 years agoRemove "#if 0"ed out assert
Sanjoy Das [Fri, 14 Apr 2017 16:47:15 +0000 (16:47 +0000)]
Remove "#if 0"ed out assert

It won't compile after the recent changes I've made, and I think
keeping it in provides very little value.

Instead I've added (in an earlier commit) a C++ unit test to check the
Denormalize(Normalized(X)) == X property for specific instances of X,
which is what the assert was trying to do anyway.

llvm-svn: 300339

7 years agoDelete some unnecessary boilerplate
Sanjoy Das [Fri, 14 Apr 2017 16:47:12 +0000 (16:47 +0000)]
Delete some unnecessary boilerplate

The PostIncTransform class was not pulling its weight, so delete it
and use free functions instead.

This also makes the use of `function_ref` more idiomatic.  We were
storing an instance of function_ref in the PostIncTransform class
before, which was fine in that specific case, but the usage after this
change is more obviously okay.

llvm-svn: 300338

7 years ago[RDF] Refine propagation of reached uses in liveness computation
Krzysztof Parzyszek [Fri, 14 Apr 2017 16:33:54 +0000 (16:33 +0000)]
[RDF] Refine propagation of reached uses in liveness computation

llvm-svn: 300337

7 years agoAdd missing #include for STLExtras
Sanjoy Das [Fri, 14 Apr 2017 16:28:12 +0000 (16:28 +0000)]
Add missing #include for STLExtras

Looks like earlier I was relying on #include ordering in files that
used ScalarEvolutionNormalization.h.

Found thanks to the selfhost modules buildbot!

llvm-svn: 300336

7 years ago[Hexagon] Fix a latent problem with interpreting live-in lane masks
Krzysztof Parzyszek [Fri, 14 Apr 2017 16:21:55 +0000 (16:21 +0000)]
[Hexagon] Fix a latent problem with interpreting live-in lane masks

A non-zero lane mask on a register with no subregister means that the
whole register is live-in. It is equivalent to a full mask.

llvm-svn: 300335

7 years agoUse range for
Sanjoy Das [Fri, 14 Apr 2017 15:50:19 +0000 (15:50 +0000)]
Use range for

llvm-svn: 300334

7 years agoSimplify PostIncTransform further; NFC
Sanjoy Das [Fri, 14 Apr 2017 15:50:07 +0000 (15:50 +0000)]
Simplify PostIncTransform further; NFC

Instead of having two ways to check if an add recurrence needs to be
normalized, just pass in one predicate to decide that.

llvm-svn: 300333

7 years agoAdd a unit test for SCEV Normalization
Sanjoy Das [Fri, 14 Apr 2017 15:50:04 +0000 (15:50 +0000)]
Add a unit test for SCEV Normalization

llvm-svn: 300332

7 years agoTighten the API for ScalarEvolutionNormalization
Sanjoy Das [Fri, 14 Apr 2017 15:49:59 +0000 (15:49 +0000)]
Tighten the API for ScalarEvolutionNormalization

llvm-svn: 300331

7 years agoRemove NormalizeAutodetect; NFC
Sanjoy Das [Fri, 14 Apr 2017 15:49:53 +0000 (15:49 +0000)]
Remove NormalizeAutodetect; NFC

It is cleaner to have a callback based system where the logic of
whether an add recurrence is normalized or not lives on IVUsers.

This is one step in a multi-step cleanup.

llvm-svn: 300330

7 years ago[Hexagon] Make a couple of passes compliant with -opt-bisect-limit
Krzysztof Parzyszek [Fri, 14 Apr 2017 15:26:34 +0000 (15:26 +0000)]
[Hexagon] Make a couple of passes compliant with -opt-bisect-limit

llvm-svn: 300329

7 years agoMake Gentoo GNU GCC Config override whitespace tolerant
Erich Keane [Fri, 14 Apr 2017 15:21:18 +0000 (15:21 +0000)]
Make Gentoo GNU GCC Config override whitespace tolerant

The config-*triple* file handling isn't tolerant of
leading/trailing whitespace, making it not terribly
obvious when a single extraneous tab/space/etc will
cause the override to be ignored. This patch simply
trims the lines to ensure that it is tolerant of
whitespace.

llvm-svn: 300328

7 years ago[Bugpoint] Use boolean AND instead of bitwise AND (PR32660)
Simon Pilgrim [Fri, 14 Apr 2017 15:21:15 +0000 (15:21 +0000)]
[Bugpoint] Use boolean AND instead of bitwise AND (PR32660)

llvm-svn: 300327

7 years ago[X86][SSE] Update MOVNTDQA non-temporal loads to generic implementation (clang)
Simon Pilgrim [Fri, 14 Apr 2017 15:05:57 +0000 (15:05 +0000)]
[X86][SSE] Update MOVNTDQA non-temporal loads to generic implementation (clang)

MOVNTDQA non-temporal aligned vector loads can be correctly represented using generic builtin loads, allowing us to remove the existing x86 intrinsics.

LLVM companion patch: D31767.

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

llvm-svn: 300326

7 years ago[X86][SSE] Update MOVNTDQA non-temporal loads to generic implementation (LLVM)
Simon Pilgrim [Fri, 14 Apr 2017 15:05:35 +0000 (15:05 +0000)]
[X86][SSE] Update MOVNTDQA non-temporal loads to generic implementation (LLVM)

MOVNTDQA non-temporal aligned vector loads can be correctly represented using generic builtin loads, allowing us to remove the existing x86 intrinsics.

Clang companion patch: D31766.

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

llvm-svn: 300325

7 years agoSilence -Wlogical-op-parentheses warning NFC
Nirav Dave [Fri, 14 Apr 2017 14:36:45 +0000 (14:36 +0000)]
Silence -Wlogical-op-parentheses warning NFC

llvm-svn: 300324

7 years agoUse isl C++ foreach implementation
Tobias Grosser [Fri, 14 Apr 2017 13:39:40 +0000 (13:39 +0000)]
Use isl C++ foreach implementation

This commit switches Polly over to the isl::obj::foreach_* implementation, which
is part of the new isl bindings and follows the foreach pattern established in
Polly by Michael Kruse.

The original isl C function:

  isl_stat isl_union_set_foreach_set(__isl_keep isl_union_set *uset,
      isl_stat (*fn)(__isl_take isl_set *set, void *user), void *user);

which required the user to define a static callback function to which all
interesting parameters are passed via a 'void *' user-pointer, is on the
C++ side available as a function that takes a std::function<>, which can
carry any additional arguments without the need for a user pointer:

  stat UnionSet::foreach_set(const std::function<stat(set)> &fn) const;

The following code illustrates the use of the new C++ interface:

  auto Lambda = [=, &Result](isl::set Set) -> isl::stat {
    auto Shifted = shiftDimension(Set, Pos, Amount);
    Result = Result.add(Shifted);
    return isl::stat::ok;
  }

  UnionSet.foreach_set(Lambda);

Polly had some specialized foreach functions which did not require the lambdas
to return a status flag. We remove these functions in this commit to move Polly
completely over to the new isl interface. We may in the future discuss if
functors without return values can be supported easily.

Another extension proposed by Michael Kruse is the use of C++ iterators to allow
the use of normal for loops to iterate over these sets. Such an extension would
allow us to further simplify the code.

Reviewed-by: Michael Kruse <llvm@meinersbur.de>
Differential Revision: https://reviews.llvm.org/D30620

llvm-svn: 300323

7 years agoFix missing virtual destructor to silence build warning.
Nirav Dave [Fri, 14 Apr 2017 13:34:33 +0000 (13:34 +0000)]
Fix missing virtual destructor to silence build warning.

llvm-svn: 300322

7 years agoReorder StoreMergeCandidates to run faster. NFCI.
Nirav Dave [Fri, 14 Apr 2017 13:34:30 +0000 (13:34 +0000)]
Reorder StoreMergeCandidates to run faster. NFCI.

llvm-svn: 300321

7 years ago[clang-tidy] Fixes to misc-forwarding-reference-overload check.
Gabor Horvath [Fri, 14 Apr 2017 12:31:36 +0000 (12:31 +0000)]
[clang-tidy] Fixes to misc-forwarding-reference-overload check.

* Style fixes to tests
* Make it work consistently on all platforms

Patch by AndrĂ¡s Leitereg!

llvm-svn: 300320

7 years ago[AMDGPU][MC] Corrected ds_write_src2_* to require one offset instead of two.
Dmitry Preobrazhensky [Fri, 14 Apr 2017 12:28:07 +0000 (12:28 +0000)]
[AMDGPU][MC] Corrected ds_write_src2_* to require one offset instead of two.

Fixed bug 32551: https://bugs.llvm.org//show_bug.cgi?id=32551

Reviewers: vpykhtin

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

llvm-svn: 300319

7 years ago[AMDGPU][MC] Enabled constants for src operands of s_cbranch_g_fork
Dmitry Preobrazhensky [Fri, 14 Apr 2017 11:52:26 +0000 (11:52 +0000)]
[AMDGPU][MC] Enabled constants for src operands of s_cbranch_g_fork

Fixed bug 32619: https://bugs.llvm.org//show_bug.cgi?id=32619

Reviewers: artem.tamazov, vpykhtin

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

llvm-svn: 300318

7 years ago[ELF] - Linkerscript: make section with no content to be SHT_PROGBITS by default.
George Rimar [Fri, 14 Apr 2017 09:37:00 +0000 (09:37 +0000)]
[ELF] - Linkerscript: make section with no content to be SHT_PROGBITS by default.

Imagine next script:

SECTIONS { BYTE(0x11); }

Section content written to disk will be 0x11. Previous LLD behavior was to make this
section SHT_NOBITS. What is not correct because section has content.
ld.bfd makes such sections SHT_PROGBITS, this patch do the same.

This fixes PR32537

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

llvm-svn: 300317

7 years ago[ELF] - Cleanup of align.s testcase. NFC.
George Rimar [Fri, 14 Apr 2017 09:30:50 +0000 (09:30 +0000)]
[ELF] - Cleanup of align.s testcase. NFC.

llvm-svn: 300316

7 years ago[ELF] LinkerScript: Don't assign zero to all regular symbols
George Rimar [Fri, 14 Apr 2017 09:23:26 +0000 (09:23 +0000)]
[ELF] LinkerScript: Don't assign zero to all regular symbols

This fixes an assertion `Align != 0u && "Align can't be 0."'
in llvm::alignTo() when a linker script references a globally
defined variable in an ALIGN() context.

Patch by Alexander Richardson !

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

llvm-svn: 300315

7 years agoFix for PR#30562: Selection DAG error: Detected cycle in SelectionDAG.
Andrew V. Tischenko [Fri, 14 Apr 2017 09:17:09 +0000 (09:17 +0000)]
Fix for PR#30562: Selection DAG error: Detected cycle in SelectionDAG.
Patch by Dinar Temirbulatov

llvm-svn: 300314

7 years agoPR32280: Do not crash on nested initializers.
Vassil Vassilev [Fri, 14 Apr 2017 08:48:08 +0000 (08:48 +0000)]
PR32280: Do not crash on nested initializers.

Patch by Yuka Takahashi (D31591)!

llvm-svn: 300313

7 years agoAdd more test cases for StringRef::edit_distance
Alex Denisov [Fri, 14 Apr 2017 08:34:32 +0000 (08:34 +0000)]
Add more test cases for StringRef::edit_distance

Example strings taken from here: http://www.let.rug.nl/~kleiweg/lev/

llvm-svn: 300312

7 years agoThis patch closes PR#32216: Better testing of schedule model instruction latencies...
Andrew V. Tischenko [Fri, 14 Apr 2017 07:44:23 +0000 (07:44 +0000)]
This patch closes PR#32216: Better testing of schedule model instruction latencies/throughputs.
The details are here: https://reviews.llvm.org/D30941

llvm-svn: 300311

7 years ago[LV] Remove implicit single basic block assumption
Gil Rapaport [Fri, 14 Apr 2017 07:30:23 +0000 (07:30 +0000)]
[LV] Remove implicit single basic block assumption

This patch is part of D28975's breakdown - no change in output intended.

LV's code currently assumes the vectorized loop is a single basic block up
until predicateInstructions() is called. This patch removes two manifestations
of this assumption (loop phi incoming values, dominator tree update) by
replacing the use of vectorLoopBody with the vectorized loop's latch/header.

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

llvm-svn: 300310

7 years ago[ValueTracking] Calculate the KnownZeros for Intrinsic::ctpop without using a tempora...
Craig Topper [Fri, 14 Apr 2017 06:43:34 +0000 (06:43 +0000)]
[ValueTracking] Calculate the KnownZeros for Intrinsic::ctpop without using a temporary APInt to count leading zeros on.

The APInt was created from an 'unsigned' and we just wanted to know how many bits the value needed to represent it. We can just use Log2_32 from MathExtras.h to get the info.

llvm-svn: 300309

7 years ago[ValueTracking] Use APInt::isNegative(). NFC
Craig Topper [Fri, 14 Apr 2017 06:43:32 +0000 (06:43 +0000)]
[ValueTracking] Use APInt::isNegative(). NFC

llvm-svn: 300308

7 years ago[ValueTracking] Use APInt::sext instead of zext and setBitsFrom. NFC
Craig Topper [Fri, 14 Apr 2017 06:43:29 +0000 (06:43 +0000)]
[ValueTracking] Use APInt::sext instead of zext and setBitsFrom. NFC

llvm-svn: 300307

7 years ago[AMDGPU][GFX9] Set +fp32-denormals for >=gfx900 unless -cl-denorms-are-zero is set
Konstantin Zhuravlyov [Fri, 14 Apr 2017 05:33:57 +0000 (05:33 +0000)]
[AMDGPU][GFX9] Set +fp32-denormals for >=gfx900 unless -cl-denorms-are-zero is set

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

llvm-svn: 300306

7 years ago[InstCombine] Use APInt::setSignBit and APInt::isNegative(). NFC
Craig Topper [Fri, 14 Apr 2017 05:09:04 +0000 (05:09 +0000)]
[InstCombine] Use APInt::setSignBit and APInt::isNegative(). NFC

llvm-svn: 300305

7 years agoFix use after free error
Xinliang David Li [Fri, 14 Apr 2017 04:14:29 +0000 (04:14 +0000)]
Fix use after free error

llvm-svn: 300304

7 years agoclang/test/CoverageMapping/unused_names.c: Relax an expression for targeting PECOFF.
NAKAMURA Takumi [Fri, 14 Apr 2017 03:16:48 +0000 (03:16 +0000)]
clang/test/CoverageMapping/unused_names.c: Relax an expression for targeting PECOFF.

llvm-svn: 300303

7 years agoFix test failure on windows: pass module to getInstrProfXXName calls
Xinliang David Li [Fri, 14 Apr 2017 03:03:24 +0000 (03:03 +0000)]
Fix test failure on windows: pass module to getInstrProfXXName calls

llvm-svn: 300302

7 years agoRemove unused function /nfc
Xinliang David Li [Fri, 14 Apr 2017 03:01:25 +0000 (03:01 +0000)]
Remove unused function /nfc

llvm-svn: 300301

7 years agoObject, LTO: Add target triple to irsymtab and LTO API.
Peter Collingbourne [Fri, 14 Apr 2017 02:55:06 +0000 (02:55 +0000)]
Object, LTO: Add target triple to irsymtab and LTO API.

Start using it in LLD to avoid needing to read bitcode again just to get the
target triple, and in llvm-lto2 to avoid printing symbol table information
that is inappropriate for the target.

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

llvm-svn: 300300

7 years agoNewGVN: Don't propagate over phi backedges where undef causes us to
Daniel Berlin [Fri, 14 Apr 2017 02:53:37 +0000 (02:53 +0000)]
NewGVN: Don't propagate over phi backedges where undef causes us to
have >1 value, unless we can prove the phi node is cycle free.

Fixes PR 32607.

llvm-svn: 300299

7 years agoCOFF: Remove some unused fields.
Peter Collingbourne [Fri, 14 Apr 2017 02:34:47 +0000 (02:34 +0000)]
COFF: Remove some unused fields.

llvm-svn: 300298

7 years agoELF: Remove some dead code.
Peter Collingbourne [Fri, 14 Apr 2017 02:34:32 +0000 (02:34 +0000)]
ELF: Remove some dead code.

llvm-svn: 300297

7 years agoRemove empty test directory for nonexistent standard clause.
Richard Smith [Fri, 14 Apr 2017 02:04:44 +0000 (02:04 +0000)]
Remove empty test directory for nonexistent standard clause.

llvm-svn: 300296

7 years ago[docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin
Vedant Kumar [Fri, 14 Apr 2017 01:59:44 +0000 (01:59 +0000)]
[docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin

Printing out stack traces along with UBSan diagnostics is unsupported on
Darwin. That's because it isn't possible to use the fast unwinder or the
slow unwinder.

Apparently, it's inappropriate to use the fast unwinder for UBSan
issues. I'm not exactly sure why (see the comment in ubsan_diag.cc).
Forcing use of the fast unwinder produces decent results, AFAICT.

Darwin also does not appear to have a slow unwinder suitable for use
with the sanitizers. Apparently that's because of PR20800 [1][2]. But
that bug has been fixed. I'm not sure if there is anything preventing
use of the slow unwinder now.

Currently, passing UBSAN_OPTIONS=print_stacktrace=1 does nothing on
Darwin. This isn't good, but it might be a while before we can fix the
situation, so we should at least document it.

[1] https://github.com/google/sanitizers/issues/137
"We can't use the slow unwinder on OSX now, because Clang produces
incorrect unwind info for the ASan runtime functions on OSX
(http://llvm.org/PR20800)."

[2] https://bugs.llvm.org/show_bug.cgi?id=20800
Bug 20800 - Invalid compact unwind info generated for a function without
frame pointers on OSX

llvm-svn: 300295

7 years agoRemove useless local variable.
Rui Ueyama [Fri, 14 Apr 2017 01:35:04 +0000 (01:35 +0000)]
Remove useless local variable.

llvm-svn: 300294

7 years agoReplace uintX_t with uint64_t.
Rui Ueyama [Fri, 14 Apr 2017 01:34:45 +0000 (01:34 +0000)]
Replace uintX_t with uint64_t.

We generally want to use uint64_t instead of uintX_t if the 64-bit
type works for both 32-bit and 64-bit because it is simpler than
the variable-size type.

llvm-svn: 300293

7 years agoUse range-for; NFC
Sanjoy Das [Fri, 14 Apr 2017 01:33:15 +0000 (01:33 +0000)]
Use range-for; NFC

llvm-svn: 300292

7 years agoUse transform instead of manual loop; NFC
Sanjoy Das [Fri, 14 Apr 2017 01:33:13 +0000 (01:33 +0000)]
Use transform instead of manual loop; NFC

llvm-svn: 300291

7 years agoRevert r300287.
Kuba Mracek [Fri, 14 Apr 2017 01:00:03 +0000 (01:00 +0000)]
Revert r300287.

llvm-svn: 300290

7 years agoLLVMCodeGen: Add ProfileData into deps corresponding to r300277.
NAKAMURA Takumi [Fri, 14 Apr 2017 00:36:06 +0000 (00:36 +0000)]
LLVMCodeGen: Add ProfileData into deps corresponding to r300277.

llvm-svn: 300289

7 years ago[AMDGPU] added SIInstrInfo::getAddNoCarry() helper
Stanislav Mekhanoshin [Fri, 14 Apr 2017 00:33:44 +0000 (00:33 +0000)]
[AMDGPU] added SIInstrInfo::getAddNoCarry() helper

Addressed rest of post submit comments from D31993.

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

llvm-svn: 300288

7 years ago[ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt
Kuba Mracek [Fri, 14 Apr 2017 00:32:43 +0000 (00:32 +0000)]
[ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt

CodeGenFunction::EmitObjCForCollectionStmt currently emits lifetime markers for the loop variable in an inconsistent way:  lifetime.start is emitted before the loop is entered, but lifetime.end is emitted inside the loop.  AddressSanitizer uses these markers to track out-of-scope accesses to local variables, and we get false positives in Obj-C foreach loops (in the 2nd iteration of the loop). The markers of the loop variable need to be either both inside the loop (so that we poison and unpoison the variable in each iteration), or both outside. This patch implements the "both inside" approach.

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

llvm-svn: 300287

7 years ago[ORC] Re-enable the Error/Expected unit tests that were disabled in r300177.
Lang Hames [Fri, 14 Apr 2017 00:06:12 +0000 (00:06 +0000)]
[ORC] Re-enable the Error/Expected unit tests that were disabled in r300177.

The tests were failing due to an occasional deadlock in SerializationTraits
for Error: Both serializers and deserializers were protected by a single
mutex and in the unit test (where both ends of the RPC are in the same
process) one side might obtain the mutex, then block waiting for input,
leaving the other side of the connection unable to obtain the mutex to
write the data the first side was waiting for. Splitting the mutex into
two (one for serialization, one for deserialization) appears to have fixed the
issue.

llvm-svn: 300286

7 years agoSimplify some Verifier attribute checks with AttributeSet
Reid Kleckner [Fri, 14 Apr 2017 00:06:06 +0000 (00:06 +0000)]
Simplify some Verifier attribute checks with AttributeSet

Now that we have a type that can represent the attributes on a single
return, function, or parameter, we can pass it around directly rather
than passing around AttributeList and Idx. Removes some more one-based
argument attribute index counting.

NFC

llvm-svn: 300285

7 years agoRemove useless namespaces.
Rui Ueyama [Thu, 13 Apr 2017 23:49:54 +0000 (23:49 +0000)]
Remove useless namespaces.

llvm-svn: 300284

7 years agoFix PR31934: forming refs to functions with enable_if attrs.
George Burgess IV [Thu, 13 Apr 2017 23:47:08 +0000 (23:47 +0000)]
Fix PR31934: forming refs to functions with enable_if attrs.

llvm-svn: 300283

7 years agoMIRLangRef: Add a section on simplifying .mir tests
Matthias Braun [Thu, 13 Apr 2017 23:45:14 +0000 (23:45 +0000)]
MIRLangRef: Add a section on simplifying .mir tests

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

llvm-svn: 300282

7 years agoRename readOutputSectionFiller parseFill.
Rui Ueyama [Thu, 13 Apr 2017 23:40:19 +0000 (23:40 +0000)]
Rename readOutputSectionFiller parseFill.

"read" is used as a prefix for functions that read tokens from input
streams. This function doesn't really read anything, but just parses
a given string as an integer, so rename.

llvm-svn: 300281

7 years agoFix FILL linker script command.
Rui Ueyama [Thu, 13 Apr 2017 23:40:00 +0000 (23:40 +0000)]
Fix FILL linker script command.

FILL command doesn't need a semicolon.
Fixes https://bugs.llvm.org/show_bug.cgi?id=32657

llvm-svn: 300280

7 years ago[Profile] PE binary coverage bug fix
Xinliang David Li [Thu, 13 Apr 2017 23:37:21 +0000 (23:37 +0000)]
[Profile] PE binary coverage bug fix

PR/32584

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

llvm-svn: 300279

7 years ago[Profile] PE binary coverage bug fix
Xinliang David Li [Thu, 13 Apr 2017 23:37:15 +0000 (23:37 +0000)]
[Profile] PE binary coverage bug fix

PR/32584

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

llvm-svn: 300278

7 years ago[Profile] PE binary coverage bug fix
Xinliang David Li [Thu, 13 Apr 2017 23:37:12 +0000 (23:37 +0000)]
[Profile] PE binary coverage bug fix

PR/32584

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

llvm-svn: 300277

7 years ago[AArch64] Avoid partial register writes on lane 0 of BUILD_VECTOR for i8/i16/f16
Adam Nemet [Thu, 13 Apr 2017 23:32:47 +0000 (23:32 +0000)]
[AArch64] Avoid partial register writes on lane 0 of BUILD_VECTOR for i8/i16/f16

This further improves Ahmed's change in rL299482.  See the new comment for the
rationale.

The patch recovers most of the regression for bzip2 after D31965. We're down
to +2.68% from +6.97%.

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

llvm-svn: 300276

7 years agoAMDGPU/GFX9: Do not use v_pack_b32_f16 when packing
Konstantin Zhuravlyov [Thu, 13 Apr 2017 23:17:00 +0000 (23:17 +0000)]
AMDGPU/GFX9: Do not use v_pack_b32_f16 when packing

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

llvm-svn: 300275

7 years agobuild_llvm_package.bat: Move to VS2017
Hans Wennborg [Thu, 13 Apr 2017 23:13:23 +0000 (23:13 +0000)]
build_llvm_package.bat: Move to VS2017

It's required for building the clang-format plugin after r300225.

llvm-svn: 300273

7 years ago[IR] Make getParamAttributes take argument numbers, not ArgNo+1
Reid Kleckner [Thu, 13 Apr 2017 23:12:13 +0000 (23:12 +0000)]
[IR] Make getParamAttributes take argument numbers, not ArgNo+1

Add hasParamAttribute() and use it instead of hasAttribute(ArgNo+1,
Kind) everywhere.

The fact that the AttributeList index for an argument is ArgNo+1 should
be a hidden implementation detail.

NFC

llvm-svn: 300272

7 years ago[docs] Regenerate diagnostics reference.
Richard Smith [Thu, 13 Apr 2017 22:44:22 +0000 (22:44 +0000)]
[docs] Regenerate diagnostics reference.

llvm-svn: 300271

7 years ago[docs] Fix a couple of typos in command line flag help text and regenerate documentation.
Richard Smith [Thu, 13 Apr 2017 22:39:49 +0000 (22:39 +0000)]
[docs] Fix a couple of typos in command line flag help text and regenerate documentation.

llvm-svn: 300270

7 years ago[bpf] Fix memory offset check for loads and stores
Alexei Starovoitov [Thu, 13 Apr 2017 22:24:13 +0000 (22:24 +0000)]
[bpf] Fix memory offset check for loads and stores

If the offset cannot fit into the instruction, an addition to the
pointer is emitted before the actual access. However, BPF offsets are
16-bit but LLVM considers them to be, for the matter of this check,
to be 32-bit long.

This causes the following program:

int bpf_prog1(void *ign)
{

volatile unsigned long t = 0x8983984739ull;
return *(unsigned long *)((0xffffffff8fff0002ull) + t);

}

To generate the following (wrong) code:

0: 18 01 00 00 39 47 98 83 00 00 00 00 89 00 00 00

r1 = 590618314553ll

2: 7b 1a f8 ff 00 00 00 00 *(u64 *)(r10 - 8) = r1
3: 79 a1 f8 ff 00 00 00 00 r1 = *(u64 *)(r10 - 8)
4: 79 10 02 00 00 00 00 00 r0 = *(u64 *)(r1 + 2)
5: 95 00 00 00 00 00 00 00 exit

Fix it by changing the offset check to 16-bit.

Patch by Nadav Amit <nadav.amit@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Differential Revision: https://reviews.llvm.org/D32055

llvm-svn: 300269

7 years agoMIRLangRef: Simplify/update documentation
Matthias Braun [Thu, 13 Apr 2017 22:14:45 +0000 (22:14 +0000)]
MIRLangRef: Simplify/update documentation

- Refer to options by `-option` instead of `option`
- Use `-mtriple=` instead of `-march` in the example (-march will still
  target the default operating system which is usually not what you want
  in a test)
- Rephrase sentence because output does not go to stdout by default (you
  need -o - for that as should be expected).

llvm-svn: 300268

7 years ago[Support] Fix ErrorOr assertion when /proc/cpuinfo doesn't exist.
Teresa Johnson [Thu, 13 Apr 2017 21:51:49 +0000 (21:51 +0000)]
[Support] Fix ErrorOr assertion when /proc/cpuinfo doesn't exist.

The ErrorOr should not be dereferenced on the error path.

Patch by Jacob Young

Reviewers: tejohnson

Subscribers: llvm-commits

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

llvm-svn: 300267

7 years agoAdd test for anonymous struct containing an implicitly private data member.
Richard Smith [Thu, 13 Apr 2017 21:51:04 +0000 (21:51 +0000)]
Add test for anonymous struct containing an implicitly private data member.

Patch by Jacob Young!

llvm-svn: 300266

7 years ago[InstCombine] Use APInt::getBitsSetFrom instead of inverting the result of getLowBits...
Craig Topper [Thu, 13 Apr 2017 21:49:48 +0000 (21:49 +0000)]
[InstCombine] Use APInt::getBitsSetFrom instead of inverting the result of getLowBitsSet. NFC

llvm-svn: 300265

7 years agoDiagnose attempt to take address of bitfield members in anonymous structs.
Richard Smith [Thu, 13 Apr 2017 21:49:46 +0000 (21:49 +0000)]
Diagnose attempt to take address of bitfield members in anonymous structs.

Patch by Jacob Young!

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

llvm-svn: 300264

7 years agoAdd "1" suffix if there's varaible ends with "2".
Rui Ueyama [Thu, 13 Apr 2017 21:37:56 +0000 (21:37 +0000)]
Add "1" suffix if there's varaible ends with "2".

If we knew that we'd add End2, Edata2 and Etext2, we'd name their
original symbols with "1". This patch does it.

llvm-svn: 300263

7 years agoPR32185: Revert r291512 and add a testcase for PR32185.
Richard Smith [Thu, 13 Apr 2017 21:37:24 +0000 (21:37 +0000)]
PR32185: Revert r291512 and add a testcase for PR32185.

This reverts an attempt to check that types match when matching a
dependently-typed non-type template parameter. (This comes up when matching the
parameters of a template template parameter against the parameters of a
template template argument.)

The matching rules here are murky at best. Our behavior after this revert is
definitely wrong for certain C++17 features (for 'auto' template parameter
types within the parameter list of a template template argument in particular),
but our behavior before this revert is wrong for some pre-existing testcases,
so reverting to our prior behavior seems like our best option.

llvm-svn: 300262

7 years ago[libcxx] Direct support for Fuchsia
Petr Hosek [Thu, 13 Apr 2017 21:29:21 +0000 (21:29 +0000)]
[libcxx] Direct support for Fuchsia

Fuchsia's libc was forked from musl, but has evolved sufficiently
since then so it no longer makes sense to pretend it's musl. This
change implements direct support for Fuchsia rather than
piggybacking on musl support.

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

llvm-svn: 300261

7 years ago[CMake][runtimes] Use -nodefaultlibs for the runtimes build
Petr Hosek [Thu, 13 Apr 2017 21:29:03 +0000 (21:29 +0000)]
[CMake][runtimes] Use -nodefaultlibs for the runtimes build

We may not have a working C++ standard library at this point so we
shouldn't rely on it when running CMake checks.

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

llvm-svn: 300260

7 years agoReplace a clever lambda helper with a simpler one.
Rui Ueyama [Thu, 13 Apr 2017 21:23:03 +0000 (21:23 +0000)]
Replace a clever lambda helper with a simpler one.

llvm-svn: 300259

7 years ago[llvm-pdbdump] Recursively dump class layout.
Zachary Turner [Thu, 13 Apr 2017 21:11:00 +0000 (21:11 +0000)]
[llvm-pdbdump] Recursively dump class layout.

llvm-svn: 300258

7 years ago[CMake] Support building Fuchsia toolchain on Darwin
Petr Hosek [Thu, 13 Apr 2017 21:09:42 +0000 (21:09 +0000)]
[CMake] Support building Fuchsia toolchain on Darwin

This is already supported on Linux but on Darwin it requires some
extra flags.

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

llvm-svn: 300257

7 years ago[ValueTracking] Remove duplicate call to computeKnownBits for the operands of Select.
Craig Topper [Thu, 13 Apr 2017 20:39:37 +0000 (20:39 +0000)]
[ValueTracking] Remove duplicate call to computeKnownBits for the operands of Select.

We call it unconditionally on the operands of the select. Then decide if its a min/max and call it on the min/max operands or on the select operands again. Either of those second calls will overwrite the results of the initial call so we can just delete the first call.

llvm-svn: 300256

7 years ago[LCSSA] Efficiently compute blocks dominating at least one exit.
Davide Italiano [Thu, 13 Apr 2017 20:36:59 +0000 (20:36 +0000)]
[LCSSA] Efficiently compute blocks dominating at least one exit.

For LCSSA purposes, loop BBs not dominating any of the exits aren't
interesting, as none of the values defined in these blocks can be
used outside the loop.

The way the code computed this information was by comparing each
BB of the loop with each of the exit blocks and ask the dominator tree
about their dominance relation. This is slow.

A more efficient way, implemented here, is that of starting from the
exit blocks and walking the dom upwards until we hit an header. By
transitivity, all the blocks we encounter in our path dominate an exit.

For the testcase provided in PR31851, this reduces compile time on
`opt -O2` by ~25%, going from 1m47s to 1m22s.

Thanks to Dan/MichaelZ for discussions/suggesting the approach/review.

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

llvm-svn: 300255

7 years agoFix -Wunused-value warning
Reid Kleckner [Thu, 13 Apr 2017 20:32:58 +0000 (20:32 +0000)]
Fix -Wunused-value warning

llvm-svn: 300254

7 years agoRevert accidentally-committed files in r300252.
Richard Smith [Thu, 13 Apr 2017 20:31:21 +0000 (20:31 +0000)]
Revert accidentally-committed files in r300252.

llvm-svn: 300253

7 years agoRemove all allocation and divisions from GreatestCommonDivisor
Richard Smith [Thu, 13 Apr 2017 20:29:59 +0000 (20:29 +0000)]
Remove all allocation and divisions from GreatestCommonDivisor

Switch from Euclid's algorithm to Stein's algorithm for computing GCD. This
avoids the (expensive) APInt division operation in favour of bit operations.
Remove all memory allocation from within the GCD loop by tweaking our `lshr`
implementation so it can operate in-place.

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

llvm-svn: 300252

7 years ago[InstCombine] Fix !prof metadata preservation for invokes
Reid Kleckner [Thu, 13 Apr 2017 20:26:38 +0000 (20:26 +0000)]
[InstCombine] Fix !prof metadata preservation for invokes

Summary:
Bug noticed by inspection.

Extend the test to handle invokes as well as calls, and rewrite it to
not depend on the inliner and other passes.

Also simplify the call site replacement code with CallSite, similar to
what I did to dead arg elimination and arg promotion (rL300235 and
rL300229).

Reviewers: danielcdh, davidxl

Subscribers: llvm-commits

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

llvm-svn: 300251

7 years ago[msan] Fix msan_test.cc by checking bind results before assuming IPv6 supported.
Vitaly Buka [Thu, 13 Apr 2017 20:25:24 +0000 (20:25 +0000)]
[msan] Fix msan_test.cc by checking bind results before assuming IPv6 supported.

llvm-svn: 300250

7 years agoRevert "[msan] Fix msan_test broken after r299884."
Vitaly Buka [Thu, 13 Apr 2017 20:25:20 +0000 (20:25 +0000)]
Revert "[msan] Fix msan_test broken after r299884."

This does not fix the test, it still fails to bind.

This reverts commit r300150.

llvm-svn: 300249

7 years agoDisable use of tls scanning on darwin leak sanitizer
Francis Ricci [Thu, 13 Apr 2017 20:14:15 +0000 (20:14 +0000)]
Disable use of tls scanning on darwin leak sanitizer

Summary:
These checks appear linux-specific, disable them on darwin, at
least for now.

Reviewers: kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300248

7 years agoMove Linux-specific lsan tests into a new directory
Francis Ricci [Thu, 13 Apr 2017 20:13:53 +0000 (20:13 +0000)]
Move Linux-specific lsan tests into a new directory

Summary:
These tests aren't supported on other platforms, move them
to their own directory.

Reviewers: kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300247

7 years ago[libc++] Add _LIBCPP_DISABLE_EXTERN_TEMPLATE config option
Shoaib Meenai [Thu, 13 Apr 2017 20:13:32 +0000 (20:13 +0000)]
[libc++] Add _LIBCPP_DISABLE_EXTERN_TEMPLATE config option

When the libc++ extern template macros were added, the intent was for it
to be possible for consumers of the headers to disable extern templates
(via `-D_LIBCPP_EXTERN_TEMPLATE(...)=`). Unfortunately, support for
specifying function-like macros varies on the command line varies across
compilers (e.g. MSVC doesn't support it at all), and cmake doesn't allow
it for the same reason. Add a non-function macro for this purpose.

The intended use is for libraries which want to use the libc++ headers
without taking a dependency on the libc++ library itself. I can name the
macro something which reflects its intent rather than its behavior (e.g.
`_LIBCPP_HEADER_ONLY`) if desired.

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

llvm-svn: 300246

7 years agoclang-format-vs licence.txt: drop svn:executable
Hans Wennborg [Thu, 13 Apr 2017 20:09:18 +0000 (20:09 +0000)]
clang-format-vs licence.txt: drop svn:executable

Not sure how it ended up with that property in the first place.

llvm-svn: 300245

7 years ago[LCSSA] Assert that we always have a valid loop.
Davide Italiano [Thu, 13 Apr 2017 20:05:37 +0000 (20:05 +0000)]
[LCSSA] Assert that we always have a valid loop.

We could otherwise add BBs not belonging to a loop in `formLCSSA`
and later crash when trying to iterate the loop blocks.

llvm-svn: 300244

7 years ago[LCSSA] Remove spurious whitespaces. NFCI.
Davide Italiano [Thu, 13 Apr 2017 20:02:27 +0000 (20:02 +0000)]
[LCSSA] Remove spurious whitespaces. NFCI.

llvm-svn: 300243

7 years ago[LCSSA] Use `auto` when the type is obvious. NFCI.
Davide Italiano [Thu, 13 Apr 2017 20:01:30 +0000 (20:01 +0000)]
[LCSSA] Use `auto` when the type is obvious. NFCI.

llvm-svn: 300242

7 years ago[DAG] Fold away temporary vector in store candidate merge NFC.
Nirav Dave [Thu, 13 Apr 2017 20:00:27 +0000 (20:00 +0000)]
[DAG] Fold away temporary vector in store candidate merge NFC.

llvm-svn: 300241

7 years agoSamplePGO: convert callsite samples map key from callsite_location to callsite_locati...
Dehao Chen [Thu, 13 Apr 2017 19:52:10 +0000 (19:52 +0000)]
SamplePGO: convert callsite samples map key from callsite_location to callsite_location+callee_name

Summary: For iterative SamplePGO, an indirect call can be speculatively promoted to multiple direct calls and get inlined. All these promoted direct calls will share the same callsite location (offset+discriminator). With the current implementation, we cannot distinguish between different promotion candidates and its inlined instance. This patch adds callee_name to the key of the callsite sample map. And added helper functions to get all inlined callee samples for a given callsite location. This helps the profile annotator promote correct targets and inline it before annotation, and ensures all indirect call targets to be annotated correctly.

Reviewers: davidxl, dnovillo

Reviewed By: davidxl

Subscribers: andreadb, llvm-commits

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

llvm-svn: 300240