LLVM/llvm 316411cfe/trunk/test/Unit lit.cfg.py

[test] Fix clang-test for FreeBSD and NetBSD

Lit tries to inject the shared library paths, but no action is taken
when platform.system() is not recognized, results in an environment
variable with an empty name, which is illegal.

The patch fixes this mechanism for FreeBSD and NetBSD, and gives an
warning on other platforms, so that the latecomers don't have to spend
time on debugging lit.

Thanks Zhihao Yuan for the patch!

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

LLVM/llvm 316410compiler-rt/trunk/lib/xray xray_buffer_queue.cc xray_buffer_queue.h

[XRay][compiler-rt] More fixups.

Follow-up to D39175.

LLVM/llvm 316409compiler-rt/trunk/lib/xray xray_buffer_queue.cc xray_buffer_queue.h

[XRay][compiler-rt] Fixup shadowing

Follow-up to D39175.

LLVM/llvm 316408cfe/trunk/lib/AST ExprConstant.cpp, cfe/trunk/test/SemaCXX warn-global-constructors.cpp constant-expression-cxx11.cpp

Unnamed bitfields don't block constant evaluation of constexpr ctors

C++14 [dcl.constexpr]p4 states that in the body of a constexpr

> every non-variant non-static data member and base class sub-object
  shall be initialized

However, [class.bit]p2 notes that

> Unnamed bit-fields are not members and cannot be initialized.

Therefore, we should make sure to filter them out of the check that
all fields are initialized.

Fixing this makes the constant evaluator a bit smarter, and
specifically allows constexpr constructors to avoid tripping
-Wglobal-constructors when the type contains unnamed bitfields.

Reviewed at https://reviews.llvm.org/D39035.

LLVM/llvm 316407llvm/trunk/utils/TableGen GlobalISelEmitter.cpp

[globalisel][tablegen] Remove unused InstructionMatcher's. NFC

LLVM/llvm 316406compiler-rt/trunk/lib/xray xray_buffer_queue.h xray_buffer_queue.cc

[XRay][compiler-rt] Remove C++ STL from the buffer queue implementation

This change removes the dependency on C++ standard library
types/functions in the implementation of the buffer queue. This is an
incremental step in resolving llvm.org/PR32274.

Reviewers: dblaikie, pelikan

Subscribers: llvm-commits

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

LLVM/llvm 316405cfe/trunk/lib/Sema SemaTemplate.cpp

Fix template parameter default args missed if redecled

This bug was found via self-build on lld, and worked around
here: https://reviews.llvm.org/rL316180

The issue is that the 'using' causes the lookup to pick up the
first decl. However, when setting inherited default parameters,
we only update 'forward', not 'backward'. SO, only the newest param
list has all the information about the default arguments.

This patch ensures that the list of parameters we look through checks
the newest decl's template parameter list so it doesn't miss a default.

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

LLVM/llvm 316404llvm/trunk/include/llvm/Support raw_ostream.h LockFileManager.h, llvm/trunk/lib/IR Core.cpp

[raw_fd_ostream] report actual error in error messages

Previously, we would emit error messages like "IO failure on output
stream". This change causes use to include information about what
actually went wrong, e.g. "No space left on device".

Reviewers: sunfish, rnk

Reviewed By: rnk

Subscribers: mehdi_amini, llvm-commits, hiraditya

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

LLVM/llvm 316403cfe/trunk/lib/Analysis AnalysisDeclContext.cpp

[Analyzer] Fix for the memory leak: fix typo in if-statement.

LLVM/llvm 316402cfe/trunk/lib/Analysis BodyFarm.cpp, cfe/trunk/test/Analysis call_once.cpp

[Analyzer] Handle implicit function reference in bodyfarming std::call_once

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

LLVM/llvm 316401llvm/trunk/lib/Transforms/ObjCARC PtrState.cpp, llvm/trunk/test/Transforms/ObjCARC invoke-2.ll

ObjCARC: do not increment past the end of the BB

The `BasicBlock::getFirstInsertionPt` call may return `std::end` for the
BB.  Dereferencing the end iterator results in an assertion failure
"(!NodePtr->isKnownSentinel()), function operator*".  Ensure that the
returned iterator is valid before dereferencing it.  If the end is
returned, move one position backward to get a valid insertion point.

