platform/upstream/llvm.git
5 years ago[Analyzer] Clean up test/Analysis/ptr-sort.cpp
Mandeep Singh Grang [Wed, 13 Mar 2019 19:21:11 +0000 (19:21 +0000)]
[Analyzer] Clean up test/Analysis/ptr-sort.cpp

llvm-svn: 356088

5 years agoFix a failing test.
Erik Pilkington [Wed, 13 Mar 2019 19:20:45 +0000 (19:20 +0000)]
Fix a failing test.

llvm-svn: 356087

5 years ago[Analyzer] Update the LLVM license in PointerSortingChecker.cpp
Mandeep Singh Grang [Wed, 13 Mar 2019 19:09:48 +0000 (19:09 +0000)]
[Analyzer] Update the LLVM license in PointerSortingChecker.cpp

llvm-svn: 356086

5 years agoMips: Add ImmArg to intrinsics
Matt Arsenault [Wed, 13 Mar 2019 19:07:59 +0000 (19:07 +0000)]
Mips: Add ImmArg to intrinsics

I found these by asserting in clang for any GCCBuiltin that doesn't
require mangling and requires a constant for the builtin. This means
that intrinsics are missing which don't use GCCBuiltin, don't have
builtins defined in clang, or were missing the constant annotation in
the builtin definition.

I'm not sure what's going on with the immediates.ll test. It seems to
be intended to test invalid cases like this, but then tries to handle
some of them anyway. I've moved the cases that were inconsistent with
the GCCBuiltin definition so they don't test the codegen anymore.

llvm-svn: 356085

5 years ago[X86] Remove icmp undef in more reduced tests
Simon Pilgrim [Wed, 13 Mar 2019 19:07:54 +0000 (19:07 +0000)]
[X86] Remove icmp undef in more reduced tests

llvm-svn: 356084

5 years ago[X86] Regenerate tail call tests
Simon Pilgrim [Wed, 13 Mar 2019 19:04:45 +0000 (19:04 +0000)]
[X86] Regenerate tail call tests

llvm-svn: 356083

5 years ago[MsgPack] Removed MsgPackTypes
Tim Renouf [Wed, 13 Mar 2019 18:56:33 +0000 (18:56 +0000)]
[MsgPack] Removed MsgPackTypes

Summary:
MsgPackTypes has been replaced by the lighter-weight MsgPackDocument.

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

Change-Id: Ia7069880ef29f55490abbe5d8ae15f25cc1490a4
llvm-svn: 356082

5 years ago[AMDGPU] Switched HSA metadata to use MsgPackDocument
Tim Renouf [Wed, 13 Mar 2019 18:55:50 +0000 (18:55 +0000)]
[AMDGPU] Switched HSA metadata to use MsgPackDocument

Summary:
MsgPackDocument is the lighter-weight replacement for MsgPackTypes. This
commit switches AMDGPU HSA metadata processing to use MsgPackDocument
instead of MsgPackTypes.

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

Change-Id: I0751668013abe8c87db01db1170831a76079b3a6
llvm-svn: 356081

5 years ago[MsgPack] New MsgPackDocument class
Tim Renouf [Wed, 13 Mar 2019 18:54:47 +0000 (18:54 +0000)]
[MsgPack] New MsgPackDocument class

Summary:
A class that exposes a simple in-memory representation of a document of
MsgPack objects, that can be read from and written to MsgPack, read from
and written to YAML, and inspected and modified in memory. This is
intended to be a lighter-weight (in terms of memory allocations)
replacement for MsgPackTypes.

Two subsequent changes will:
1. switch AMDGPU HSA metadata to using MsgPackDocument instead of
   MsgPackTypes;
2. add MsgPack AMDGPU PAL metadata via MsgPackDocument.

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

Change-Id: Ie15a054831d5a6467c5867c064c8f8f6b80270e1
llvm-svn: 356080

5 years ago[ExpressionParser] Restore removed intance of FileSystem::Resolve while resolving...
Alex Langford [Wed, 13 Mar 2019 18:51:22 +0000 (18:51 +0000)]
[ExpressionParser] Restore removed intance of FileSystem::Resolve while resolving clang resource dir

I committed a change that removed this line, but I meant to restore it
befor committing.

llvm-svn: 356079

5 years ago[X86] Check for 64-bit mode in X86Subtarget::hasCmpxchg16b()
Craig Topper [Wed, 13 Mar 2019 18:48:50 +0000 (18:48 +0000)]
[X86] Check for 64-bit mode in X86Subtarget::hasCmpxchg16b()

The feature flag alone can't be trusted since it can be passed via -mattr. Need to ensure 64-bit mode as well.

We had a 64 bit mode check on the instruction to make the assembler work correctly. But we weren't guarding any of our lowering code or the hooks for the AtomicExpandPass.

I've added 32-bit command lines to atomic128.ll with and without cx16. The tests there would all previously fail if -mattr=cx16 was passed to them. I had to move one test case for f128 to a new file as it seems to have a different 32-bit mode or possibly sse issue.

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

llvm-svn: 356078

5 years ago[X86] Avoid icmp undef in reduced tests
Simon Pilgrim [Wed, 13 Mar 2019 18:36:59 +0000 (18:36 +0000)]
[X86] Avoid icmp undef in reduced tests

