platform/upstream/llvm.git
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

7 years ago[ValueTracking] Prevent a call to computeKnownBits if we already know the state of...
Craig Topper [Thu, 13 Apr 2017 19:04:45 +0000 (19:04 +0000)]
[ValueTracking] Prevent a call to computeKnownBits if we already know the state of the bit we would calculate. Also reuse a temporary APInt instead of creating a new one.

llvm-svn: 300239

7 years ago[LV] Fix the vector code generation for first order recurrence
Anna Thomas [Thu, 13 Apr 2017 18:59:25 +0000 (18:59 +0000)]
[LV] Fix the vector code generation for first order recurrence

Summary:
In first order recurrences where phi's are used outside the loop,
we should generate an additional vector.extract of the second last element from
the vectorized phi update.
This is because we require the phi itself (which is the value at the second last
iteration of the vector loop) and not the phi's update within the loop.
Also fix the code gen when we just unroll, but don't vectorize.
Fixes PR32396.

Reviewers: mssimpso, mkuper, anemet

Subscribers: llvm-commits, mzolotukhin

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

llvm-svn: 300238

7 years agoRevert "Enable LSan on PowerPC64."
Alex Shlyapnikov [Thu, 13 Apr 2017 18:49:29 +0000 (18:49 +0000)]
Revert "Enable LSan on PowerPC64."

This reverts commit r300204. Breaks ASAN tests on PPC.

llvm-svn: 300237

7 years ago[InstCombine] fold X == 0 || X == -1 to one compare (PR32524)
Sanjay Patel [Thu, 13 Apr 2017 18:47:06 +0000 (18:47 +0000)]
[InstCombine] fold X == 0 || X == -1 to one compare (PR32524)

This is effectively a retry of:
https://reviews.llvm.org/rL299851
but now we have tests and an assert to make sure the bug
that was exposed with that attempt will not happen again.

I'll fix the code duplication and missing sibling fold next,
but I want to make this change as small as possible to reduce
risk since I messed it up last time.

This should fix:
https://bugs.llvm.org/show_bug.cgi?id=32524

llvm-svn: 300236

7 years ago[DAE] Simplify call site replacement code with CallSite NFC
Reid Kleckner [Thu, 13 Apr 2017 18:42:03 +0000 (18:42 +0000)]
[DAE] Simplify call site replacement code with CallSite NFC

llvm-svn: 300235

7 years agoImplement global pointer scanning for darwin leak sanitizer
Francis Ricci [Thu, 13 Apr 2017 18:40:19 +0000 (18:40 +0000)]
Implement global pointer scanning for darwin leak sanitizer

Reviewers: kubamracek, kcc, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300234

7 years ago[ValueTracking] Move a temporary APInt instead of copying it.
Craig Topper [Thu, 13 Apr 2017 18:25:53 +0000 (18:25 +0000)]
[ValueTracking] Move a temporary APInt instead of copying it.

llvm-svn: 300233

7 years agoRemove the binders from C++17. Reviewed as https://reviews.llvm.org/D31769
Marshall Clow [Thu, 13 Apr 2017 18:25:32 +0000 (18:25 +0000)]
Remove the binders from C++17. Reviewed as https://reviews.llvm.org/D31769

llvm-svn: 300232

7 years agoFollow-up to r300225: update ClangFormat.csproj too
Hans Wennborg [Thu, 13 Apr 2017 18:15:00 +0000 (18:15 +0000)]
Follow-up to r300225: update ClangFormat.csproj too

llvm-svn: 300231

7 years ago[InstCombine] Simplify attribute code with new AttributeList::get NFC
Reid Kleckner [Thu, 13 Apr 2017 18:11:03 +0000 (18:11 +0000)]
[InstCombine] Simplify attribute code with new AttributeList::get NFC

llvm-svn: 300230

7 years ago[ArgPromotion] Don't drop !prof metadata on promoted calls
Reid Kleckner [Thu, 13 Apr 2017 18:10:30 +0000 (18:10 +0000)]
[ArgPromotion] Don't drop !prof metadata on promoted calls

Noticed by inspection while doing attribute work. DAE, InstCombineCalls,
and ArgPromotion have a fair amount of duplicated code for hacking on
call sites, and you can find bugs by comparing them.

Add a test case for this.

llvm-svn: 300229

7 years agoAdd a test for __block variables + asan.
Adrian Prantl [Thu, 13 Apr 2017 18:06:59 +0000 (18:06 +0000)]
Add a test for __block variables + asan.

llvm-svn: 300228

7 years ago[AMDGPU] Combine DS operations with offsets bigger than byte
Stanislav Mekhanoshin [Thu, 13 Apr 2017 17:53:07 +0000 (17:53 +0000)]
[AMDGPU] Combine DS operations with offsets bigger than byte

In many cases ds operations can be combined even if offsets do not
fit into 8 bit encoding. What it takes is to adjust base address.

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

llvm-svn: 300227

7 years agoFollow-up to r300225: update ClangFormat.sln to VS2017
Hans Wennborg [Thu, 13 Apr 2017 17:47:47 +0000 (17:47 +0000)]
Follow-up to r300225: update ClangFormat.sln to VS2017

This got lost in the previous patch somehow.

llvm-svn: 300226

