LLVM/llvm 311078clang-tools-extra/trunk/clang-tidy/modernize MakeSmartPtrCheck.cpp MakeSmartPtrCheck.h, clang-tools-extra/trunk/test/clang-tidy modernize-make-unique.cpp

[clang-tidy] Don't generate fixes for initializer_list constructor in make_unique check.

Summary:
The current fix will break the compilation -- because braced list is not
deducible in std::make_unique (with the use of forwarding) without
specifying the type explicitly.

We could support it in the future.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

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

LLVM/llvm 311077llvm/trunk/lib/Transforms/Vectorize LoopVectorize.cpp VPlan.h, llvm/trunk/test/Transforms/LoopVectorize if-pred-non-void.ll

[LV] Using VPlan to model the vectorized code and drive its transformation

VPlan is an ongoing effort to refactor and extend the Loop Vectorizer. This
patch introduces the VPlan model into LV and uses it to represent the vectorized
code and drive the generation of vectorized IR.

In this patch VPlan models the vectorized loop body: the vectorized control-flow
is represented using VPlan's Hierarchical CFG, with predication refactored from
being a post-vectorization-step into a vectorization planning step modeling
if-then VPRegionBlocks, and generating code inline with non-predicated code. The
vectorized code within each VPBasicBlock is represented as a sequence of
Recipes, each responsible for modelling and generating a sequence of IR
instructions. To keep the size of this commit manageable the Recipes in this
patch are coarse-grained and capture large chunks of LV's code-generation logic.
The constructed VPlans are dumped in dot format under -debug.

This commit retains current vectorizer output, except for minor instruction
reorderings; see associated modifications to lit tests.

For further details on the VPlan model see docs/Proposals/VectorizationPlan.rst
and its references.

Authors: Gil Rapaport and Ayal Zaks

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

LLVM/llvm 311076llvm/trunk/lib/Target/AArch64 AArch64InstructionSelector.cpp, llvm/trunk/test/CodeGen/AArch64/GlobalISel select-bitcast.mir

Re-commit: [globalisel][tablegen] Support zero-instruction emission.

Summary:
Support the case where an operand of a pattern is also the whole of the
result pattern. In this case the original result and all its uses must be
replaced by the operand. However, register class restrictions can require
a COPY. This patch handles both cases by always emitting the copy and
leaving it for the register allocator to optimize.

The previous commit failed on Windows machines due to a flaw in the sort
predicate which allowed both A < B < C and B == C to be satisfied
simultaneously. The cause of this was some sloppiness in the priority order of
G_CONSTANT instructions compared to other instructions. These had equal priority
because it makes no difference, however there were operands had higher priority
than G_CONSTANT but lower priority than any other instruction. As a result, a
priority order between G_CONSTANT and other instructions must be enforced to
ensure the predicate defines a strict weak order.

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

Subscribers: javed.absar, kristof.beyls, igorb, llvm-commits

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

LLVM/llvm 311075llvm/trunk/lib/Target/SystemZ SystemZHazardRecognizer.h

[SystemZ]  Also wrap TII with #ifndef NDEBUG in constructor initilizer list.

TII needs to be wrapped with #ifndef NDEBUG to silece compiler warnings.

LLVM/llvm 311074llvm/trunk/lib/Target/SystemZ SystemZHazardRecognizer.h

[SystemZ]  Add a wrapping with #ifndef NDEBUG to silence warning.

SystemZHazardRecognizer::TII is only used for debug output, so it needs
also to be wrapped with #ifndef NDEBUG.

LLVM/llvm 311073lld/trunk/ELF LinkerScript.cpp, lld/trunk/test/ELF/linkerscript memory-err.s

[ELF] - Don't segfault when accessing location counter inside MEMORY command.

We would previously crash on next script:
MEMORY { name : ORIGIN = .; }

Patch fixes that.

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

LLVM/llvm 311072llvm/trunk/include/llvm/CodeGen MachineScheduler.h, llvm/trunk/lib/CodeGen MachineScheduler.cpp

[SystemZ, MachineScheduler]  Improve post-RA scheduling.

The idea of this patch is to continue the scheduler state over an MBB boundary
in the case where the successor block has only one predecessor. This means
that the scheduler will continue in the successor block (after emitting any
branch instructions) with e.g. maintained processor resource counters.
Benchmarks have been confirmed to benefit from this.

The algorithm in MachineScheduler.cpp that extracts scheduling regions of an
MBB has been extended so that the strategy may optionally reverse the order
of processing the regions themselves. This is controlled by a new method
doMBBSchedRegionsTopDown(), which defaults to false.