Because we don't currently simplify icmp with undef in DAG, bugpoint loves to introduce them during reduction.

This is a small step towards re-adding non-undef values into some of the simpler tests so that they should still test correctly and emit similar/same codegen.

Prep work for PR40800 ([SelectionDAG] Add UNDEF handling to SelectionDAG::FoldSetCC).

llvm-svn: 356076

5 years ago[Parse] Parse '#pragma clang attribute' as an external-declaration
Erik Pilkington [Wed, 13 Mar 2019 18:30:59 +0000 (18:30 +0000)]
[Parse] Parse '#pragma clang attribute' as an external-declaration

Previously, we parsed it only in the top level, which excludes namespaces and
extern "C" blocks.

rdar://problem/48818890

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

llvm-svn: 356075

5 years ago[RISCV] Regenerate test/CodeGen/RISCV/legalize-fneg.ll after rL356068
Alex Bradbury [Wed, 13 Mar 2019 18:25:23 +0000 (18:25 +0000)]
[RISCV] Regenerate test/CodeGen/RISCV/legalize-fneg.ll after rL356068

rL356068 caused some minor re-orderings. Regenerate legalize-fneg.ll to
reflect this, and remove the NOLIB check lines (they're redundant given that
the RV32I and RV64I check lines generated by update_llc_test_checks.py already
demonstrate there is no libcall).

llvm-svn: 356074

5 years agoUpdate.
Jason Molenda [Wed, 13 Mar 2019 18:24:42 +0000 (18:24 +0000)]
Update.

llvm-svn: 356073

5 years ago[OPENMP][NVPTX]Fix PR40893: Size doesn't match for
Alexey Bataev [Wed, 13 Mar 2019 18:21:10 +0000 (18:21 +0000)]
[OPENMP][NVPTX]Fix PR40893: Size doesn't match for
'_openmp_teams_reductions_buffer_$_.

nvlink does not handle weak linkage correctly, same symbols with the
different sizes are reported as erroneous though the largest size must
be chosen instead. Patch fixes this problem by using Internal linkage
instead of the Common.

llvm-svn: 356072

5 years agoRegenerate test
Simon Pilgrim [Wed, 13 Mar 2019 18:18:24 +0000 (18:18 +0000)]
Regenerate test

llvm-svn: 356071

5 years agoRevert "Add AIX Target Info"
Jason Liu [Wed, 13 Mar 2019 17:57:23 +0000 (17:57 +0000)]
Revert "Add AIX Target Info"

This reverts commit 4e192d0e1e72ce32fabf1bccc06ac31ab5385e78.
The newly added test case max_align.c do not work on all platforms.

original llvm-svn: 356060

llvm-svn: 356070

5 years ago[DAGCombiner] Fix Comment. NFC.
Nirav Dave [Wed, 13 Mar 2019 17:44:40 +0000 (17:44 +0000)]
[DAGCombiner] Fix Comment. NFC.

llvm-svn: 356069

5 years ago[DAGCombiner] If a TokenFactor would be merged into its user, consider the user later.
Nirav Dave [Wed, 13 Mar 2019 17:07:09 +0000 (17:07 +0000)]
[DAGCombiner] If a TokenFactor would be merged into its user, consider the user later.

Summary:
A number of optimizations are inhibited by single-use TokenFactors not
being merged into the TokenFactor using it. This makes we consider if
we can do the merge immediately.

Most tests changes here are due to the change in visitation causing
minor reorderings and associated reassociation of paired memory
operations.

CodeGen tests with non-reordering changes:

  X86/aligned-variadic.ll -- memory-based add folded into stored leaq
  value.

  X86/constant-combiners.ll -- Optimizes out overlap between stores.

  X86/pr40631_deadstore_elision -- folds constant byte store into
  preceding quad word constant store.

Reviewers: RKSimon, craig.topper, spatel, efriedma, courbet

Reviewed By: courbet

Subscribers: dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, javed.absar, eraman, hiraditya, kbarton, jrtc27, atanasyan, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 356068

5 years ago[X86][AVX] Add X86ISD::VTRUNC handling to SimplifyDemandedVectorEltsForTargetNode
Simon Pilgrim [Wed, 13 Mar 2019 17:00:18 +0000 (17:00 +0000)]
[X86][AVX] Add X86ISD::VTRUNC handling to SimplifyDemandedVectorEltsForTargetNode

llvm-svn: 356067

5 years ago[lldbsuite] Un-xfail TestPyObjSynthProvider on Windows
Stella Stamenova [Wed, 13 Mar 2019 16:53:53 +0000 (16:53 +0000)]
[lldbsuite] Un-xfail TestPyObjSynthProvider on Windows

One of Davide's changes yesterday fixed the behavior on Windows, so the test is now passing.

llvm-svn: 356065

5 years ago[X86][AVX] Add combineConcatVectors support to improve subvector handling
Simon Pilgrim [Wed, 13 Mar 2019 16:37:30 +0000 (16:37 +0000)]
[X86][AVX] Add combineConcatVectors support to improve subvector handling

Attempt to combine CONCAT_VECTORS nodes, which we only really have pre-legalization.

This encourages a lot of X86ISD::SUBV_BROADCAST generation, so I've added SimplifyDemandedVectorEltsForTargetNode handling for this at the same time.