7 years agoWarning-free clang-format plugin install for VS 15.0
Hans Wennborg [Thu, 13 Apr 2017 17:42:45 +0000 (17:42 +0000)]
Warning-free clang-format plugin install for VS 15.0

With the new release of VS, it's required that all plugins migrate to
the new VSIX manifest format. The new format is backwards compatible
with all versions newer that Visual Studio 2012, so this migration
effectively drops support for older versions of the IDE.

It's also required that these new extensions are built with Visual
Studio 2017, so unfortunately it was necessary to migrate the project
and solution. Also removed COM references to EnvDTE and
Microsoft.VisualStudio.TextManager.Interop from the csproj, as they seem
to both be unnecessary and would trigger build warnings because of
changes to GAC.

Patch by Hugo Puhlmann!

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

llvm-svn: 300225

7 years ago[APSInt] Remove named And/Or/Xor methods.
Craig Topper [Thu, 13 Apr 2017 17:39:46 +0000 (17:39 +0000)]
[APSInt] Remove named And/Or/Xor methods.

No one uses them and I may improve the operator&, operator|, and operator^ to better reuse memory allocations like APInt.

llvm-svn: 300224

7 years agoclang-format-vs: Use a separate license.txt copy
Hans Wennborg [Thu, 13 Apr 2017 17:37:17 +0000 (17:37 +0000)]
clang-format-vs: Use a separate license.txt copy

The regular file used to display very poorly in the VSIX installer due
to long lines, wrapping etc.

llvm-svn: 300223

7 years ago[InstCombine] use similar ops for related folds; NFCI
Sanjay Patel [Thu, 13 Apr 2017 17:36:24 +0000 (17:36 +0000)]
[InstCombine] use similar ops for related folds; NFCI

It's less efficient to produce 'ule' than 'ult' since we know we're going to
canonicalize to 'ult', but we shouldn't have duplicated code for these folds.

As a trade-off, this was a pretty terrible way to make a '2'. :)
       if (LHSC == SubOne(RHSC))
         AddC = ConstantExpr::getSub(AddOne(RHSC), LHSC);

The next steps are to share the code to fix PR32524 and add the missing 'and'
fold that was left out when PR14708 was fixed:
https://bugs.llvm.org/show_bug.cgi?id=14708

llvm-svn: 300222

7 years agoDon't assume PTHREAD_CREATE_JOINABLE is 0 on all systems
Francis Ricci [Thu, 13 Apr 2017 17:28:52 +0000 (17:28 +0000)]
Don't assume PTHREAD_CREATE_JOINABLE is 0 on all systems

Summary:
Lsan was using PTHREAD_CREATE_JOINABLE/PTHREAD_CREATE_DETACHED
as truthy values, which works on Linux, where the values are 0 and 1,
but this fails on OS X, where the values are 1 and 2.

Set PTHREAD_CREATE_DETACHED to the correct value for a given system.

Reviewers: kcc, glider, kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300221

7 years agoKMP_HW_SUBSET extended with NUMA support when HWLOC enabled
Andrey Churbanov [Thu, 13 Apr 2017 17:15:07 +0000 (17:15 +0000)]
KMP_HW_SUBSET extended with NUMA support when HWLOC enabled

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

llvm-svn: 300220

7 years ago[APInt] Fix the returns description for the postfix increment/decrement operators...
Craig Topper [Thu, 13 Apr 2017 17:12:00 +0000 (17:12 +0000)]
[APInt] Fix the returns description for the postfix increment/decrement operators. NFC

llvm-svn: 300219

7 years agoImplement LWG#2855 - made easy by previous refactoring
Marshall Clow [Thu, 13 Apr 2017 16:57:42 +0000 (16:57 +0000)]
Implement LWG#2855 - made easy by previous refactoring

llvm-svn: 300218

7 years agoRevert r300213 "[APSInt] Add a static_assert to ensure APSInt is packed well with...
Craig Topper [Thu, 13 Apr 2017 16:54:25 +0000 (16:54 +0000)]
Revert r300213 "[APSInt] Add a static_assert to ensure APSInt is packed well with APInt after r300171"

MSVC doesn't pack derived classes the same way clang/gcc do.

llvm-svn: 300217

7 years agoCache size per class size in SizeClassAllocatorXLocalCache.
Alex Shlyapnikov [Thu, 13 Apr 2017 16:49:16 +0000 (16:49 +0000)]
Cache size per class size in SizeClassAllocatorXLocalCache.

Summary:
Allocator::ClassIdToSize() is not free and calling it in every
Allocate/Deallocate has noticeable impact on perf.
Reapplying D31991 with the appropriate fixes.

Reviewers: cryptoad

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 300216

7 years ago[Analysis] Support bitreverse in -demanded-bits pass
Brian Gesiak [Thu, 13 Apr 2017 16:44:25 +0000 (16:44 +0000)]
[Analysis] Support bitreverse in -demanded-bits pass

Summary:
* Add a bitreverse case in the demanded bits analysis pass.
* Add tests for the bitreverse (and bswap) intrinsic in the
  demanded bits pass.
* Add a test case to the BDCE tests: that manipulations to
  high-order bits are eliminated once the bits are reversed
  and then right-shifted.

Reviewers: mkuper, jmolloy, hfinkel, trentxintong

Reviewed By: jmolloy

Subscribers: llvm-commits

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

llvm-svn: 300215