LLVM/llvm 316400cfe/trunk/include/clang/Analysis BodyFarm.h AnalysisDeclContext.h, cfe/trunk/lib/Analysis BodyFarm.h AnalysisDeclContext.cpp

[Analyzer] Do not use static storage to for implementations created in BodyFarm.cpp

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

LLVM/llvm 316399cfe/trunk/lib/StaticAnalyzer/Core Store.cpp, cfe/trunk/test/Analysis ptr-arith.c

[analyzer] Fix handling of labels in getLValueElement

In getLValueElement Base may represent the address of a label 
(as in the newly-added test case), in this case it's not a loc::MemRegionVal 
and Base.castAs<loc::MemRegionVal>() triggers an assert, this diff makes 
getLValueElement return UnknownVal instead.

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

LLVM/llvm 316398llvm/trunk/include/llvm/DebugInfo/CodeView CodeViewSymbols.def, llvm/trunk/lib/DebugInfo/CodeView TypeIndexDiscovery.cpp

[codeview] Add support for inlinee lists

This adds type index discovery and dumper support for symbol record kind
0x1168, which is a list of inlined function ids. This symbol kind is
undocumented, but S_INLINEES is consistent with the existing

Fixes PR34222

LLVM/llvm 316397llvm/trunk/include/llvm/IR PassManager.h

[PM] Fix Typo

Patch by Nick Sarnie.

LLVM/llvm 316396llvm/trunk/lib/CodeGen MachineOutliner.cpp, llvm/trunk/test/CodeGen/AArch64 machine-outliner-remarks.ll

[MachineOutliner] Add optimisation remarks for successful outlining

This commit adds optimisation remarks for outlining which fire when a function
is successfully outlined.

To do this, OutlinedFunctions must now contain references to their Candidates.
Since the Candidates must still be sorted and worked on separately, this is
done by working on everything in terms of shared_ptrs to Candidates. This is
good; it means that we can easily move everything to outlining in terms of
the OutlinedFunctions rather than the individual Candidates. This is far more
intuitive than what's currently there!

(Remarks are output when a function is created for some group of Candidates.
In a later commit, all of the outlining logic should be rewritten so that we
loop over OutlinedFunctions rather than over Candidates.)

LLVM/llvm 316395compiler-rt/trunk/lib/fuzzer FuzzerLoop.cpp

[Sanitizers-libFuzzer] Addressing coding style issues.

Summary: The result of clang-format and few manual changes (as prompted on D39155).

Reviewers: vitalybuka

Subscribers: llvm-commits

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

LLVM/llvm 316394libcxx/trunk/fuzzing fuzzing.cpp fuzzing.h

More fuzzing interfaces

LLVM/llvm 316393lldb/trunk/packages/Python/lldbsuite/test dotest.py

[lldbtests] Handle errors instead of crashing.

If you pass an invalid compiler/debugger path on the cmdline to `dotest.py`  this is what 
you get.

  Traceback (most recent call last):
    File "dotest.py", line 7, in <module>

And with the patch applied:

  /home/davide/work/build-lldb/bin/clandasfasg is not a valid path, exiting

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

LLVM/llvm 316392lld/trunk/test/COFF pdb-thunk.yaml

[PDB] Add test for S_THUNK32 records

I locally reverted r316385 and confirmed that this test fails without

Really fixes the cause of PR35014.

LLVM/llvm 316391lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server gdbremote_testcase.py

Use ipv4 localhost address in lldb-server tests

Since the ipv6 patch, we've experienced occasional flakyness in
lldb-server tests. This was due to the fact that lldb-server was trying
to listen on both v4 and v6 localhost sockets (and consider it a success
if at least one of them succeeded), while the test framework was only
trying to connect to the v4 one.

This change makes sure lldb-server only listens on the v4 socket.

LLVM/llvm 316390lldb/trunk/source/Symbol Symtab.cpp

[Symbol] Remove dead code. NFCI.

LLVM/llvm 316389llvm/trunk/lib/Target/AMDGPU AMDGPUSubtarget.cpp Processors.td

AMDGPU: Initialize WavefrontSize from TD files

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

LLVM/llvm 316388llvm/trunk/test/CodeGen/ARM/GlobalISel arm-legalize-divmod.mir arm-instruction-select.mir

[GISel][ARM]: Fix illegal Generic copies in tests

This is in preparation for a verifier check that makes sure
copies are of the same size (when generic virtual registers are involved).