The X86ISD::VTRUNC regression in shuffle-vs-trunc-256-widen.ll will be handled in a future commit.

llvm-svn: 356064

5 years ago[RISCV] Only mark fp as reserved if the function has a dedicated frame pointer
Alex Bradbury [Wed, 13 Mar 2019 16:33:45 +0000 (16:33 +0000)]
[RISCV] Only mark fp as reserved if the function has a dedicated frame pointer

This follows similar logic in the ARM and Mips backends, and allows the free
use of s0 in functions without a dedicated frame pointer. The changes in
callee-saved-gprs.ll most clearly show the effect of this patch.

llvm-svn: 356063

5 years ago[libclang] Expose aligned() attribute.
Emilio Cobos Alvarez [Wed, 13 Mar 2019 16:16:54 +0000 (16:16 +0000)]
[libclang] Expose aligned() attribute.

Summary:
This is useful because otherwise there's no easy way to distinguish #pragma
packed(N) from attribute(packed, aligned(N)) that isn't looking at field
offsets (since pragma packed() also creates a packed attribute).

Reviewers: Anastasia, arphaman, serge-sans-paille

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 356062

5 years ago[RISCV] Add tests for callee-saved GPRs, FPR32s, and FPR64s
Alex Bradbury [Wed, 13 Mar 2019 16:14:16 +0000 (16:14 +0000)]
[RISCV] Add tests for callee-saved GPRs, FPR32s, and FPR64s

Note that s0 need not be marked reserved if the frame pointer isn't used. For
the ILP32 and LP64 soft float ABIS that are currently support, all FPRs are
always considered temporaries.

llvm-svn: 356061

5 years agoAdd AIX Target Info
Jason Liu [Wed, 13 Mar 2019 16:02:26 +0000 (16:02 +0000)]
Add AIX Target Info

Summary:
A first pass over platform-specific properties of the C API/ABI
on AIX for both 32-bit and 64-bit modes.
This is a continuation of D18360 by Andrew Paprocki and further work by Wu Zhao.

Patch by Andus Yu

Reviewers: apaprocki, chandlerc, hubert.reinterpretcast, jasonliu,
xingxue, sfertile

Reviewed by: hubert.reinterpretcast, apaprocki, sfertile

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

llvm-svn: 356060

5 years ago[mips] Join some adjacent `let DecoderNamespace` blocks. NFC
Simon Atanasyan [Wed, 13 Mar 2019 16:00:42 +0000 (16:00 +0000)]
[mips] Join some adjacent `let DecoderNamespace` blocks. NFC

llvm-svn: 356059

5 years ago[mips] Remove redundant setup of less-significant bit. NFC
Simon Atanasyan [Wed, 13 Mar 2019 16:00:35 +0000 (16:00 +0000)]
[mips] Remove redundant setup of less-significant bit. NFC

The less-significant bit for microMIPS symbols configured
in the `getSymVA` function. Do not need to setup it once again.

llvm-svn: 356058

5 years agoMake sure FileSystem::Resolve preserves the path/file distinction.
Adrian Prantl [Wed, 13 Mar 2019 15:54:18 +0000 (15:54 +0000)]
Make sure FileSystem::Resolve preserves the path/file distinction.

This should finally fix TestPaths.py.

llvm-svn: 356057

5 years ago[NFC][CMake] Improve Status message in the iOS toolchain file
Louis Dionne [Wed, 13 Mar 2019 15:35:21 +0000 (15:35 +0000)]
[NFC][CMake] Improve Status message in the iOS toolchain file

llvm-svn: 356056

5 years ago[clangd] Fix a typo in doc.
Haojian Wu [Wed, 13 Mar 2019 15:22:31 +0000 (15:22 +0000)]
[clangd] Fix a typo in doc.

llvm-svn: 356055

5 years ago[AArch64] Add test/CodeGen/AArch64/vecreduce-fadd.ll
Sander de Smalen [Wed, 13 Mar 2019 15:18:27 +0000 (15:18 +0000)]
[AArch64] Add test/CodeGen/AArch64/vecreduce-fadd.ll

This test is added to see difference created by:

  https://reviews.llvm.org/D59259

llvm-svn: 356054

5 years ago[x86] limit extractelement of setcc to pre-legalization
Sanjay Patel [Wed, 13 Mar 2019 14:49:52 +0000 (14:49 +0000)]
[x86] limit extractelement of setcc to pre-legalization

A fuzzer found the crasher:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13700

The bug was introduced recently here:
rL355741

This is the quick fix. If we need to do this transform
later, then we'd have to extend/truncate the vector setcc
element type to the scalar setcc type (i8).

llvm-svn: 356053

5 years ago[mips] Fix encoding of the `mov.d` command for microMIPS R6
Simon Atanasyan [Wed, 13 Mar 2019 14:23:12 +0000 (14:23 +0000)]
[mips] Fix encoding of the `mov.d` command for microMIPS R6

Before this change LLVM emits non-microMIPS variant of the `mov.d`
command for microMIPS code.

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

llvm-svn: 356052

5 years ago[mips] Define `mov.d` instructions using `ABSS_M` multiclass. NFC
Simon Atanasyan [Wed, 13 Mar 2019 14:22:58 +0000 (14:22 +0000)]
[mips] Define `mov.d` instructions using `ABSS_M` multiclass. NFC