Handling the top-most region of an MBB first also means that a top-down
scheduler can continue the scheduler state across any scheduling boundary
between to regions inside MBB.

Review: Ulrich Weigand, Matthias Braun, Andy Trick.
https://reviews.llvm.org/D35053

LLVM/llvm 311071llvm/trunk/lib/CodeGen/SelectionDAG LegalizeVectorTypes.cpp LegalizeTypes.h, llvm/trunk/test/CodeGen/X86 pr34177.ll

[SelectionDAG] Teach the vector-types operand scalarizer about SETCC

When v1i1 is legal (e.g. AVX512) the legalizer can reach
a case where a v1i1 SETCC with an illgeal vector type operand
wasn't scalarized (since v1i1 is legal) but its operands does
have to be scalarized. This used to assert because SETCC was
missing from the vector operand scalarizer.

This patch attemps to teach the legalizer to handle these cases
by scalazring the operands, converting the node into a scalar
SETCC node.

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

LLVM/llvm 311070cfe/trunk/lib/AST ExprConstant.cpp

Fix undefined behavior that is caused by not always initializing a bool.

The fix in r310994 is incomplete, as moveFromAndCancel can set the
pointer without initializing OldIsSpeculativelyEvaluating.

LLVM/llvm 311069llvm/trunk/lib/ToolDrivers/llvm-dlltool DlltoolDriver.cpp

[llvm-dlltool] Improve an error message when unable to open files. NFC.

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

LLVM/llvm 311068llvm/trunk/lib/ToolDrivers/llvm-dlltool DlltoolDriver.cpp

[llvm-dlltool] Don't crash if no def file is provided or it can't be opened

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

LLVM/llvm 311067llvm/trunk/lib/CodeGen CodeGenPrepare.cpp, llvm/trunk/test/Transforms/CodeGenPrepare statepoint-relocate.ll

[CGP] Fix the rematerialization of gc.relocates

If we want to substitute the relocation of derived pointer with gep of base then
we must ensure that relocation of base dominates the relocation of derived pointer.

Currently only check for basic block is present. However it is possible that both
relocation are in the same basic block but relocation of derived pointer is defined
earlier.

The patch moves the relocation of base pointer right before relocation of derived
pointer in this case.

Reviewers: sanjoy,artagnon,igor-laevsky,reames
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36462

LLVM/llvm 311066polly/trunk/include/polly LinkAllPasses.h, polly/trunk/lib CMakeLists.txt

Add rewrite by-reference parameter pass

Summary:
This pass detangles induction variables from functions, which take variables by
reference. Most fortran functions compiled with gfortran pass variables by
reference. Unfortunately a common pattern, printf calls of induction variables,
prevent in this situation the promotion of the induction variable to a register,
which again inhibits any kind of loop analysis. To work around this issue
we developed a specialized pass which introduces separate alloca slots for
known-read-only references, which indicate the mem2reg pass that the induction
variables can be promoted to registers and consquently enable SCEV to work.

We currently hardcode the information that a function
_gfortran_transfer_integer_write does not read its second parameter, as
dragonegg does not add the right annotations and we cannot change old dragonegg
releases. Hopefully flang will produce the right annotations.

Reviewers: Meinersbur, bollu, singam-sanjay

Reviewed By: bollu

Subscribers: mgorny, pollydev, llvm-commits

Tags: #polly

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

LLVM/llvm 311065cfe/trunk/lib/CodeGen CGExprConstant.cpp

Further refactoring of the constant emitter.  NFC.

LLVM/llvm 311064llvm/branches/release_50/docs ReleaseNotes.rst

Add external project LDC to release notes.

LDC, the LLVM-based D compiler, is already ready for LLVM 5.0.

LLVM/llvm 311063cfe/trunk/lib/StaticAnalyzer/Checkers RetainCountChecker.cpp, cfe/trunk/test/Analysis retain-release-inline.m

[analyzer] Add support for reference counting of parameters on the callee side

This commit adds the functionality of performing reference counting on the
callee side for Integer Set Library (ISL) to Clang Static Analyzer's
RetainCountChecker.

Reference counting on the callee side can be extensively used to perform
debugging within a function (For example: Finding leaks on error paths).

Patch by Malhar Thakkar!

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

LLVM/llvm 311062llvm/trunk/lib/CodeGen MachineCopyPropagation.cpp, llvm/trunk/test/CodeGen/AMDGPU call-argument-types.ll callee-special-input-sgprs.ll