7 years agoUse the clang-cl recognized spelling of --target=
Reid Kleckner [Thu, 13 Apr 2017 16:36:28 +0000 (16:36 +0000)]
Use the clang-cl recognized spelling of --target=

This fixes a warning. The test was passing without this change.

llvm-svn: 300214

7 years ago[APSInt] Add a static_assert to ensure APSInt is packed well with APInt after r300171.
Craig Topper [Thu, 13 Apr 2017 16:34:49 +0000 (16:34 +0000)]
[APSInt] Add a static_assert to ensure APSInt is packed well with APInt after r300171.

llvm-svn: 300213

7 years ago[DeLICM] Introduce unittesting infrastructure for Known and Written. NFC.
Michael Kruse [Thu, 13 Apr 2017 16:32:46 +0000 (16:32 +0000)]
[DeLICM] Introduce unittesting infrastructure for Known and Written. NFC.

llvm-svn: 300212

7 years ago[DeLICM] Export Known and Written to DeLICMTests. NFC.
Michael Kruse [Thu, 13 Apr 2017 16:32:39 +0000 (16:32 +0000)]
[DeLICM] Export Known and Written to DeLICMTests. NFC.

This will allow unittesting of new functionality based on
Known and Written.

llvm-svn: 300211

7 years ago[DeLICM] Add Knowledge::Known. NFC.
Michael Kruse [Thu, 13 Apr 2017 16:32:31 +0000 (16:32 +0000)]
[DeLICM] Add Knowledge::Known. NFC.

This field will later contain a ValInst that is known to be stored
in an occupied array element.

llvm-svn: 300210

7 years agoRe-land "[clang-cl] Make all sanitizer flags available in clang-cl"
Reid Kleckner [Thu, 13 Apr 2017 16:32:26 +0000 (16:32 +0000)]
Re-land "[clang-cl] Make all sanitizer flags available in clang-cl"

Adding RUN lines with %clang_cl was causing these tests to fail on Mac
because absolute paths there tend to start with "/User/", which is
recognized as the "/U" flag.

Re-lands r300122

llvm-svn: 300209

7 years ago[DeLICM] Make Knowledge::Written an isl::union_map. NFC.
Michael Kruse [Thu, 13 Apr 2017 16:32:25 +0000 (16:32 +0000)]
[DeLICM] Make Knowledge::Written an isl::union_map. NFC.

The map will later point to a ValInst that is written.

llvm-svn: 300208

7 years ago[DeLICM] Rename Knowledge to KnowledgeStr. NFC.
Michael Kruse [Thu, 13 Apr 2017 16:32:16 +0000 (16:32 +0000)]
[DeLICM] Rename Knowledge to KnowledgeStr. NFC.

Some debuggers get confused by different class of the same name
defined independently in different translation units.

llvm-svn: 300207

7 years ago[libc++] Explicitly set output directory for DLL
Shoaib Meenai [Thu, 13 Apr 2017 16:27:38 +0000 (16:27 +0000)]
[libc++] Explicitly set output directory for DLL

DLLs on Windows are treated as runtime targets. Explicitly set the
output directory for them, to be consistent with other platforms.

llvm-svn: 300206

7 years agoLTO: Pass SF_Executable flag through to InputFile::Symbol
Tobias Edler von Koch [Thu, 13 Apr 2017 16:24:14 +0000 (16:24 +0000)]
LTO: Pass SF_Executable flag through to InputFile::Symbol

Summary:
The linker needs to be able to determine whether a symbol is text or data to
handle the case of a common being overridden by a strong definition in an
archive. If the archive contains a text member of the same name as the common,
that function is discarded. However, if the archive contains a data member of
the same name, that strong definition overrides the common. This is a behavior
of ld.bfd, which the Qualcomm linker also supports in LTO.

Here's a test case to illustrate:

####

cat > 1.c << \!
int blah;
!

cat > 2.c << \!
int blah() {
  return 0;
}
!

cat > 3.c << \!
int blah = 20;
!

clang -c 1.c
clang -c 2.c
clang -c 3.c

ar cr lib.a 2.o 3.o
ld 1.o lib.a -t

####

The correct output is:

1.o
(lib.a)3.o

Thanks to Shankar Easwaran and Hemant Kulkarni for the test case!

Reviewers: mehdi_amini, rafael, pcc, davide

Reviewed By: pcc

Subscribers: davide, llvm-commits, inglorion

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

llvm-svn: 300205

7 years agoEnable LSan on PowerPC64.
Alex Shlyapnikov [Thu, 13 Apr 2017 16:17:32 +0000 (16:17 +0000)]
Enable LSan on PowerPC64.

Summary:
With D31555 commited, looks like basic LSan functionality
works on PPC64. Time to enable LSan there.

Reviewers: eugenis

Subscribers: nemanjai, llvm-commits

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

llvm-svn: 300204

7 years ago[Hexagon] Unxfail passing tests
Krzysztof Parzyszek [Thu, 13 Apr 2017 16:05:35 +0000 (16:05 +0000)]
[Hexagon] Unxfail passing tests

r300198 fixed a problem that caused two tests to be xfailed. Unxfail
these tests now, since they are passing.

llvm-svn: 300203

7 years ago[InstCombine] fix assert to not always be true
Sanjay Patel [Thu, 13 Apr 2017 16:05:01 +0000 (16:05 +0000)]
[InstCombine] fix assert to not always be true