LLVM/llvm 316387llvm/trunk/test/CodeGen/AArch64/GlobalISel select-int-ext.mir select-store.mir

[GISel][AArch64]: Fix illegal Generic copies in tests

This is in preparation for a verifier check that makes sure copies are
of the same size (when generic virtual registers are involved).

LLVM/llvm 316386lld/trunk/COFF PDB.cpp

[PDB] Fix logging of bad type indices

LLVM/llvm 316385llvm/trunk/lib/DebugInfo/CodeView TypeIndexDiscovery.cpp

[codeview] Recognize two records with no type index fields

Thunk records do not have types and frame cookies do not have types.

These were found while linking libconcrt.lib from MSVC.

LLVM/llvm 316384llvm/trunk/lib/Passes PassBuilder.cpp, llvm/trunk/test/Other new-pm-pgo.ll

[PM] Add pgo-memop-opt pass to the new pass manager

This pass adds pgo-memop-opt pass to the new pass manager.
It is in the old pass manager but somehow left out in the new pass manager.

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

LLVM/llvm 316383llvm/trunk/lib/Target/X86 X86ISelLowering.cpp, llvm/trunk/test/CodeGen/X86 bitcast-and-setcc-128.ll bitcast-setcc-256.ll

[X86][SSE] combineBitcastvxi1 - use PACKSSWB directly to pack v8i16 to v16i8

Avoid difficulties determining the number of sign bits later on in shuffle lowering to 
lower to PACKSS

LLVM/llvm 316382compiler-rt/trunk/lib/fuzzer FuzzerLoop.cpp FuzzerFlags.def

[libFuzzer] Periodically purge allocator's quarantine to prolong fuzzing sessions.

Fuzzing targets that allocate/deallocate a lot of memory tend to consume
a lot of RSS when ASan quarantine is enabled. Purging quarantine between
iterations and returning memory to OS keeps RSS down and should not
reduce the quarantine effectiveness provided the fuzz target does not
preserve state between iterations (in this case this feature can be turned off).

Based on D39153.

Reviewers: vitalybuka

Subscribers: llvm-commits

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

LLVM/llvm 316381cfe/trunk/include/clang/Basic DiagnosticSemaKinds.td, cfe/trunk/lib/Sema SemaDecl.cpp SemaDeclObjC.cpp

[Sema] Add support for flexible array members in Obj-C.

Allow Obj-C ivars with incomplete array type but only as the last ivar.
Also add a requirement for ivars that contain a flexible array member to
be at the end of class too. It is possible to add in a subclass another
ivar at the end but we'll emit a warning in this case. Also we'll emit a
warning if a variable sized ivar is declared in class extension or in
implementation because subclasses won't know they should avoid adding
new ivars.

In ARC incomplete array objects are treated as __unsafe_unretained so
require them to be marked as such.

Prohibit synthesizing ivars with flexible array members because order of
synthesized ivars is not obvious and tricky to control. Spelling out
ivar explicitly gives control to developers and helps to avoid surprises
with unexpected ivar ordering.

For C and C++ changed diagnostic to tell explicitly a field is not the
last one and point to the next field. It is not as useful as in Obj-C
but it is an improvement and it is consistent with Obj-C. For C for
unions emit more specific err_flexible_array_union instead of generic


    [8 lines not shown]

LLVM/llvm 316380llvm/trunk/include/llvm/ADT Triple.h, llvm/trunk/lib/Support Triple.cpp

Add a new Simulator entry for the target triple environment.

Apple's iOS, tvOS and watchOS simulator platforms have never been clearly
distinguished in the target triples. Even though they are intended to
behave similarly to the corresponding device platforms, they have separate
SDKs and are really separate platforms from the compiler's perspective.
Clang now defines a macro when building for one of these simulator platforms
(r297866) but that relies on the very indirect mechanism of checking to see
which option was used to specify the minimum deployment target. That is not
so great. Swift would also like to distinguish these simulator platforms in
a similar way, but unlike Clang, Swift does not use a separate option to
specify the minimum deployment target -- it uses a -target option to
specify the target triple directly, including the OS version number.
Using a different target triple for the simulator platforms is a much
more direct and obvious way to specify this. Putting the "simulator" in
the environment component of the triple means the OS values can stay the
same and existing code the looks at the OS field will not be affected.