Revert "[MachineCopyPropagation] Extend pass to do COPY source forwarding"

This reverts commit r311038.

Several buildbots are breaking, and at least one appears to be due to
the forwarding of physical regs enabled by this change.  Reverting while
I investigate further.

LLVM/llvm 311061llvm/trunk/lib/Target/ARM ARMISelLowering.cpp, llvm/trunk/test/CodeGen/ARM/Windows vla-cpsr.ll

ARM: mark CPSR as clobbered for Windows VLAs

When lowering a VLA, we emit a __chstk call.  However, this call can
internally clobber CPSR.  We did not mark this register as an ImpDef,
which could potentially allow a comparison to be hoisted above the call
to `__chkstk`.  In such a case, the CPSR could be clobbered, and the
check invalidated.  When the support was initially added, it seemed that
the call would take care of preventing CPSR from being clobbered, but
this is not the case.  Mark the register as clobbered to fix a possible
state corruption.

LLVM/llvm 311060llvm/trunk/lib/Target/X86 X86InstrSSE.td

[X86] Exchange the memory op predicate for PALIGNR/VPALIGNR. I accidentally swapped them.

LLVM/llvm 311059llvm/trunk/lib/Target/X86 X86InstrSSE.td

[X86] Cleanup multiclasses for SSE/AVX2 PALIGNR. Add missing load patterns.

We used to have a separate multiclass for AVX2 and SSE/AVX. Now we have one multiclass and 
pass the relevant differences.

We were also missing load patterns, though we had them for the AVX-512 version.

LLVM/llvm 311058llvm/trunk/lib/Target/X86 X86InstrAVX512.td X86InstrSSE.td

[X86] Remove patterns for PALIGNR with non-vXi8 types.

LLVM/llvm 311057llvm/trunk/include/llvm/Support GenericDomTreeConstruction.h, llvm/trunk/lib/Transforms/Scalar ADCE.cpp

Reapply: [ADCE][Dominators] Teach ADCE to preserve dominators

Summary:
This patch teaches ADCE to preserve both DominatorTrees and PostDominatorTrees.

I didn't notice any performance impact when bootstrapping clang with this patch.

The patch was originally committed in r311039 and reverted in r311049.
This revision fixes the problem with not adding a dependency on the
DominatorTreeWrapperPass for the LegacyPassManager.

Reviewers: dberlin, chandlerc, sanjoy, davide, grosser, brzycki

Reviewed By: davide

Subscribers: grandinj, zhendongsu, llvm-commits, david2050

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

LLVM/llvm 311056lld/trunk/ELF InputSection.cpp InputSection.h

Remove a lock and use a std::unique_ptr instead.

We had a lock to guard BAlloc from being used concurrently, but that
is not very easy to understand. This patch replaces it with a
std::unique_ptr.

LLVM/llvm 311055llvm/trunk/lib/Target/X86 X86InstrAVX512.td

[X86] Put multiclass closer to its use and simplify slightly. NFC

LLVM/llvm 311054llvm/trunk/lib/Target/X86 X86ISelLowering.cpp

[X86] Use a static array instead of a SmallVector for a small fixed size array. NFC

LLVM/llvm 311053cfe/trunk/include/clang/Index IndexSymbol.h, cfe/trunk/lib/Index USRGeneration.cpp IndexDecl.cpp

[index] Add indexing for unresolved-using declarations

In dependent contexts we end up referencing these, so make sure they
have USRs, and have their declarations indexed. For the most part they
behave like typedefs, but we also need to worry about having multiple
using declarations with the same "name".

rdar://problem/33883650

LLVM/llvm 311052llvm/trunk/test/CodeGen/X86 cmov-promotion.ll

[x86] add cmov promotion tests for D36711; NFC

This way we can see what the current codegen looks like.
I've also explicitly added/removed the cmov attribute from the RUN lines,
so we know exactly what we're checking in the runs.

LLVM/llvm 311051cfe/trunk/include/clang/Lex MultipleIncludeOpt.h, cfe/trunk/lib/Sema SemaExpr.cpp

Fix typos in comments; NFC

LLVM/llvm 311050llvm/trunk/lib/Transforms/InstCombine InstCombineCasts.cpp, llvm/trunk/test/Transforms/InstCombine trunc.ll

[InstCombine] Teach canEvaluateTruncated to handle arithmetic shift (including those with 
vector splat shift amount)

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

LLVM/llvm 311049llvm/trunk/include/llvm/Support GenericDomTreeConstruction.h, llvm/trunk/lib/Transforms/Scalar ADCE.cpp