llvm-svn: 300202

7 years ago[InstCombine] add/move tests for or-of-icmps; NFC
Sanjay Patel [Thu, 13 Apr 2017 15:46:39 +0000 (15:46 +0000)]
[InstCombine] add/move tests for or-of-icmps; NFC

If we had these tests, the bug caused by https://reviews.llvm.org/rL299851 would have been caught sooner.
There's also an assert in the code that should have caught that bug, but the assert line itself has a bug.

llvm-svn: 300201

7 years agoRe-apply "[GVNHoist] Move GVNHoist to function simplification part of pipeline."
Geoff Berry [Thu, 13 Apr 2017 15:36:25 +0000 (15:36 +0000)]
Re-apply "[GVNHoist] Move GVNHoist to function simplification part of pipeline."

This reverts commit r296872 now that PR32153 has been fixed.

llvm-svn: 300200

7 years ago[Hexagon] Implement HexagonTargetLowering::CanLowerReturn
Krzysztof Parzyszek [Thu, 13 Apr 2017 15:05:51 +0000 (15:05 +0000)]
[Hexagon] Implement HexagonTargetLowering::CanLowerReturn

Patch by Michael Wu.

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

llvm-svn: 300199

7 years ago[Hexagon] Fix "LowerFormalArguments emitted a value with the wrong type!" assertion
Krzysztof Parzyszek [Thu, 13 Apr 2017 15:00:18 +0000 (15:00 +0000)]
[Hexagon] Fix "LowerFormalArguments emitted a value with the wrong type!" assertion

Patch by Michael Wu.

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

llvm-svn: 300198

7 years agoRefactor throw_with_nested. NFC.
Marshall Clow [Thu, 13 Apr 2017 14:41:45 +0000 (14:41 +0000)]
Refactor throw_with_nested. NFC.

llvm-svn: 300197

7 years agoUse methods to access data stored with frame instructions
Serge Pavlov [Thu, 13 Apr 2017 14:10:52 +0000 (14:10 +0000)]
Use methods to access data stored with frame instructions

Instructions CALLSEQ_START..CALLSEQ_END and their target dependent
counterparts keep data like frame size, stack adjustment etc. These
data are accessed by getOperand using hard coded indices. It is
error prone way. This change implements the access by special methods,
which improve readability and allow changing data representation without
massive changes of index values.

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

llvm-svn: 300196

7 years agoFree zone name when destroying malloc zone
Francis Ricci [Thu, 13 Apr 2017 14:00:24 +0000 (14:00 +0000)]
Free zone name when destroying malloc zone

Summary:
The darwin interceptor for malloc_destroy_zone manually frees the
zone struct, but does not free the name component. Make sure to
free the name if it has been set.

Reviewers: kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300195

7 years ago[lsan] Reenable lsan tests on ARM bots
Maxim Ostapenko [Thu, 13 Apr 2017 12:00:56 +0000 (12:00 +0000)]
[lsan] Reenable lsan tests on ARM bots

This patch addresses pr32636. Enable lsan tests on ARM bots filtering out Thumb targets.
Tested locally on ARM Arndale board in two configurations:

1) CFLAGS="-march=armv7-a"
Testing Time: 37.57s
Expected Passes    : 69
Unsupported Tests  : 7

2) CFLAGS="-march=armv7-a -mthumb"
Testing Time: 0.16s
Unsupported Tests  : 76

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

llvm-svn: 300194

7 years agollvm/test/BugPoint/compile-custom.ll: Use %/s for its path not to be mis-escaped.
NAKAMURA Takumi [Thu, 13 Apr 2017 11:40:32 +0000 (11:40 +0000)]
llvm/test/BugPoint/compile-custom.ll: Use %/s for its path not to be mis-escaped.

llvm-svn: 300193

7 years ago[ELF] Tidy up handleARMTlsRelocation [NFC]
Peter Smith [Thu, 13 Apr 2017 10:56:40 +0000 (10:56 +0000)]
[ELF] Tidy up handleARMTlsRelocation [NFC]

Replace addModuleReloc with AddTlsReloc so that we can use it for both the
module relocation and the offset relocation.

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

llvm-svn: 300192

7 years agoAdd TEST_NOEXCEPT_FALSE to support D31738
Eric Fiselier [Thu, 13 Apr 2017 10:17:23 +0000 (10:17 +0000)]
Add TEST_NOEXCEPT_FALSE to support D31738

llvm-svn: 300191

7 years ago[X86] Added missing mayLoad/mayStore attributes to some X86 instructions.
Ayman Musa [Thu, 13 Apr 2017 10:03:45 +0000 (10:03 +0000)]
[X86] Added missing mayLoad/mayStore attributes to some X86 instructions.

Throughout the effort of automatically generating the X86 memory folding tables these missing information were encountered.
This is a preparation work for a future patch including the automation of these tables.

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

llvm-svn: 300190

7 years ago[analyzer] Enforce super-region classes for various memory regions.
Artem Dergachev [Thu, 13 Apr 2017 09:56:07 +0000 (09:56 +0000)]
[analyzer] Enforce super-region classes for various memory regions.

We now check the type of the super-region pointer for most SubRegion classes
in compile time; some checks are run-time though.