LLVM/llvm 316379cfe/trunk/lib/Driver/ToolChains Fuchsia.cpp Fuchsia.h, cfe/trunk/test/Driver fuchsia.c fuchsia.cpp

[Driver] Use ld.lld directly for Fuchsia rather than passing flavor

Passing a flavor to LLD requires command line argument, but if these
are being passed through a response file, this will fail because LLD
needs to know which driver to use before processing the response file.
Use ld.lld directly instead to avoid this issue.

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

LLVM/llvm 316378lld/trunk/ELF LinkerScript.cpp LinkerScript.h

Make Ctx a plain pointer again.

If a struct has a std::unique_ptr member, the logical interpretation
is that that member will be destroyed with the struct.

That is not the case for Ctx. It is has to be deleted earlier and its
lifetime is defined by the functions where the AddressState is

LLVM/llvm 316377llvm/trunk/lib/CodeGen/SelectionDAG SelectionDAGBuilder.cpp

Fix buildbot breakage

SP is only used in an assert. Caused by r316374.

LLVM/llvm 316376lld/trunk/test/ELF got32-i386-pie-rw.s

Document a change of behavior in r315552.

We used to reject this, but we now accept. The output seems
reasonable, so this is probably an OK extension over bfd/gold.

LLVM/llvm 316375llvm/trunk/tools/llvm-cfi-verify/lib FileAnalysis.cpp FileAnalysis.h, llvm/trunk/unittests/tools/llvm-cfi-verify GraphBuilder.cpp FileAnalysis.cpp

Made llvm-cfi-verify not execute unit tests on non-x86 builds.

Patched out from D38427.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: llvm-commits, kcc, pcc, mgorny

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

LLVM/llvm 316374llvm/trunk/lib/CodeGen/SelectionDAG SelectionDAGBuilder.cpp LegalizeTypes.h, llvm/trunk/test/CodeGen/AArch64 no-fp-asm-clobbers-crash.ll

Don't crash when we see unallocatable registers in clobbers

This fixes a bug where we'd crash given code like the test-case from
https://bugs.llvm.org/show_bug.cgi?id=30792 . Instead, we let the
offending clobber silently slide through.

This doesn't fully fix said bug, since the assembler will still complain
the moment it sees a crypto/fp/vector op, and we still don't diagnose
calls that require vector regs.

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

LLVM/llvm 316373zorg/trunk/zorg/buildbot/builders/sanitizers buildbot_functions.sh

Revert "[zorg] Print ulimits to debug bot failures"

Issue was resolved.

This reverts commit r316259.

LLVM/llvm 316372llvm/trunk/tools/llvm-cfi-verify CMakeLists.txt, llvm/trunk/tools/llvm-cfi-verify/lib GraphBuilder.cpp GraphBuilder.h

Graph builder implementation.

Implement a localised graph builder for indirect control flow
instructions. Main interface is through GraphBuilder::buildFlowGraph,
which will build a flow graph around an indirect CF instruction. Various
modifications to FileVerifier are also made to const-expose some members
needed for machine code analysis done by the graph builder.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: llvm-commits, kcc, pcc

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

LLVM/llvm 316371llvm/trunk/lib/Target/PowerPC PPCMIPeephole.cpp, llvm/trunk/test/CodeGen/PowerPC ppc64-peephole-swap.ll

Revert "[PowerPC] Try to simplify a Swap if it feeds a Splat"

Revert commit r316366.
Previous commit causes p8-scalar_vector_conversions.ll to fail.

This reverts commit 990e764ad8a2eec206ce5dda6aefab059ccd4e92.

LLVM/llvm 316370lld/trunk/COFF Driver.cpp Error.cpp, lld/trunk/MinGW Driver.cpp

lld::COFF: better behavior when using as a library

Previously, the COFF driver would call exit(0) when called
as a library.  Now it takes `ExitEarly` option, and if it
is false, it doesn't exit.  So it is now more library-friendly.

Furthermore, link() calls freeArena() before returning, to
clean up resources.

Based on an Andrew Kelley's patch.

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

LLVM/llvm 316369llvm/trunk/lib/Transforms/Scalar GVNSink.cpp

[GVNSink] Fix failing GVNSink tests in the reverse iteration bot


The elts of ActivePreds which is defined as a SmallPtrSet are copied
into Blocks using std::copy. This makes the resultant order of Blocks
non-deterministic. We cannot simply sort Blocks as they need to match
the corresponding Values. So a better approach is to define ActivePreds
as SmallSetVector.