Revert "[ADCE][Dominators] Teach ADCE to preserve dominators"

This reverts commit r311039. The patch caused the
`test/Bindings/OCaml/Output/scalar_opts.ml` to fail.

LLVM/llvm 311048llvm/trunk/include/llvm/Analysis MemoryDependenceAnalysis.h MemorySSA.h, llvm/trunk/lib/Analysis MemorySSA.cpp ModuleSummaryAnalysis.cpp

[Analysis] Fix some Clang-tidy modernize and  Include What You Use warnings; other minor 
fixes (NFC).

LLVM/llvm 311047libcxxabi/trunk/src cxa_exception.cpp

Revert "[libcxxabi] When built with ASan, __cxa_throw calls __asan_handle_no_return"

This reverts commit r311045 because it's causing an error on
libcxx-libcxxabi-x86_64-linux-ubuntu-asan bot.

LLVM/llvm 311046polly/trunk/test/GPGPU invariant-load-hoisting-read-in-kernel.ll

Add missing 'REQUIRES' line

LLVM/llvm 311045libcxxabi/trunk/src cxa_exception.cpp

[libcxxabi] When built with ASan, __cxa_throw calls __asan_handle_no_return

The ASan runtime on many systems intercepts cxa_throw just so it
can call asan_handle_no_return first. Some newer systems such as
Fuchsia don't use interceptors on standard library functions at all,
but instead use sanitizer-instrumented versions of the standard
libraries. When libc++abi is built with ASan, cxa_throw can just
call asan_handle_no_return itself so no interceptor is required.

Patch by Roland McGrath

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

LLVM/llvm 311044llvm/trunk/lib/Transforms/InstCombine InstCombineSelect.cpp, llvm/trunk/test/Transforms/InstCombine select.ll

[InstCombine] Make folding (X >s -1) ? C1 : C2 --> ((X >>s 31) & (C2 - C1)) + C1 support 
splat vectors

This also uses decomposeBitTestICmp to decode the compare.

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

LLVM/llvm 311043cfe/trunk/test/Driver opt-record.c

Don't use -no-integrated-as in test/Driver/opt-record.c

-no-integrated-as is not supported on some targets (e.g.,
x86_64-pc-windows-msvc). Testing using -save-temps is good enough to cover the
relevant logic, and that should work everywhere.

LLVM/llvm 311042polly/trunk/lib/CodeGen IslNodeBuilder.cpp, polly/trunk/test/GPGPU invariant-load-hoisting-read-in-kernel.ll

[GPGPU] Also record invariant loads as kernel subtree values

Before this change kernels that used invariant loads would have resulted in
invalid PTX code.

LLVM/llvm 311041cfe/trunk/lib/Driver/ToolChains Clang.cpp, cfe/trunk/test/Driver opt-record.c

Base optimization-record file names on the final output

Using Output.getFilename() to construct the file name used for optimization
recording in Clang::ConstructJob, when -c is provided, does not work correctly
if we're not using the integrated assembler. With -no-integrated-as (or
-save-temps) Output.getFilename() gives the name of the temporary assembly
file, not the final output file. Instead, use the final output (as provided by
-o). If this is not available, then fall back to using a name based on the
input file.

Fixes PR31532.

LLVM/llvm 311040clang-tools-extra/trunk/clang-tidy/android CloexecSocketCheck.cpp

[clang-tidy] Remove unused static variable.

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

LLVM/llvm 311039llvm/trunk/include/llvm/Support GenericDomTreeConstruction.h, llvm/trunk/lib/Transforms/Scalar ADCE.cpp

[ADCE][Dominators] Teach ADCE to preserve dominators

Summary:
This patch teaches ADCE to preserve both DominatorTrees and PostDominatorTrees.

I didn't notice any performance impact when bootstrapping clang with this patch.

Reviewers: dberlin, chandlerc, sanjoy, davide, grosser, brzycki

Reviewed By: davide

Subscribers: grandinj, zhendongsu, llvm-commits, david2050

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

LLVM/llvm 311038llvm/trunk/lib/CodeGen MachineCopyPropagation.cpp, llvm/trunk/test/CodeGen/AMDGPU call-argument-types.ll callee-special-input-sgprs.ll

[MachineCopyPropagation] Extend pass to do COPY source forwarding

This change extends MachineCopyPropagation to do COPY source forwarding.