llvm-svn: 356051

5 years agoRe-land r354244 "[DAGCombiner] Eliminate dead stores to stack."
Clement Courbet [Wed, 13 Mar 2019 13:56:23 +0000 (13:56 +0000)]
Re-land r354244 "[DAGCombiner] Eliminate dead stores to stack."

Always check candidates for hasOtherUses(), not only stores.

llvm-svn: 356050

5 years ago[Analyzer] Skip symbolic regions based on conjured symbols in comparison of the conta...
Adam Balogh [Wed, 13 Mar 2019 13:55:11 +0000 (13:55 +0000)]
[Analyzer] Skip symbolic regions based on conjured symbols in comparison of the containers of iterators

Checking whether two regions are the same is a partially decidable problem:
either we know for sure that they are the same or we cannot decide. A typical
case for this are the symbolic regions based on conjured symbols. Two
different conjured symbols are either the same or they are different. Since
we cannot decide this and want to reduce false positives as much as possible
we exclude these regions whenever checking whether two containers are the
same at iterator mismatch check.

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

llvm-svn: 356049

5 years agoFix/unify SBType comparison
Pavel Labath [Wed, 13 Mar 2019 13:45:14 +0000 (13:45 +0000)]
Fix/unify SBType comparison

Summary:
In my next step at cleaning up modify-python-lldb.py, I started focusing
on equality comparison. To my surprise, I found out that both python and
c++ versions of the SBType class implement equality comparison, but each
one does it differently. While the python version was implemented in
terms of type name equality, the C++ one used a deep comparison on the
underlying objects.

Removing the python version caused one test to fail (TestTypeList). This
happened because the c++ version of operator== boiled down to
TypePair::operator==, which contains two items: the compiler_type and
type_sp. In this case, the compiler_type was identical, but one of the
objects had the type_sp field unset.

I tried fixing the code so that both objects keep their type_sp member,
but it wasn't easy, because there are so many operations which just work
with the CompilerType types, and so any operation on the SBType (the
test in question was doing GetPointeeType on the type of one variable
and expecting it to match the type of another variable), cause that
second member to be lost.

So instead, here I relax the equality comparison on the TypePair
class. Now, this class ignores the type_sp for the purposes of
comparison, and uses the CompilerType only. This seems reasonable, as
each TypeSP is able to convert itself to a CompilerType.

Reviewers: clayborg, aprantl, serge-sans-paille

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 356048

5 years ago[AST] Improve support of external layouts in `MicrosoftRecordLayoutBuilder`
Aleksandr Urakov [Wed, 13 Mar 2019 13:38:12 +0000 (13:38 +0000)]
[AST] Improve support of external layouts in `MicrosoftRecordLayoutBuilder`

Summary:
This patch fixes several small problems with external layouts support in
`MicrosoftRecordLayoutBuilder`:
- aligns properly the size of a struct that ends with a bit field. It was
  aligned on byte before, not on the size of the field, so the struct size was
  smaller than it should be;
- adjusts the struct size when injecting a vbptr in the case when there were no
  bases or fields allocated after the vbptr. Similarly, without the adjustment
  the struct was smaller than it should be;
- the same fix as above for the vfptr.
All these fixes affect the non-virtual size of a struct, so they are tested
through non-virtual inheritance.

Reviewers: rnk, zturner, rsmith

Reviewed By: rnk

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 356047

5 years agoFix signed/unsigned mismatch warning. NFCI.
Simon Pilgrim [Wed, 13 Mar 2019 13:14:14 +0000 (13:14 +0000)]
Fix signed/unsigned mismatch warning. NFCI.

llvm-svn: 356046

5 years ago[mips] Map SW instruction to its microMIPS R6 variant
Simon Atanasyan [Wed, 13 Mar 2019 13:09:30 +0000 (13:09 +0000)]
[mips] Map SW instruction to its microMIPS R6 variant

To provide mapping between standard and microMIPS R6 variants of the
`sw` command we have to rename SWSP_xxx commands from "sw" to "swsp".
Otherwise `tablegen` starts to show the error `Multiple matches found
for `SW'`. After that to restore printing SWSP command as `sw`, I add
an appropriate `MipsInstAlias` instance.

We also need to implement "size reduction" for microMIPS R6. But this
task is for separate patch. After that the `micromips-lwsp-swsp.ll` test
case will be extended.

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

llvm-svn: 356045

5 years ago[RISCV] Regenerate umulo-128-legalisation-lowering.ll
Alex Bradbury [Wed, 13 Mar 2019 12:33:44 +0000 (12:33 +0000)]
[RISCV] Regenerate umulo-128-legalisation-lowering.ll

Upstream changes have improved codegen, reducing stack usage. Regenerate the test.

llvm-svn: 356044

5 years ago[X86][AVX] lowerShuffleAsBroadcast - improve load folding by avoiding bitcasts
Simon Pilgrim [Wed, 13 Mar 2019 12:20:39 +0000 (12:20 +0000)]
[X86][AVX] lowerShuffleAsBroadcast - improve load folding by avoiding bitcasts

AVX1 broadcasts were failing as we were adding bitcasts that caused MayFoldLoad's hasOneUse to return false.