This is an API-breaking change (we now require explicit casts to specific region
sub-classes), but in practice very few checkers are affected.

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

llvm-svn: 300189

7 years ago[DWARF] - Simplify (use dyn_cast instead of isa + cast).
George Rimar [Thu, 13 Apr 2017 09:52:50 +0000 (09:52 +0000)]
[DWARF] - Simplify (use dyn_cast instead of isa + cast).

This addresses post commit review comments for r300039.

llvm-svn: 300188

7 years ago[analyzer] Add numerous assertions to SVal, SymExpr, and MemRegion classes.
Artem Dergachev [Thu, 13 Apr 2017 09:48:05 +0000 (09:48 +0000)]
[analyzer] Add numerous assertions to SVal, SymExpr, and MemRegion classes.

Clean up vtable anchors (remove anchors for regions that have regular
out-of-line virtual methods, add anchors for regions that don't have those).

Fix private/public methods (all constructors should now be private for leaf
classes, protected for abstract classes).

No functional change intended, only extra sanity checks and cleanups.

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

llvm-svn: 300187

7 years ago[globalisel][tablegen] Report more detail in some SelectionDAG import failures. NFC
Daniel Sanders [Thu, 13 Apr 2017 09:45:37 +0000 (09:45 +0000)]
[globalisel][tablegen] Report more detail in some SelectionDAG import failures. NFC

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

Reviewed By: ab

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

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

llvm-svn: 300186

7 years agoReverting cmake/modules/AddLLVM.cmake changes from revision 300184 (Added by mistake).
Ayman Musa [Thu, 13 Apr 2017 09:26:49 +0000 (09:26 +0000)]
Reverting cmake/modules/AddLLVM.cmake changes from revision 300184 (Added by mistake).

llvm-svn: 300185

7 years ago[X86] Change instructions names to keep consistency with the naming convention. NFC
Ayman Musa [Thu, 13 Apr 2017 09:12:32 +0000 (09:12 +0000)]
[X86] Change instructions names to keep consistency with the naming convention. NFC

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

llvm-svn: 300184

7 years ago[LV] Refactor ILV to provide vectorizeInstruction(); NFC
Ayal Zaks [Thu, 13 Apr 2017 09:07:23 +0000 (09:07 +0000)]
[LV] Refactor ILV to provide vectorizeInstruction(); NFC

Refactoring InnerLoopVectorizer's vectorizeBlockInLoop() to provide
vectorizeInstruction(). Aligning DeadInstructions with its only user.
Facilitates driving the transformation by VPlan - follows
https://reviews.llvm.org/D28975 and its tentative breakdown.

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

llvm-svn: 300183

7 years ago[ELF] Mark ARM Exceptions that refer to folded code as not live
Peter Smith [Thu, 13 Apr 2017 08:52:58 +0000 (08:52 +0000)]
[ELF] Mark ARM Exceptions that refer to folded code as not live

ARM Exception Index Table sections .ARM.exidx have an implicit dependency
on code sections via SHF_LINK_ORDER. When code sections are folded by ICF
we must mark the unique .ARM.exidx table that describes it as not live
to prevent an illegal entry in the exception table.

Note that we do not try and follow the relocations from the .ARM.exidx
section to the .ARM.extab sections to mark these as not live. Leaving
these sections is not a correctness problem. In theory these could be
removed via an application of garbage collection.

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

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

llvm-svn: 300182

7 years agoRevert "[clang-cl] Make all sanitizer flags available in clang-cl"
Akira Hatanaka [Thu, 13 Apr 2017 08:02:29 +0000 (08:02 +0000)]
Revert "[clang-cl] Make all sanitizer flags available in clang-cl"

This reverts commit 47979b20b475664013d19382fc6875b5b9f3ed9d.

This was causing a couple of bots to fail.

http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/30152

llvm-svn: 300181

7 years agoRevert "Cache size per class size in SizeClassAllocatorXLocalCache."
Diana Picus [Thu, 13 Apr 2017 07:39:04 +0000 (07:39 +0000)]
Revert "Cache size per class size in SizeClassAllocatorXLocalCache."

This reverts commit r300107 because it broke the ARM and AArch64
buildbots.

llvm-svn: 300180

7 years agoFix typo in static_assert message. NFC
Craig Topper [Thu, 13 Apr 2017 07:31:52 +0000 (07:31 +0000)]
Fix typo in static_assert message. NFC

llvm-svn: 300179

7 years ago[analyzer] Simplify values in binary operations a bit more aggressively.
Artem Dergachev [Thu, 13 Apr 2017 07:20:04 +0000 (07:20 +0000)]
[analyzer] Simplify values in binary operations a bit more aggressively.

SValBuilder tries to constant-fold symbols in the left-hand side of the symbolic
expression whenever it fails to evaluate the expression directly. However, it
only constant-folds them when they are atomic expressions, not when they are
complicated expressions themselves. This patch adds recursive constant-folding
to the left-hand side subexpression (there's a lack of symmetry because we're
trying to have symbols on the left and constants on the right). As an example,
we'd now be able to handle operations similar to "$x + 1 < $y", when $x is
constrained to a constant.

rdar://problem/31354676

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

llvm-svn: 300178

7 years ago[ORC] Temporarily disable the RPC Error/Expected unit tests while I investigate
Lang Hames [Thu, 13 Apr 2017 06:20:45 +0000 (06:20 +0000)]
[ORC] Temporarily disable the RPC Error/Expected unit tests while I investigate
bot failures.

llvm-svn: 300177

7 years agoAdd comments for the RELRO segment.
Rui Ueyama [Thu, 13 Apr 2017 05:40:07 +0000 (05:40 +0000)]
Add comments for the RELRO segment.

RELRO is a feature to make segments read-only after dynamic relocations
are applied. It is different from read-only segments because RELRO is
initially writable. And of course RELRO is different from writable
segments.

RELRO is not a very well known feature. We have a series of checks to
make a decision whether a section should be in a RELRO segment or not,
but we didn't describe why. This patch adds comments to explain how
that decision is made.

llvm-svn: 300176

7 years agoCleanup any_cast failure test
Eric Fiselier [Thu, 13 Apr 2017 05:27:55 +0000 (05:27 +0000)]
Cleanup any_cast failure test

llvm-svn: 300175

7 years ago[Orc] Fix bool serialization for RawByteChannels.
Lang Hames [Thu, 13 Apr 2017 05:23:50 +0000 (05:23 +0000)]
[Orc] Fix bool serialization for RawByteChannels.

The bool type may be larger than the char type, so assuming we can cast from
bool to char and write a byte out to the stream is unsafe.

Hopefully this will get RPCUtilsTest.ReturnExpectedFailure passing on the bots.

llvm-svn: 300174

7 years ago[ORC] Remove more extraneous semicolons from r300167, rename the RPC Expected
Lang Hames [Thu, 13 Apr 2017 05:05:26 +0000 (05:05 +0000)]
[ORC] Remove more extraneous semicolons from r300167, rename the RPC Expected
tests to be consistent with the Error tests.

llvm-svn: 300173

7 years agoRemove more lies from the LangRef.
George Burgess IV [Thu, 13 Apr 2017 05:00:31 +0000 (05:00 +0000)]
Remove more lies from the LangRef.

Same change as in r300168, but for invoke instead of call.

llvm-svn: 300172

7 years ago[APInt] Reorder fields to avoid a hole in the middle of the class
Craig Topper [Thu, 13 Apr 2017 04:59:11 +0000 (04:59 +0000)]
[APInt] Reorder fields to avoid a hole in the middle of the class

Summary:
APInt is currently implemented with an unsigned BitWidth field first and then a uint_64/pointer union. Due to the 64-bit size of the union there is a hole after the bitwidth.

Putting the union first allows the class to be packed. Making it 12 bytes instead of 16 bytes. An APSInt goes from 20 bytes to 16 bytes.

This shows a 4k reduction on the size of the opt binary on my local x86-64 build. So this enables some other improvement to the code as well.

Reviewers: dblaikie, RKSimon, hans, davide

Reviewed By: davide

Subscribers: davide, llvm-commits

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

llvm-svn: 300171

7 years ago[ORC] Remove extraneous semi-colon added in r300167.
Lang Hames [Thu, 13 Apr 2017 04:49:00 +0000 (04:49 +0000)]
[ORC] Remove extraneous semi-colon added in r300167.

llvm-svn: 300170

7 years ago[APInt] Generalize the implementation of tcIncrement to support adding a full 'word...
Craig Topper [Thu, 13 Apr 2017 04:36:06 +0000 (04:36 +0000)]
[APInt] Generalize the implementation of tcIncrement to support adding a full 'word' by introducing tcAddPart. Use this to support tcIncrement, operator++ and operator+=(uint64_t). Do the same for subtract. NFCI.

llvm-svn: 300169

7 years agoUpdate the LangRef to reflect reality.
George Burgess IV [Thu, 13 Apr 2017 04:01:55 +0000 (04:01 +0000)]
Update the LangRef to reflect reality.

At the very least, we have CallInst::setIsNoInline() for adding the
noinline attribute to callsites, and I'm told alwaysinline seems to
work.

Thought of adding "not all attributes are guaranteed to work here". If
someone thinks that would be better (or has a better way of phrasing
that, etc.), happy to add it.

llvm-svn: 300168

7 years ago[ORC] Add RPC and serialization support for Errors and Expecteds.
Lang Hames [Thu, 13 Apr 2017 03:51:35 +0000 (03:51 +0000)]
[ORC] Add RPC and serialization support for Errors and Expecteds.

This patch allows Error and Expected types to be passed to and returned from
RPC functions.

Serializers and deserializers for custom error types (types deriving from the
ErrorInfo class template) can be registered with the SerializationTraits for
a given channel type (see registerStringError in RPCSerialization.h for an
example), allowing a given custom type to be sent/received. Unregistered types
will be serialized/deserialized as StringErrors using the custom type's log
message as the error string.

llvm-svn: 300167

7 years agoFix template >> within C++03 code
Eric Fiselier [Thu, 13 Apr 2017 02:56:03 +0000 (02:56 +0000)]
Fix template >> within C++03 code

llvm-svn: 300165

7 years agoDiagnose when reverse_iterator is used on path::iterator.
Eric Fiselier [Thu, 13 Apr 2017 02:54:13 +0000 (02:54 +0000)]
Diagnose when reverse_iterator is used on path::iterator.

path::iterator isn't a strictly conforming iterator. Specifically
it stashes the current element inside the iterator. This leads to
UB when used with reverse_iterator since it requires the element
to outlive the lifetime of the iterator.

This patch adds a static_assert inside reverse_iterator to disallow
"stashing iterator types", and it tags path::iterator as such a type.

Additionally this patch removes all uses of reverse_iterator<path::iterator>
within the tests.

llvm-svn: 300164

7 years agoRemove some unused private fields.
Zachary Turner [Thu, 13 Apr 2017 02:28:17 +0000 (02:28 +0000)]
Remove some unused private fields.

llvm-svn: 300163

7 years agoDon't use uuid_clear(), non-darwin platforms include
Jason Molenda [Thu, 13 Apr 2017 02:12:32 +0000 (02:12 +0000)]
Don't use uuid_clear(), non-darwin platforms include
Utility/UuidCompatibility.h which gets you a definiton
of uuid_t but none of the functions that operate on it.

llvm-svn: 300162

7 years ago[InstCombine] Add vector version of a test to show missing optimization.
Craig Topper [Thu, 13 Apr 2017 01:31:40 +0000 (01:31 +0000)]
[InstCombine] Add vector version of a test to show missing optimization.

llvm-svn: 300161

7 years agoSupport: Add a VCSRevision.h header file.
Peter Collingbourne [Thu, 13 Apr 2017 01:26:12 +0000 (01:26 +0000)]
Support: Add a VCSRevision.h header file.

This is a magic header file supported by the build system that provides a
single definition, LLVM_REVISION, containing an LLVM revision identifier,
if available. This functionality previously lived in the LTO library, but
I am moving it out to lib/Support because I want to also start using it in
lib/Object to create the IR symbol table.

This change also fixes a bug where LLVM_REVISION was never actually being
used in lib/LTO because the macro HAS_LLVM_REVISION was never defined (it
was misspelled as HAVE_SVN_VERSION_INC in lib/LTO/CMakeLists.txt, and was
only being defined in a non-existent file Version.cpp).

I also changed the code to use "git rev-parse --git-dir" to locate the .git
directory, instead of looking for it in the LLVM source root directory,
which makes this compatible with monorepos as well as git worktrees.

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

llvm-svn: 300160

7 years agoFix C++03 test failures
Eric Fiselier [Thu, 13 Apr 2017 01:13:58 +0000 (01:13 +0000)]
Fix C++03 test failures

llvm-svn: 300159

7 years agoAdd tests that std::unique_ptr's default constructor is constexpr.
Eric Fiselier [Thu, 13 Apr 2017 01:11:58 +0000 (01:11 +0000)]
Add tests that std::unique_ptr's default constructor is constexpr.

std::unique_ptr's default constructor must be constexpr in order
to allow constant initialization to take place for static objects;
Even though we can never have a constexpr unique_ptr variable since
it's not a literal type.

This patch adds tests that constant initialization takes place by
using the __attribute__((require_constant_initialization)) macro.

llvm-svn: 300158

7 years ago[ORC] Add missing file from r300155.
Lang Hames [Thu, 13 Apr 2017 01:06:45 +0000 (01:06 +0000)]
[ORC] Add missing file from r300155.

llvm-svn: 300157

7 years agoUpdate tests -verify error messages after r300140.
Eric Fiselier [Thu, 13 Apr 2017 01:03:41 +0000 (01:03 +0000)]
Update tests -verify error messages after r300140.

llvm-svn: 300156

7 years ago[ORC] Use native Errors rather than converted std::error_codes for ORC RPC.
Lang Hames [Thu, 13 Apr 2017 01:03:06 +0000 (01:03 +0000)]
[ORC] Use native Errors rather than converted std::error_codes for ORC RPC.

llvm-svn: 300155

7 years agoFix more bad member swap definitions in unordered_map.
Eric Fiselier [Thu, 13 Apr 2017 01:02:41 +0000 (01:02 +0000)]
Fix more bad member swap definitions in unordered_map.

The __unordered_map_equal and __unordered_map_hash wrappers
attempt to swap const qualified predicates whenever the predicate
is empty, and is subject to the EBO.

Swapping const values seems blatently incorrect. This patch removes
the const qualifier so the values are swapped as non-const.

llvm-svn: 300154

7 years ago[IR] Take func, ret, and arg attrs separately in AttributeList::get
Reid Kleckner [Thu, 13 Apr 2017 00:58:09 +0000 (00:58 +0000)]
[IR] Take func, ret, and arg attrs separately in AttributeList::get

This seems like a much more natural API, based on Derek Schuff's
comments on r300015. It further hides the implementation detail of
AttributeList that function attributes come last and appear at index
~0U, which is easy for the user to screw up. git diff says it saves code
as well: 97 insertions(+), 137 deletions(-)

This also makes it easier to change the implementation, which I want to
do next.

llvm-svn: 300153

7 years agoFix the default constructibility of __compressed_pair.
Eric Fiselier [Thu, 13 Apr 2017 00:50:45 +0000 (00:50 +0000)]
Fix the default constructibility of __compressed_pair.

This patch fixes a bug where the =default default ctor for
__compressed_pair was incorrect for const qualified types.

llvm-svn: 300152

7 years agoFix broken test. We can't assume that 2MB of args is enough to require a response...
Richard Smith [Thu, 13 Apr 2017 00:46:50 +0000 (00:46 +0000)]
Fix broken test. We can't assume that 2MB of args is enough to require a response file.

This test has apparently been broken for years, but we never noticed before
because it's a long test and long tests approximately never get run.

llvm-svn: 300151

7 years ago[msan] Fix msan_test broken after r299884.
Vitaly Buka [Thu, 13 Apr 2017 00:36:03 +0000 (00:36 +0000)]
[msan] Fix msan_test broken after r299884.

Bind to ANY as some machines may have IPv6 support but without IPv6 on loopback
interface.

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 300150

7 years ago[msan] Fix invalid use of vector constructor introduced by r299884.
Vitaly Buka [Thu, 13 Apr 2017 00:36:02 +0000 (00:36 +0000)]
[msan] Fix invalid use of vector constructor introduced by r299884.

llvm-svn: 300149

7 years agoFix most failures caused by r300140
Eric Fiselier [Thu, 13 Apr 2017 00:34:24 +0000 (00:34 +0000)]
Fix most failures caused by r300140

r300140 introduced a bunch of failures by changing the internal
interface provided by __compressed_pair. This patch fixes all of
the failures caused by the new interface by changing the existing
code to use it.

In addition to those changes this patch also fixes two separate
issues causing test failures:

1) Fix the member swap definition for __map_value_compare. Previously
   the swap was incorrectly configured to swap the comparator as const.