This change also extends the MachineCopyPropagation pass to be able to
be run during register allocation, after physical registers have been
assigned, but before the virtual registers have been re-written, which
allows it to remove virtual register COPY LiveIntervals that become dead
through the forwarding of all of their uses.

Reviewers: qcolombet, javed.absar, MatzeB, jonpa

Subscribers: jyknight, nemanjai, llvm-commits, nhaehnle, mcrosier, mgorny

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

LLVM/llvm 311037cfe/trunk/lib/CodeGen CGDebugInfo.cpp, cfe/trunk/test/CodeGen debug-info-preprocessed-file.i

Use the file name from linemarker for debug info if an input is preprocessed source.

Summary:
Even in the case of the input file is a preprocessed source, clang uses the file name of 
the preprocesses source for debug info (DW_AT_name attribute for DW_TAG_compile_unit). 
However, gcc uses the file name specified in the first linemarker instead. This makes more 
sense because the one specified in the linemarker represents the "actual" source file 
name.

Clang already uses the file name specified in the first linemarker for Module name 
(https://github.com/llvm-mirror/clang/blob/master/lib/Frontend/FrontendAction.cpp#L779) if 
the input is preprocessed. This patch makes clang to use the same value for debug info as 
well.

Reviewers: compnerd, rnk, dblaikie, rsmith

Reviewed By: rnk

Subscribers: aprantl, cfe-commits

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

LLVM/llvm 311036llvm/trunk/runtimes CMakeLists.txt

[CMake][runtimes] Support for building target variants

This can be used to build non-sanitized and sanitized versions of
runtimes, where sanitized versions use the just built sanitizer
which in turn may use the non-sanitized version.

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

LLVM/llvm 311035clang-tools-extra/trunk/clang-tidy/android CloexecCheck.h CloexecCheck.cpp

[clang-tidy] Use const char* to compile with VC cl.exe.

Summary:
cl.exe does not accept constexpr char FuncBindingStr[] = ...

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

LLVM/llvm 311034cfe/trunk/include/clang/Driver SanitizerArgs.h, cfe/trunk/lib/Driver SanitizerArgs.cpp

[Driver] SafeStack does not need a runtime library on Fuchsia

Patch by Roland McGrath

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

LLVM/llvm 311033cfe/trunk/cmake/caches Fuchsia-stage2.cmake

[CMake] Build sanitized C++ runtimes for Fuchsia

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

LLVM/llvm 311032llvm/trunk/lib/Target/AArch64 AArch64FalkorHWPFFix.cpp, llvm/trunk/lib/Transforms/Scalar LoopDataPrefetch.cpp

[LoopDataPrefetch][AArch64FalkorHWPFFix] Preserve ScalarEvolution

Summary:
Mark LoopDataPrefetch and AArch64FalkorHWPFFix passes as preserving
ScalarEvolution since they do not alter loop structure and should not
alter any SCEV values (though LoopDataPrefetch may introduce new
instructions that won't have cached SCEV values yet).

This can result in slight code differences, mainly w.r.t. nsw/nuw flags
on SCEVs, since these are computed somewhat lazily when a zext/sext
instruction is encountered.  As a result, passes after the modified
passes may see SCEVs with more nsw/nuw flags present.

Reviewers: sanjoy, anemet

Subscribers: aemerson, rengolin, mzolotukhin, javed.absar, kristof.beyls, mcrosier, 
llvm-commits

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

LLVM/llvm 311031llvm/trunk/include/llvm/Object RelocVisitor.h, llvm/trunk/test/DebugInfo/Mips dwarfdump-tls.ll

[mips] Handle R_MIPS_TLS_DTPREL32/64 relocations in the RelocVisitor

Debug information for TLS variables on MIPS might have R_MIPS_TLS_DTPREL32
or R_MIPS_TLS_DTPREL64 relocations. This patch adds a support for such
relocations in the `RelocVisitor`.

LLVM/llvm 311030compiler-rt/trunk/lib/lsan lsan_interceptors.cc

Add C++17 aligned new/delete interceptors to standalone lsan

Summary: Based on r282019.

Reviewers: kcc, jakubjelinek, alekseyshl

Subscribers: llvm-commits

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

LLVM/llvm 311029clang-tools-extra/trunk/clang-tidy/android CloexecEpollCreateCheck.cpp CloexecEpollCreateCheck.h, clang-tools-extra/trunk/docs ReleaseNotes.rst

[clang-tidy] Add a close-on-exec check on epoll_create() in Android module.

Summary:
epoll_create() is better to be replaced by epoll_create1() with EPOLL_CLOEXEC
flag to avoid file descriptor leakage.

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