This patch stops introducing bitcasts so early and also replaces the broadcast index scaling through bitcasts (which can't succeed in some cases) to instead just keep track of the bitoffset which can be converted back to the broadcast index later on.

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

llvm-svn: 356043

5 years agoAppease MSVC builds by #ifdef wrapping runAndGetCommandOutput tests. NFCI.
Simon Pilgrim [Wed, 13 Mar 2019 11:51:13 +0000 (11:51 +0000)]
Appease MSVC builds by #ifdef wrapping runAndGetCommandOutput tests. NFCI.

llvm-svn: 356042

5 years ago[DebugInfo][Docs] Document how dbg.value intrinsics are interpreted in optimized...
Jeremy Morse [Wed, 13 Mar 2019 11:43:13 +0000 (11:43 +0000)]
[DebugInfo][Docs] Document how dbg.value intrinsics are interpreted in optimized code

This patch adds a section, ``Object lifetime in optimized code'', that
documents how such intrinsics are supposed to be handled. It sets out some of
the principles of how they specify variable locations, and how long those
locations are valid for.

This patch also documents one of the objectives behind the variable-location
design, that we should never allow the debugger to observe a state of the
program that would not have appeared without optimization.

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

llvm-svn: 356041

5 years ago[DAG] Move integer setcc %x, %x folding into FoldSetCC
Simon Pilgrim [Wed, 13 Mar 2019 11:08:57 +0000 (11:08 +0000)]
[DAG] Move integer setcc %x, %x folding into FoldSetCC

First step towards PR40800 - I intend to move the float case in a separate future patch.

I had to tweak the (overly reduced) thumb2 test and the x86 widening test change is annoying (no longer rematerializable) but we should address this separately.

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

llvm-svn: 356040

5 years ago[MIPS][microMIPS] Fix PseudoMTLOHI_MM matching and expansion
Simon Atanasyan [Wed, 13 Mar 2019 11:04:38 +0000 (11:04 +0000)]
[MIPS][microMIPS] Fix PseudoMTLOHI_MM matching and expansion

On micromips MipsMTLOHI is always matched to PseudoMTLOHI_DSP regardless
of +dsp argument. This patch checks is HasDSP predicate is present for
PseudoMTLOHI_DSP so PseudoMTLOHI_MM can be matched when appropriate.

Add expansion of PseudoMTLOHI_MM instruction into a mtlo/mthi pair.

Patch by Mirko Brkusanin.

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

llvm-svn: 356039

5 years ago[mips] Fix CPU used in the test case to suppress warning. NFC
Simon Atanasyan [Wed, 13 Mar 2019 11:04:28 +0000 (11:04 +0000)]
[mips] Fix CPU used in the test case to suppress warning. NFC

The MSA ASE used in in the test case requires MIPS32 revision 5 or
greater while the test uses MIPS32 revision 1.

llvm-svn: 356038

5 years ago[ELF] Fix GCC8 warnings about "fall through", NFCI
Jonas Hahnfeld [Wed, 13 Mar 2019 10:38:17 +0000 (10:38 +0000)]
[ELF] Fix GCC8 warnings about "fall through", NFCI

Add break statements in Object/ELF.cpp since the code should consider the
generic tags for Hexagon, MIPS, and PPC. Add a test (copied from llvm-readobj)
to show that this works correctly (earlier versions of this patch would have
asserted).

The warnings in X86ELFObjectWriter.cpp are actually false-positives since
the nested switch() handles all possible values and returns in all cases.
Make this explicit by adding llvm_unreachable's.

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

llvm-svn: 356037

5 years ago[Support] Treat truncation of fullpath as error
Jonas Hahnfeld [Wed, 13 Mar 2019 10:37:56 +0000 (10:37 +0000)]
[Support] Treat truncation of fullpath as error

If the concatenation of arguments dir and bin has at least PATH_MAX
characters the call to snprintf will truncate. The result will usually
not exist, but if it does it's actually incorrect to return that the
path exists.
(Motivated by GCC compiler warning about format truncation.)

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

llvm-svn: 356036

5 years ago[RISCV] Replace incorrect use of sizeof with array_lengthof
Alex Bradbury [Wed, 13 Mar 2019 09:22:57 +0000 (09:22 +0000)]
[RISCV] Replace incorrect use of sizeof with array_lengthof

RISCVDisassembler was incorrectly using sizeof(Arr) when it should have used
sizeof(Arr)/sizeof(Arr[0]). Update to use array_lengthof instead.

llvm-svn: 356035

5 years ago[clangd] Default initialize SymInfo
Kadir Cetinkaya [Wed, 13 Mar 2019 08:42:15 +0000 (08:42 +0000)]
[clangd] Default initialize SymInfo

llvm-svn: 356032

5 years ago[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else...
Paul Hoad [Wed, 13 Mar 2019 08:26:39 +0000 (08:26 +0000)]
[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else" statement is present

Summary:
Addressing: PR25010 - https://bugs.llvm.org/show_bug.cgi?id=25010

Code like:

```
    if(true) var++;
    else  {
        var--;
    }
```

is reformatted to be

```
  if (true)
    var++;
  else {
    var--;
  }
```

Even when `AllowShortIfStatementsOnASingleLine` is true

The following revision comes from a +1'd suggestion in the PR to support AllowShortIfElseStatementsOnASingleLine

This suppresses the clause prevents the merging of the if when there is a compound else

Reviewers: klimek, djasper, JonasToth, alexfh, krasimir, reuk
Reviewed By: reuk
Subscribers: reuk, Higuoxing, jdoerfert, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D59087

llvm-svn: 356031

5 years agoRevert "[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working...
Paul Hoad [Wed, 13 Mar 2019 08:15:03 +0000 (08:15 +0000)]
Revert "[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else" statement is present"

This reverts commit b358cbb9b78389e20f7be36e1a98e26515c3ecce.

llvm-svn: 356030

5 years ago[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else...
Paul Hoad [Wed, 13 Mar 2019 08:07:46 +0000 (08:07 +0000)]
[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else" statement is present

Summary:
Addressing: PR25010 - https://bugs.llvm.org/show_bug.cgi?id=25010

Code like:

```
    if(true) var++;
    else  {
        var--;
    }
```

is reformatted to be

```
  if (true)
    var++;
  else {
    var--;
  }
```

Even when `AllowShortIfStatementsOnASingleLine` is true

The following revision comes from a +1'd suggestion in the PR to support AllowShortIfElseStatementsOnASingleLine

This suppresses the clause prevents the merging of the if when there is a compound else

Reviewers: klimek, djasper, JonasToth, alexfh, krasimir, reuk
Reviewed By: reuk
Subscribers: reuk, Higuoxing, jdoerfert, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D59087

llvm-svn: 356029

5 years agosincos: Simplify declaration headers.
Jan Vesely [Wed, 13 Mar 2019 07:13:34 +0000 (07:13 +0000)]
sincos: Simplify declaration headers.

This follows the same pattern as modf and fract.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356028

5 years agofdim: Use binary_decl_tt.inc instead of custom inc file.
Jan Vesely [Wed, 13 Mar 2019 07:13:32 +0000 (07:13 +0000)]
fdim: Use binary_decl_tt.inc instead of custom inc file.

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356027

5 years agonextafter: Use binary_decl_tt.inc instead of custom inc file.
Jan Vesely [Wed, 13 Mar 2019 07:13:30 +0000 (07:13 +0000)]
nextafter: Use binary_decl_tt.inc instead of custom inc file.

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356026

5 years agocopysign: Use binary_decl_tt.inc instead of custom inc file.
Jan Vesely [Wed, 13 Mar 2019 07:13:28 +0000 (07:13 +0000)]
copysign: Use binary_decl_tt.inc instead of custom inc file.

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356025

5 years agoatan2pi: Use binary_decl_tt.inc instead of custom inc file.
Jan Vesely [Wed, 13 Mar 2019 07:13:26 +0000 (07:13 +0000)]
atan2pi: Use binary_decl_tt.inc instead of custom inc file.

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356024

5 years agoatan2: Use binary_decl_tt.inc instead of custom inc file.
Jan Vesely [Wed, 13 Mar 2019 07:13:24 +0000 (07:13 +0000)]
atan2: Use binary_decl_tt.inc instead of custom inc file.

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356023

5 years agohypot: Use binary_decl_tt.inc instead of custom inc file
Jan Vesely [Wed, 13 Mar 2019 07:13:22 +0000 (07:13 +0000)]
hypot: Use binary_decl_tt.inc instead of custom inc file

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356022

5 years agoMove unary_instrinsic.inc to private headers.
Jan Vesely [Wed, 13 Mar 2019 07:06:19 +0000 (07:06 +0000)]
Move unary_instrinsic.inc to private headers.

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356021

5 years agoMove binary_intrinsic.h to private headers.
Jan Vesely [Wed, 13 Mar 2019 07:06:15 +0000 (07:06 +0000)]
Move binary_intrinsic.h to private headers.

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356020

5 years agoMove ternary_intrinsic.h to private headers.
Jan Vesely [Wed, 13 Mar 2019 07:06:13 +0000 (07:06 +0000)]
Move ternary_intrinsic.h to private headers.

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356019

5 years agotrunc: Remove llvm intrinsic from the header.
Jan Vesely [Wed, 13 Mar 2019 07:06:10 +0000 (07:06 +0000)]
trunc: Remove llvm intrinsic from the header.

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356018

5 years agoround: Remove llvm intrinsic from the header
Jan Vesely [Wed, 13 Mar 2019 07:06:08 +0000 (07:06 +0000)]
round: Remove llvm intrinsic from the header

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356017

5 years agorint: Remove llvm intrinsic from the header.
Jan Vesely [Wed, 13 Mar 2019 07:06:06 +0000 (07:06 +0000)]
rint: Remove llvm intrinsic from the header.

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356016

5 years agofloor: Remove llvm isntrinsic from the header.
Jan Vesely [Wed, 13 Mar 2019 07:06:03 +0000 (07:06 +0000)]
floor: Remove llvm isntrinsic from the header.

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356015

5 years agofabs: Remove llvm intrinsic from the header.
Jan Vesely [Wed, 13 Mar 2019 07:06:00 +0000 (07:06 +0000)]
fabs: Remove llvm intrinsic from the header.

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356014

5 years agoceil: Remove llvm intrinsic from the header.
Jan Vesely [Wed, 13 Mar 2019 07:05:58 +0000 (07:05 +0000)]
ceil: Remove llvm intrinsic from the header.

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356013

5 years agosqrt: Split function generation to a shared inc file.
Jan Vesely [Wed, 13 Mar 2019 07:05:56 +0000 (07:05 +0000)]
sqrt: Split function generation to a shared inc file.

This will be reused by other unary functions.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356012

5 years agomad: Convert to standard ternary header
Jan Vesely [Wed, 13 Mar 2019 07:05:53 +0000 (07:05 +0000)]
mad: Convert to standard ternary header

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356011

5 years agotravis: Deduplicate LLVM_CONFIG variable
Jan Vesely [Wed, 13 Mar 2019 06:58:53 +0000 (06:58 +0000)]
travis: Deduplicate LLVM_CONFIG variable

Reviewers: Aaron Watry, Tom Stellard
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356010

5 years agotravis: Use gcc-6 for llvm-7 build
Jan Vesely [Wed, 13 Mar 2019 06:58:51 +0000 (06:58 +0000)]
travis: Use gcc-6 for llvm-7 build

llvm does not expose -std=c++11 in cxx flags.
gcc-6 switched default from c++98 to c++14

Reviewers: Aaron Watry, Tom Stellard
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 356009

5 years ago[X86] Remove 'cx16' from 'prescott' and 'yonah' as they are 32-bit only CPUs and...
Craig Topper [Wed, 13 Mar 2019 05:14:52 +0000 (05:14 +0000)]
[X86] Remove 'cx16' from 'prescott' and 'yonah' as they are 32-bit only CPUs and cmpxchg16b requires 64-bit mode.

llvm-svn: 356008

5 years ago[X86] Add 'yonah' test to predefined-arch-macros.c test.
Craig Topper [Wed, 13 Mar 2019 05:14:50 +0000 (05:14 +0000)]
[X86] Add 'yonah' test to predefined-arch-macros.c test.

llvm-svn: 356007

5 years ago[ImplicitNullChecks] Support unordered atomic accesses
Philip Reames [Wed, 13 Mar 2019 03:25:20 +0000 (03:25 +0000)]
[ImplicitNullChecks] Support unordered atomic accesses

Update the INC pass to allow folding unordered atomics.  This is the first optimization unblocked by the changes landed from D57601.

llvm-svn: 356006

5 years agoDelete unused declaration of DeclContextPrintAction after the removal of -print-decl...
Fangrui Song [Wed, 13 Mar 2019 03:22:33 +0000 (03:22 +0000)]
Delete unused declaration of DeclContextPrintAction after the removal of -print-decl-contexts by D52529

llvm-svn: 356005

5 years ago[Tests] Expand implicit null check coverage
Philip Reames [Wed, 13 Mar 2019 03:17:58 +0000 (03:17 +0000)]
[Tests] Expand implicit null check coverage

llvm-svn: 356004

5 years ago[TestBatchMode] We already log this output to a file.
Davide Italiano [Wed, 13 Mar 2019 02:47:51 +0000 (02:47 +0000)]
[TestBatchMode] We already log this output to a file.

llvm-svn: 356003

5 years ago[testsuite] Remove other traces broken in python 3.
Davide Italiano [Wed, 13 Mar 2019 02:44:32 +0000 (02:44 +0000)]
[testsuite] Remove other traces broken in python 3.

They can be reinstated in case somebody needs to debug
this test in the future.

llvm-svn: 356002

5 years agoRevert "[llvm] Skip over empty line table entries."
Evgeniy Stepanov [Wed, 13 Mar 2019 01:37:58 +0000 (01:37 +0000)]
Revert "[llvm] Skip over empty line table entries."

This reverts commit r355972.
See the discussion at https://reviews.llvm.org/D58952.

llvm-svn: 356001

5 years ago[testsuite] Remove dead code in TestFormats.
Davide Italiano [Wed, 13 Mar 2019 01:26:01 +0000 (01:26 +0000)]
[testsuite] Remove dead code in TestFormats.

llvm-svn: 356000

5 years ago[test] Some unicode sequences can't be printed, and Py 3 is more picky.
Davide Italiano [Wed, 13 Mar 2019 00:48:32 +0000 (00:48 +0000)]
[test] Some unicode sequences can't be printed, and Py 3 is more picky.

Given this was under trace, it can just be removed. If somebody
ever needs to debug this testcase again and print the data, they
can add a new statement.

llvm-svn: 355999

5 years ago[Python] Fix another batch of python 2/python 3 portability issues.
Davide Italiano [Wed, 13 Mar 2019 00:48:29 +0000 (00:48 +0000)]
[Python] Fix another batch of python 2/python 3 portability issues.

llvm-svn: 355998

5 years ago[X86] Enable printAliasInstr for the Intel assembly printer so that AAM and AAD will...
Craig Topper [Wed, 13 Mar 2019 00:43:03 +0000 (00:43 +0000)]
[X86] Enable printAliasInstr for the Intel assembly printer so that AAM and AAD will print without an immediate when the immediate is 10.

llvm-svn: 355997

5 years ago[WebAssembly] Place 'try' and 'catch' correctly wrt EH_LABELs
Heejin Ahn [Wed, 13 Mar 2019 00:37:31 +0000 (00:37 +0000)]
[WebAssembly] Place 'try' and 'catch' correctly wrt EH_LABELs

Summary:
After instruction selection phase, possibly-throwing calls, which were
previously invoke, are wrapped in `EH_LABEL` instructions. For example:
```
  EH_LABEL <mcsymbol .Ltmp0>
  CALL_VOID @foo ...
  EH_LABEL <mcsymbol .Ltmp1>
```

`EH_LABEL` is placed also in the beginning of EH pads:
```
bb.1 (landing-pad):
  EH_LABEL <mcsymbol .Ltmp2>
  ...
```

And we'd like to maintian this relationship, so when we place a `try`,
```
  TRY ...
  EH_LABEL <mcsymbol .Ltmp0>
  CALL_VOID @foo ...
  EH_LABEL <mcsymbol .Ltmp1>
```

When we place a `catch`,
```
bb.1 (landing-pad):
  EH_LABEL <mcsymbol .Ltmp2>
  %0:except_ref = CATCH ...
  ...
```

Previously we didn't treat EH_LABELs specially, so `try` was placed
right before a call, and `catch` was placed in the beginning of an EH
pad.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

Tags: #llvm

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

llvm-svn: 355996

5 years agoUse AIX version detection at LLVM run-time
Hubert Tong [Wed, 13 Mar 2019 00:12:43 +0000 (00:12 +0000)]
Use AIX version detection at LLVM run-time

Summary:
AIX compilers define macros based on the version of the operating
system.

This patch implements updating of versionless AIX triples to include the
host AIX version. Also, the host triple detection in the build system is
adjusted to strip the AIX version information so that the run-time
detection is preferred.

Reviewers: xingxue, stefanp, nemanjai, jasonliu

Reviewed By: xingxue

Subscribers: mgorny, kristina, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 355995

5 years agoUpdate the macOS implementation of ComputeClangResourceDirectory to
Adrian Prantl [Tue, 12 Mar 2019 23:59:02 +0000 (23:59 +0000)]
Update the macOS implementation of ComputeClangResourceDirectory to
comply with the more pedantic TestPaths.py

llvm-svn: 355994

5 years ago[X86] Add ImmArg markings to intrinsics.
Craig Topper [Tue, 12 Mar 2019 23:48:07 +0000 (23:48 +0000)]
[X86] Add ImmArg markings to intrinsics.

Remove test cases that checked for not crashing when immediate operands were passed not an immediate. These are now considered ill-formed in IR.

This was done by manually scanning the intrinsic file for llvm_i32_ty and llvm_i8_ty which are the predominant types we use for immediates. Most of them are on vector intrinsics. I might have missed some other intrinsics.

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

llvm-svn: 355993

5 years agoThis test is failing on and off on the bots.
Jim Ingham [Tue, 12 Mar 2019 23:15:48 +0000 (23:15 +0000)]
This test is failing on and off on the bots.
Disable it for now till I can figure out what's going wrong.

llvm-svn: 355992

5 years agoFix the broken Batch test by passing a custom module cache to the inferior lldb.
Adrian Prantl [Tue, 12 Mar 2019 22:20:29 +0000 (22:20 +0000)]
Fix the broken Batch test by passing a custom module cache to the inferior lldb.

llvm-svn: 355991

5 years agoRevert "Temporarily add more logging to TestBatchMode"
Adrian Prantl [Tue, 12 Mar 2019 22:20:26 +0000 (22:20 +0000)]
Revert "Temporarily add more logging to TestBatchMode"

llvm-svn: 355990

5 years agoAdd XCOFF triple object format type for AIX
Jason Liu [Tue, 12 Mar 2019 22:01:10 +0000 (22:01 +0000)]
Add XCOFF triple object format type for AIX

This patch adds an XCOFF triple object format type into LLVM.
This XCOFF triple object file type will be used later by object file and assembly generation for the AIX platform.

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

llvm-svn: 355989

5 years ago[WebAssembly] Handle undefined data symbols in shared libraries
Sam Clegg [Tue, 12 Mar 2019 21:53:23 +0000 (21:53 +0000)]
[WebAssembly] Handle undefined data symbols in shared libraries

When linking shared libraries, we import a mutable wasm global
to represent the address of each undefined data symbol.

This is a step towards supporting dynamic linking and shared
libraries.

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

llvm-svn: 355988

5 years ago[NFC][clang][PCH][ObjC] Add some missing `VisitStmt(S);`
Roman Lebedev [Tue, 12 Mar 2019 21:31:00 +0000 (21:31 +0000)]
[NFC][clang][PCH][ObjC] Add some missing `VisitStmt(S);`

Summary:
These ObjC AST classes inherit from Stmt, but don't call `VisitStmt(S);`.
Some were founded with help of existing tests (with `NumStmtFields` bumped to `1`),
but some of them don't even have PCH test coverage. :/

Reviewers: arphaman, sammccall, smeenai, aprantl, rsmith, jordan_rose

Reviewed By: jordan_rose

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 355987

5 years agoTemporarily add more logging to TestBatchMode
Adrian Prantl [Tue, 12 Mar 2019 21:30:50 +0000 (21:30 +0000)]
Temporarily add more logging to TestBatchMode

llvm-svn: 355986

5 years agoAdd more logging to ClangModulesDeclVendor.cpp
Adrian Prantl [Tue, 12 Mar 2019 21:30:47 +0000 (21:30 +0000)]
Add more logging to ClangModulesDeclVendor.cpp

llvm-svn: 355985