2) Fix an assertion failure in futures.task.members/ctor_func_alloc.pass.cpp
that incorrectly expected a move to take place when a single copy is sufficient.

There is one remaining failure regarding make_shared. I'll commit a fix for that
shortly.

llvm-svn: 300148

7 years agoDo not initialize this->SoName with this->DefaultSoName.
Rui Ueyama [Thu, 13 Apr 2017 00:23:32 +0000 (00:23 +0000)]
Do not initialize this->SoName with this->DefaultSoName.

This patch uses DefaultSoName in getSoName instead of in parseSoName.
I think this is more readable. This patch also add comments.

llvm-svn: 300147

7 years ago[IR] Remove the APIntMoveTy typedef from ConstantRange. Use APInt type directly.
Craig Topper [Thu, 13 Apr 2017 00:20:31 +0000 (00:20 +0000)]
[IR] Remove the APIntMoveTy typedef from ConstantRange. Use APInt type directly.

This typedef used to be conditional based on whether rvalue references were supported. Looks like it got left behind when we switched to always having rvalue references with c++11. I don't think it provides any value now.

llvm-svn: 300146

7 years agoExternalASTMerger.cpp: Silence another warning. [-Wunused-lambda-capture]
NAKAMURA Takumi [Thu, 13 Apr 2017 00:17:28 +0000 (00:17 +0000)]
ExternalASTMerger.cpp: Silence another warning. [-Wunused-lambda-capture]