This fixes the following failures in
  LLVM :: Transforms/GVNSink/indirect-call.ll
  LLVM :: Transforms/GVNSink/sink-common-code.ll
  LLVM :: Transforms/GVNSink/struct.ll

Reviewers: dberlin, jmolloy, bkramer, efriedma

Reviewed By: dberlin

Subscribers: llvm-commits

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

LLVM/llvm 316368lldb/trunk/include/lldb/Utility Log.h Logging.h, lldb/trunk/source/Host/posix ProcessLauncherPosixFork.cpp

Logging: Disable logging after fork()

We had a bug where if we had forked (in the ProcessLauncherPosixFork)
while another thread was writing a log message, we would deadlock. This
happened because the fork child inherited the locked log rwmutex, which
would never get unlocked. This meant the child got stuck trying to
disable all log channels.

The bug existed for a while but only started being apparent after
D37930, which started using ThreadLauncher (which uses logging) instead
of std::thread (which does not) for launching TaskPool threads.

The fix is to use pthread_atfork to disable logging in the forked child.

Reviewers: zturner, eugene, clayborg

Subscribers: lldb-commits

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

LLVM/llvm 316367llvm/trunk/lib/Target/Hexagon HexagonISelLowering.cpp, llvm/trunk/test/CodeGen/Hexagon call-ret-i1.ll

[Hexagon] Return the correct chain edge for i1 function calls

In HexagonISelLowering, there is code to handle the case when
a function returns an i1 type. In this case, we need to generate
extra nodes to copy the result from R0 to a predicate register.

The code was returning the wrong value for the chain edge which
caused an assert "Wrong topological sorting" when converting the
instructions to MIs.

This patch fixes the problem by returning the chain for the final

Patch by Brendon Cahoon.

LLVM/llvm 316366llvm/trunk/lib/Target/PowerPC PPCMIPeephole.cpp, llvm/trunk/test/CodeGen/PowerPC ppc64-peephole-swap.ll

[PowerPC] Try to simplify a Swap if it feeds a Splat

If we have the situation where a Swap feeds a Splat we can sometimes change the
index on the Splat and then remove the Swap instruction.

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

LLVM/llvm 316365lld/trunk/ELF InputSection.h

LLD: Fix large integer implicitly truncated to unsigned type gcc warning

This fixes gcc warning.

Change by Brian Sumner

LLVM/llvm 316364libunwind/trunk/src RWMutex.hpp UnwindCursor.hpp

Abstract rwlocks into a class, provide a SRW lock implementation for windows

This requires _WIN32_WINNT >= 0x0600.

If someone wants to spend effort on supporting earlier versions,
one can easily add another fallback implementation based on
critical sections, or try to load SRW lock functions dynamically.

This makes sure that the FDE cache is thread safe on windows.

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

LLVM/llvm 316363llvm/trunk/lib/Target/Hexagon HexagonPatterns.td, llvm/trunk/test/CodeGen/Hexagon addaddi.ll

[Hexagon] Add extra pattern for S4_addaddi

One combination was missing: add(add(x,y),c).

LLVM/llvm 316362cfe/trunk/lib/CodeGen CGOpenMPRuntime.cpp CGStmtOpenMP.cpp, cfe/trunk/lib/Sema SemaOpenMP.cpp

[OpenMP] Avoid VLAs for some reductions on array sections

In some cases the compiler can deduce the length of an array section
as constants. With this information, VLAs can be avoided in place of
a constant sized array or even a scalar value if the length is 1.
int a[4], b[2];
pragma omp parallel reduction(+: a[1:2], b[1:1])
{ }

For chained array sections, this optimization is restricted to cases
where all array sections except the last have a constant length 1.
This trivially guarantees that there are no holes in the memory region
that needs to be privatized.
int c[3][4];
pragma omp parallel reduction(+: c[1:1][1:2])
{ }

This relands commit r316229 that I reverted in r316235 because it
failed on some bots. During investigation I found that this was because
Clang and GCC evaluate the two arguments to emplace_back() in
ReductionCodeGen::emitSharedLValue() in a different order, hence
leading to a different order of generated instructions in the final
LLVM IR. Fix this by passing in the arguments from temporary variables

    [3 lines not shown]