llvm-svn: 300145

7 years agoWork around MSVC rejects-valid bug related to C++11 narrowing conversions.
Richard Smith [Thu, 13 Apr 2017 00:14:39 +0000 (00:14 +0000)]
Work around MSVC rejects-valid bug related to C++11 narrowing conversions.

llvm-svn: 300144

7 years agoFix compiler error in Attributes.cpp
Konstantin Zhuravlyov [Wed, 12 Apr 2017 23:57:37 +0000 (23:57 +0000)]
Fix compiler error in Attributes.cpp
```
Compiling Attributes.cpp ...
../../../Attributes.cpp: In member function 'std::__1::pair<unsigned int, llvm::Optional<unsigned int> > llvm::AttributeSet::getAllocSizeArgs() const':
../../../Attributes.cpp:542:69: error: operands to ?: have different types 'std::__1::pair<unsigned int, llvm::Optional<unsigned int> >' and 'std::__1::pair<int, int>'
   return SetNode ? SetNode->getAllocSizeArgs() : std::make_pair(0, 0);
                                                                     ^
../../../Attributes.cpp:543:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
```

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

llvm-svn: 300143

7 years agoAMDGPU : Fix common dominator of two incoming blocks terminates with uniform branch...
Wei Ding [Wed, 12 Apr 2017 23:51:47 +0000 (23:51 +0000)]
AMDGPU : Fix common dominator of two incoming blocks terminates with uniform branch issue.

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

llvm-svn: 300142

7 years agoUpdate to match LLVM r300135.
Richard Smith [Wed, 12 Apr 2017 23:51:20 +0000 (23:51 +0000)]
Update to match LLVM r300135.

llvm-svn: 300141

7 years ago[libcxx] Fix __compressed_pair so it doesn't copy the argument multiple times, and...
Eric Fiselier [Wed, 12 Apr 2017 23:45:53 +0000 (23:45 +0000)]
[libcxx] Fix __compressed_pair so it doesn't copy the argument multiple times, and add constexpr.

Summary:
__compressed_pair takes and passes it's constructor arguments by value. This causes arguments to be moved 3 times instead of once. This patch addresses that issue and fixes `constexpr` on the constructors.

I would rather have this fix than D27564, and I'm fairly confident it's not ABI breaking but I'm not 100% sure.

I prefer this solution because it removes a lot of code and makes the implementation *much* smaller.

Reviewers: mclow.lists, K-ballo

Reviewed By: K-ballo

Subscribers: K-ballo, cfe-commits

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

llvm-svn: 300140