platform/upstream/llvm.git
5 years ago[llvm-cxxfilt] Split and demangle stdin input on certain non-alphanumerics.
Matt Davis [Wed, 27 Feb 2019 16:29:50 +0000 (16:29 +0000)]
[llvm-cxxfilt] Split and demangle stdin input on certain non-alphanumerics.

Summary:
This patch attempts to replicate GNU c++-filt behavior when splitting stdin input for demangling.

Previously, cxx-filt would split input only on spaces.  Each delimited item is then demangled.
From what I have tested, GNU c++filt also splits input on any character that does not make
up the mangled name (notably commas, but also a large set of non-alphanumeric characters).

This patch splits stdin input on any character that does not belong to the Itanium mangling
format (since Itanium is currently the only supported format in llvm-cxxfilt).

This is an update to PR39990

Reviewers: jhenderson, tejohnson, compnerd

Reviewed By: compnerd

Subscribers: erik.pilkington, llvm-commits

Tags: #llvm

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

llvm-svn: 354998

5 years ago[InstCombine] Add additional add.sat overflow tests; NFC
Nikita Popov [Wed, 27 Feb 2019 16:18:29 +0000 (16:18 +0000)]
[InstCombine] Add additional add.sat overflow tests; NFC

Baseline for D58593.

llvm-svn: 354996

5 years agoI changed a 'enable_if<...>::type to' 'enable_if_t<...>' but forgot to remove the...
Marshall Clow [Wed, 27 Feb 2019 16:09:35 +0000 (16:09 +0000)]
I changed a 'enable_if<...>::type to' 'enable_if_t<...>' but forgot to remove the preceding 'typename'

llvm-svn: 354995

5 years agoAdded documentation for clangd v9+ features
Dmitri Gribenko [Wed, 27 Feb 2019 16:08:04 +0000 (16:08 +0000)]
Added documentation for clangd v9+ features

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 354994

5 years ago[InstCombine] regenerate complete checks; NFC
Sanjay Patel [Wed, 27 Feb 2019 15:59:30 +0000 (15:59 +0000)]
[InstCombine] regenerate complete checks; NFC

llvm-svn: 354993

5 years agoAdded more detailed documentation for clangd
Dmitri Gribenko [Wed, 27 Feb 2019 15:53:05 +0000 (15:53 +0000)]
Added more detailed documentation for clangd

Summary:
The text was written mostly by Sam McCall, screenshots are mostly made
by me.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 354992

5 years agogn build: Merge r354989
Nico Weber [Wed, 27 Feb 2019 15:46:51 +0000 (15:46 +0000)]
gn build: Merge r354989

llvm-svn: 354991

5 years ago[NFC] minor revision of r354929 [CUDA][HIP] Check calling convention based on functio...
Yaxun Liu [Wed, 27 Feb 2019 15:46:29 +0000 (15:46 +0000)]
[NFC] minor revision of r354929 [CUDA][HIP] Check calling convention based on function target

Add comments and move a variable to if block.

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

llvm-svn: 354990

5 years agohwasan: Rename source files from cc to cpp
Nico Weber [Wed, 27 Feb 2019 15:44:03 +0000 (15:44 +0000)]
hwasan: Rename source files from cc to cpp

As discussed elsewhere: LLVM uses cpp as its C++ source extension; the
sanitizers should too. This updates files in hwasan.

Patch generated by

    for f in lib/hwasan/*.cc ; do svn mv $f ${f%.cc}.cpp; done

followed by

    for f in lib/hwasan/*.cpp ; do sed -i '' -e '1s/\.cc -/.cpp /' $f; done

CMakeLists.txt updated manually.

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

llvm-svn: 354989

5 years agoImplment the last part of P1024: tuple-like interface to span. Reviewed as https...
Marshall Clow [Wed, 27 Feb 2019 15:41:37 +0000 (15:41 +0000)]
Implment the last part of P1024: tuple-like interface to span. Reviewed as https://reviews.llvm.org/D58706.

llvm-svn: 354988

5 years agogn build: Merge r354692
Nico Weber [Wed, 27 Feb 2019 15:29:14 +0000 (15:29 +0000)]
gn build: Merge r354692

llvm-svn: 354987

5 years ago[DebugInfo] Apply subprogram attributes on behalf of owner CU
Eugene Leviant [Wed, 27 Feb 2019 14:46:59 +0000 (14:46 +0000)]
[DebugInfo] Apply subprogram attributes on behalf of owner CU

When using full LTO it is possible that template function definition DIE
is bound to one compilation unit and it's declaration to another. We should
add function declaration attributes on behalf of its owner CU otherwise
we may end up with malformed file identifier in function declaration
DW_AT_decl_file attribute.

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

llvm-svn: 354978

5 years agoRemove XFAIL-Linux from two asan tests
Pavel Labath [Wed, 27 Feb 2019 14:26:48 +0000 (14:26 +0000)]
Remove XFAIL-Linux from two asan tests

It turns out these tests actually succeed, if one has a clang with
address sanitizer support enabled (i.e., has enabled the compiler-rt
project). I guess none of the linux lldb devs have done that until now.

llvm-svn: 354976

5 years agoInsert blocks of python code with swig instead of modify-python-lldb.py
Pavel Labath [Wed, 27 Feb 2019 14:16:48 +0000 (14:16 +0000)]
Insert blocks of python code with swig instead of modify-python-lldb.py

Summary:
Swig is perfectly capable of inserting blocks of python code into its
output (and we use those fascilities already), so there's no need for
this to be done in a post-process step.

lldb_iter is a general-purpose utility used from many classes, so I add
it to the main swig file. The other two blocks are tied to a specific
class, so I add it to the interface file of that class.

Reviewers: zturner, jingham, serge-sans-paille

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 354975

5 years ago[AMDGPU][MC] Added register size check for VOP3/SDWA/DPP operands
Dmitry Preobrazhensky [Wed, 27 Feb 2019 13:58:48 +0000 (13:58 +0000)]
[AMDGPU][MC] Added register size check for VOP3/SDWA/DPP operands

See bug 37943: https://bugs.llvm.org/show_bug.cgi?id=37943

Reviewers: artem.tamazov, arsenm, rampitec

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

llvm-svn: 354974

5 years ago[DebugInfo] add SectionedAddress to DebugInfo interfaces.
Alexey Lapshin [Wed, 27 Feb 2019 13:17:36 +0000 (13:17 +0000)]
[DebugInfo] add SectionedAddress to DebugInfo interfaces.

      That patch is the fix for https://bugs.llvm.org/show_bug.cgi?id=40703
   "wrong line number info for obj file compiled with -ffunction-sections"
   bug. The problem happened with only .o files. If object file contains
   several .text sections then line number information showed incorrectly.
   The reason for this is that DwarfLineTable could not detect section which
   corresponds to specified address(because address is the local to the
   section). And as the result it could not select proper sequence in the
   line table. The fix is to pass SectionIndex with the address. So that it
   would be possible to differentiate addresses from various sections. With
   this fix llvm-objdump shows correct line numbers for disassembled code.

   Differential review: https://reviews.llvm.org/D58194

llvm-svn: 354972

5 years ago[AMDGPU][MC][GFX8+] Added syntactic sugar for 'vgpr index' operand of instructions...
Dmitry Preobrazhensky [Wed, 27 Feb 2019 13:12:12 +0000 (13:12 +0000)]
[AMDGPU][MC][GFX8+] Added syntactic sugar for 'vgpr index' operand of instructions s_set_gpr_idx_on and s_set_gpr_idx_mode

See bug 39331: https://bugs.llvm.org/show_bug.cgi?id=39331

Reviewers: artem.tamazov, arsenm

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

llvm-svn: 354969

5 years agoAttrDocs.td: fix broken bullet-point indentation
Hans Wennborg [Wed, 27 Feb 2019 13:11:37 +0000 (13:11 +0000)]
AttrDocs.td: fix broken bullet-point indentation

llvm-svn: 354968

5 years ago[clangd] Improve global code completion when scope specifier is unresolved.
Eric Liu [Wed, 27 Feb 2019 11:42:37 +0000 (11:42 +0000)]
[clangd] Improve global code completion when scope specifier is unresolved.

Summary:
Suppose `clangd::` is unresolved in the following example. Currently,
we simply use "clangd::" as the query scope. We can do better by combining with
accessible scopes in the context. The query scopes can be `{clangd::, clang::clangd::}`.
```
namespace clang { clangd::^ }

```

Reviewers: ilya-biryukov, sammccall, hokein, kadircet

Reviewed By: kadircet

Subscribers: MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 354963

5 years ago[llvm-objcopy] - Check for invalidated relocations when removing a section.
George Rimar [Wed, 27 Feb 2019 11:18:27 +0000 (11:18 +0000)]
[llvm-objcopy] - Check for invalidated relocations when removing a section.

This is https://bugs.llvm.org/show_bug.cgi?id=40818

Removing a section that is used by relocation is an error
we did not report. The patch fixes that.

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

llvm-svn: 354962

5 years ago[X86][AVX] Only combine loads to broadcasts for legal types
Simon Pilgrim [Wed, 27 Feb 2019 11:17:25 +0000 (11:17 +0000)]
[X86][AVX] Only combine loads to broadcasts for legal types

Thanks to @echristo for spotting this.

llvm-svn: 354961

5 years ago[llvm-readobj]Fix error messages for bad archive members and add testing for archive...
James Henderson [Wed, 27 Feb 2019 11:07:08 +0000 (11:07 +0000)]
[llvm-readobj]Fix error messages for bad archive members and add testing for archive handling

llvm-readobj's error messages were broken for bad archive members. This
patch fixes them, and also adds testing for archive and thin archive
handling within llvm-readobj.

Reviewed by: rupprecht, grimar, higuoxing

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

llvm-svn: 354960

5 years ago[LLD][ELF] - Improve "sh_addralign is not a power of 2" diagnostics.
George Rimar [Wed, 27 Feb 2019 10:28:23 +0000 (10:28 +0000)]
[LLD][ELF] - Improve "sh_addralign is not a power of 2" diagnostics.

This patch removes the precompiled binary from inputs,
replacing it with a YAML. And teaches LLD to report a
section name in case of such error.

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

llvm-svn: 354959

5 years agoFix Wenum-compare gcc7 warning. NFCI.
Simon Pilgrim [Wed, 27 Feb 2019 10:19:53 +0000 (10:19 +0000)]
Fix Wenum-compare gcc7 warning. NFCI.

llvm-svn: 354958

5 years ago[clangd] Set thread priority on Windows
Ilya Biryukov [Wed, 27 Feb 2019 10:16:03 +0000 (10:16 +0000)]
[clangd] Set thread priority on Windows

Reviewers: kadircet, gribozavr

Reviewed By: kadircet, gribozavr

Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 354957

5 years ago[llvm-readobj] Print DF_1_DISPRELPND
Fangrui Song [Wed, 27 Feb 2019 05:37:11 +0000 (05:37 +0000)]
[llvm-readobj] Print DF_1_DISPRELPND

The test will be added by D58677.

llvm-svn: 354955

5 years ago[BPF] Don't fail for static variables
Yonghong Song [Wed, 27 Feb 2019 05:36:15 +0000 (05:36 +0000)]
[BPF] Don't fail for static variables

Currently, the LLVM will print an error like
  Unsupported relocation: try to compile with -O2 or above,
  or check your static variable usage
if user defines more than one static variables in a single
ELF section (e.g., .bss or .data).

There is ongoing effort to support static and global
variables in libbpf and kernel. This patch removed the
assertion so user programs with static variables won't
fail compilation.

The static variable in-section offset is written to
the "imm" field of the corresponding to-be-relocated
bpf instruction. Below is an example to show how the
application (e.g., libbpf) can relate variable to relocations.

  -bash-4.4$ cat g1.c
  static volatile long a = 2;
  static volatile int b = 3;
  int test() { return a + b; }
  -bash-4.4$ clang -target bpf -O2 -c g1.c
  -bash-4.4$ llvm-readelf -r g1.o

  Relocation section '.rel.text' at offset 0x158 contains 2 entries:
      Offset             Info             Type               Symbol's Value  Symbol's Name
  0000000000000000  0000000400000001 R_BPF_64_64            0000000000000000 .data
  0000000000000018  0000000400000001 R_BPF_64_64            0000000000000000 .data
  -bash-4.4$ llvm-readelf -s g1.o

  Symbol table '.symtab' contains 6 entries:
     Num:    Value          Size Type    Bind   Vis      Ndx Name
       0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
       1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS g1.c
       2: 0000000000000000     8 OBJECT  LOCAL  DEFAULT    4 a
       3: 0000000000000008     4 OBJECT  LOCAL  DEFAULT    4 b
       4: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
       5: 0000000000000000    64 FUNC    GLOBAL DEFAULT    2 test
  -bash-4.4$ llvm-objdump -d g1.o

  g1.o:   file format ELF64-BPF

  Disassembly of section .text:
  0000000000000000 test:
       0:       18 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00         r1 = 0 ll
       2:       79 11 00 00 00 00 00 00         r1 = *(u64 *)(r1 + 0)
       3:       18 02 00 00 08 00 00 00 00 00 00 00 00 00 00 00         r2 = 8 ll
       5:       61 20 00 00 00 00 00 00         r0 = *(u32 *)(r2 + 0)
       6:       0f 10 00 00 00 00 00 00         r0 += r1
       7:       95 00 00 00 00 00 00 00         exit
  -bash-4.4$

  . from symbol table, static variable "a" is in section #4, offset 0.
  . from symbol table, static variable "b" is in section #4, offset 8.
  . the first relocation is against symbol #4:
    4: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
    and in-section offset 0 (see llvm-objdump result)
  . the second relocation is against symbol #4:
    4: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
    and in-section offset 8 (see llvm-objdump result)
  . therefore, the first relocation is for variable "a", and
    the second relocation is for variable "b".

Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 354954

5 years agoRevert "[PGO] Context sensitive PGO (part 1)"
Vlad Tsyrklevich [Wed, 27 Feb 2019 03:45:28 +0000 (03:45 +0000)]
Revert "[PGO] Context sensitive PGO (part 1)"

This reverts commit r354930, it was causing UBSan failures.

llvm-svn: 354953

5 years agoIn the review of D58642, Louis asked: 'Is there a reason for making this inline?...
Marshall Clow [Wed, 27 Feb 2019 03:25:43 +0000 (03:25 +0000)]
In the review of D58642, Louis asked: 'Is there a reason for making this inline? Templates are already inline by default'.  I told him that I didn't want to change the one call (ssize) that I was adding, but would come back later and clean them all (data/empty/begin/end/cbegin/cend/rbegin/rend/crbegin/crend/size/ssize) up later. Now it is later. Remove the unnecessary 'inline' modifiers from all these calls.

llvm-svn: 354952

5 years agoSupport: enable backtraces on Windows
Saleem Abdulrasool [Wed, 27 Feb 2019 03:21:50 +0000 (03:21 +0000)]
Support: enable backtraces on Windows

Some platforms, e.g. Windows, support backtraces but don't have
BACKTRACE. Checking for BACKTRACE prevents Windows from having
backtraces.

Patch by Jason Mittertreiner!

llvm-svn: 354951

5 years agoImplement the second part of P1227R2 - Signed ssize() functions. Reviewed as https...
Marshall Clow [Wed, 27 Feb 2019 02:58:56 +0000 (02:58 +0000)]
Implement the second part of P1227R2 - Signed ssize() functions. Reviewed as https://reviews.llvm.org/D58642

llvm-svn: 354950

5 years ago[clangd] Library dependencies in XPC
Jan Korous [Wed, 27 Feb 2019 02:37:44 +0000 (02:37 +0000)]
[clangd] Library dependencies in XPC

Patch by Nicholas Allegra

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

llvm-svn: 354949

5 years ago[HIP] change kernel stub name
Yaxun Liu [Wed, 27 Feb 2019 02:02:52 +0000 (02:02 +0000)]
[HIP] change kernel stub name

Add .stub to kernel stub function name so that it is different from kernel
name in device code. This is necessary to let debugger find correct symbol
for kernel.

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

llvm-svn: 354948

5 years ago[NFC][Sanitizer] Add TODO comments
Julian Lettner [Wed, 27 Feb 2019 01:38:54 +0000 (01:38 +0000)]
[NFC][Sanitizer] Add TODO comments

llvm-svn: 354947

5 years ago[index] Fixup for r354942. Specify target in test to achieve stable mangling.
Volodymyr Sapsai [Wed, 27 Feb 2019 01:37:43 +0000 (01:37 +0000)]
[index] Fixup for r354942. Specify target in test to achieve stable mangling.

llvm-svn: 354946

5 years ago[WebAssembly] Fix ScopeTops info in CFGStackify for EH pads
Heejin Ahn [Wed, 27 Feb 2019 01:35:14 +0000 (01:35 +0000)]
[WebAssembly] Fix ScopeTops info in CFGStackify for EH pads

Summary:
When creating `ScopeTops` info for `try` ~ `catch` ~ `end_try`, we
should create not only `end_try` -> `try` mapping but also `catch` ->
`try` mapping as well. If this is not created, `block` and `end_block`
markers later added may span across an existing `catch`, resulting in
the incorrect code like:
```
try
  block     --|  (X)
catch         |
  end_block --|
end_try
```

Reviewers: dschuff

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

Tags: #llvm

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

llvm-svn: 354945

5 years agoFix an ambiguity in the tests that gcc-tot complained about.
Marshall Clow [Wed, 27 Feb 2019 01:29:52 +0000 (01:29 +0000)]
Fix an ambiguity in the tests that gcc-tot complained about.

llvm-svn: 354944

5 years ago[libc++] Add a test for PR14074
Louis Dionne [Wed, 27 Feb 2019 01:29:09 +0000 (01:29 +0000)]
[libc++] Add a test for PR14074

PR14074 was fixed in r165884, but no tests were added.

llvm-svn: 354943

5 years ago[index] Improve indexing support for MSPropertyDecl.
Volodymyr Sapsai [Wed, 27 Feb 2019 01:04:53 +0000 (01:04 +0000)]
[index] Improve indexing support for MSPropertyDecl.

Currently the symbol for MSPropertyDecl has kind `SymbolKind::Unknown`
which can trip up various indexing tools.

rdar://problem/46764224

Reviewers: akyrtzi, benlangmuir, jkorous

Reviewed By: jkorous

Subscribers: dexonsmith, cfe-commits, jkorous, jdoerfert, arphaman

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

llvm-svn: 354942

5 years ago[DWARFFormValue] Cleanup DWARFFormValue interface. (NFC)
Jonas Devlieghere [Wed, 27 Feb 2019 00:58:09 +0000 (00:58 +0000)]
[DWARFFormValue] Cleanup DWARFFormValue interface. (NFC)

DWARFFormValues can be created from a data extractor or by passing its
value directly. Until now this was done by member functions that
modified an existing object's internal state. This patch replaces a
subset of these methods with static method that return a new
DWARFFormValue.

llvm-svn: 354941

5 years ago[libc++] Mark several tests as XFAIL on macosx10.7
Louis Dionne [Wed, 27 Feb 2019 00:57:57 +0000 (00:57 +0000)]
[libc++] Mark several tests as XFAIL on macosx10.7

Those tests fail when linking against a new dylib but running against
macosx10.7. I believe this is caused by a duplicate definition of the
RTTI for exception classes in libc++.dylib and libc++abi.dylib, but
this matter still needs some investigation.

This issue was not caught previously because all the tests always linked
against the same dylib used for running (because LIT made it impossible
to do otherwise before r349171).

rdar://problem/46809586

llvm-svn: 354940

5 years ago[WebAssembly] Remove unnecessary instructions after TRY marker placement
Heejin Ahn [Wed, 27 Feb 2019 00:50:53 +0000 (00:50 +0000)]
[WebAssembly] Remove unnecessary instructions after TRY marker placement

Summary:
This removes unnecessary instructions after TRY marker placement. There
are two cases:
- `end`/`end_block` can be removed if they overlap with `try`/`end_try`
  and they have the same return types.
- `br` right before `catch` that branches to after `end_try` can be
  deleted.

Reviewers: dschuff

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

Tags: #llvm

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

llvm-svn: 354939

5 years ago[Utility] Fix ArchSpec.MergeFrom to correctly merge environments
Alex Langford [Wed, 27 Feb 2019 00:47:39 +0000 (00:47 +0000)]
[Utility] Fix ArchSpec.MergeFrom to correctly merge environments

Summary:
This behavior was originally added in rL252264 (git commit 76a7f365da)
in order to be extra careful with handling platforms like watchos and tvos.
However, as far as triples go, those two (and others) are treated as OSes and
not environments, so that should not really apply here.

Additionally, this behavior is incorrect and can lead to incorrect ArchSpecs.
Because android is specified as an environment and not an OS, not propogating
the environment can lead to modules and targets being misidentified.

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

llvm-svn: 354938

5 years agoFix inline assembler constraint validation
Joerg Sonnenberger [Wed, 27 Feb 2019 00:40:59 +0000 (00:40 +0000)]
Fix inline assembler constraint validation

The current constraint logic is both too lax and too strict. It fails
for input outside the [INT_MIN..INT_MAX] range, but it also implicitly
accepts 0 as value when it should not. Adjust logic to handle both
correctly.

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

llvm-svn: 354937

5 years agoFirst part of P1227R2 - change span over to use 'size_t' instead of 'ptrdiff_t'....
Marshall Clow [Wed, 27 Feb 2019 00:32:16 +0000 (00:32 +0000)]
First part of P1227R2 - change span over to use 'size_t' instead of 'ptrdiff_t'. Reviewed as https://reviews.llvm.org/D58639.

llvm-svn: 354936

5 years ago[SystemZ] Pass regalloc hints to help Load-and-Test transformations.
Jonas Paulsson [Wed, 27 Feb 2019 00:18:28 +0000 (00:18 +0000)]
[SystemZ]  Pass regalloc hints to help Load-and-Test transformations.

Since there is no "Load-and-Test-High" instruction, the 32 bit load of a
register to be compared with 0 can only be implemented with LT if the virtual
GRX32 register ends up in a low part (GR32 register).

This patch detects these cases and passes the GR32 registers (low parts) as
(soft) hints in getRegAllocationHints().

Review: Ulrich Weigand.
llvm-svn: 354935

5 years agovim: `swiftself` is an attribute
Saleem Abdulrasool [Wed, 27 Feb 2019 00:12:11 +0000 (00:12 +0000)]
vim: `swiftself` is an attribute

Highlight the `swiftself` attribute on parameters.

llvm-svn: 354934

5 years ago[Utility] Remove Triple{Environment,OS,Vendor}IsUnspecifiedUnknown from ArchSpec
Alex Langford [Tue, 26 Feb 2019 23:50:19 +0000 (23:50 +0000)]
[Utility] Remove Triple{Environment,OS,Vendor}IsUnspecifiedUnknown from ArchSpec

Summary:
These functions should always return the opposite of the
`Triple{Environment,OS,Vendor}WasSpecified` functions. Unspecified unknown is
the same as unspecified, which is why one set of functions should give us what
we want. It's possible to have specified unknown, which is why we can't just
rely on checking the enum values of vendor/os/environment. We must also ensure
that the names of these are empty and not "unknown".

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

llvm-svn: 354933

5 years ago[libc++] Add <filesystem> to the min-mac macro header test
Louis Dionne [Tue, 26 Feb 2019 23:14:58 +0000 (23:14 +0000)]
[libc++] Add <filesystem> to the min-mac macro header test

llvm-svn: 354932

5 years ago[HotColdSplit] Disable splitting for sanitized functions
Vedant Kumar [Tue, 26 Feb 2019 22:55:46 +0000 (22:55 +0000)]
[HotColdSplit] Disable splitting for sanitized functions

Splitting can make sanitizer errors harder to understand, as the
trapping instruction may not be in the function where the bug was
detected.

rdar://48142697

llvm-svn: 354931

5 years ago[PGO] Context sensitive PGO (part 1)
Rong Xu [Tue, 26 Feb 2019 22:37:46 +0000 (22:37 +0000)]
[PGO] Context sensitive PGO (part 1)

Current PGO profile counts are not context sensitive. The branch probabilities
for the inlined functions are kept the same for all call-sites, and they might
be very different from the actual branch probabilities. These suboptimal
profiles can greatly affect some downstream optimizations, in particular for
the machine basic block placement optimization.

In this patch, we propose to have a post-inline PGO instrumentation/use pass,
which we called Context Sensitive PGO (CSPGO). For the users who want the best
possible performance, they can perform a second round of PGO instrument/use on
the top of the regular PGO. They will have two sets of profile counts. The
first pass profile will be manly for inline, indirect-call promotion, and
CGSCC simplification pass optimizations. The second pass profile is for
post-inline optimizations and code-gen optimizations.

A typical usage:
// Regular PGO instrumentation and generate pass1 profile.
> clang -O2 -fprofile-generate source.c -o gen
> ./gen
> llvm-profdata merge default.*profraw -o pass1.profdata
// CSPGO instrumentation.
> clang -O2 -fprofile-use=pass1.profdata -fcs-profile-generate -o gen2
> ./gen2
// Merge two sets of profiles
> llvm-profdata merge default.*profraw pass1.profdata -o profile.profdata
// Use the combined profile. Pass manager will invoke two PGO use passes.
> clang -O2 -fprofile-use=profile.profdata -o use

This change touches many components in the compiler. The reviewed patch
(D54175) will committed in phrases.

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

llvm-svn: 354930

5 years ago[CUDA][HIP] Check calling convention based on function target
Yaxun Liu [Tue, 26 Feb 2019 22:24:49 +0000 (22:24 +0000)]
[CUDA][HIP] Check calling convention based on function target

MSVC header files using vectorcall to differentiate overloaded functions, which
causes failure for AMDGPU target. This is because clang does not check function
calling convention based on function target.

This patch checks calling convention using the proper target info.

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

llvm-svn: 354929

5 years ago[OPENMP][CUDA]Do not emit warnings for variables in late-reported asm
Alexey Bataev [Tue, 26 Feb 2019 21:51:16 +0000 (21:51 +0000)]
[OPENMP][CUDA]Do not emit warnings for variables in late-reported asm
statements.

If the assembler instruction is not generated and the delayed diagnostic
is emitted, we may end up with extra warning message for variables used
in the asm statement. Since the asm statement is not built, the
variables may be left non-referenced and it may produce a warning about
a use of the non-initialized variables.

llvm-svn: 354928

5 years ago[X86] Add 'znver2' and 'cascadelake' support to __cpu_indicator_init.
Craig Topper [Tue, 26 Feb 2019 21:51:05 +0000 (21:51 +0000)]
[X86] Add 'znver2' and 'cascadelake' support to __cpu_indicator_init.

For 'cascadelake' this is adding a 'avx512vnni' feature check to the 0x55 skylake-avx512 model check. These CPUs use the same model number and only differ in the stepping number. But the feature flag is simpler than collecting all the stepping numbers.

For 'znver2' this is just syncing with LLVM's Host.cpp.

llvm-svn: 354927

5 years ago[AMDGPU] Fixed hang during DAG combine
Stanislav Mekhanoshin [Tue, 26 Feb 2019 20:56:25 +0000 (20:56 +0000)]
[AMDGPU] Fixed hang during DAG combine

SITargetLowering::reassociateScalarOps() does not touch constants
so that DAGCombiner::ReassociateOps() does not revert the combine.
However a global address is not a ConstantSDNode.

Switched to the method used by DAGCombiner::ReassociateOps() itself
to detect constants.

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

llvm-svn: 354926

5 years ago[OPENMP]Delay emission for unsupported va_arg expression.
Alexey Bataev [Tue, 26 Feb 2019 20:52:16 +0000 (20:52 +0000)]
[OPENMP]Delay emission for unsupported va_arg expression.

If the OpenMP device is NVPTX and va_arg is used, delay emission of the
error for va_arg unless it is used in the device code.

llvm-svn: 354925

5 years ago[MS] Don't emit coverage for deleting dtors
Reid Kleckner [Tue, 26 Feb 2019 20:42:52 +0000 (20:42 +0000)]
[MS] Don't emit coverage for deleting dtors

Summary:
The MS C++ ABI has no constructor variants, but it has destructor
variants, so we should move the deleting destructor variant check
outside the check for "does the ABI have constructor variants".

Fixes PR37561, so basic code coverage works on Windows with C++.

Reviewers: vsk

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 354924

5 years agoFix a small comment typo.
Eric Christopher [Tue, 26 Feb 2019 20:33:22 +0000 (20:33 +0000)]
Fix a small comment typo.

llvm-svn: 354923

5 years ago[lldb] [unittests] Use non-empty format string for Timer()
Michal Gorny [Tue, 26 Feb 2019 20:14:07 +0000 (20:14 +0000)]
[lldb] [unittests] Use non-empty format string for Timer()

Pass dummy '.' as format string for Timer() rather than an empty string,
in order to silence gcc warnings about empty format string
(-Wformat-zero-length).  The actual format string is irrelevant
to the test in question.

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

llvm-svn: 354922

5 years ago[X86] Fix bug in vectorcall calling convention
Reid Kleckner [Tue, 26 Feb 2019 19:48:16 +0000 (19:48 +0000)]
[X86] Fix bug in vectorcall calling convention

Original implementation can't correctly handle __m256 and __m512 types
passed by reference through stack. This patch fixes it.

Patch by Wei Xiao!

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

llvm-svn: 354921

5 years ago[lldb] [lit] Set LD_LIBRARY_PATH or alike for Suite tests
Michal Gorny [Tue, 26 Feb 2019 19:46:29 +0000 (19:46 +0000)]
[lldb] [lit] Set LD_LIBRARY_PATH or alike for Suite tests

Set LD_LIBRARY_PATH or local platform's equivalent of it when running
the 'Suite' tests.  This is necessary when running tests inside build
tree with BUILD_SHARED_LIBS enabled, in order to make the LLDB modules
load freshly built LLVM libraries.

The code is copied from clang (test/Unit/lit.cfg).  SHLIBDIR
substitution is added to site-config (already present in top-level LLDB
site-config) to future-proof this into supporting stand-alone builds
with shared LLDB libraries.

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

llvm-svn: 354920

5 years ago[MemorySSA & SimpleLoopUnswitch] Update MemorySSA in ReplaceUsesOfWith.
Alina Sbirlea [Tue, 26 Feb 2019 19:44:52 +0000 (19:44 +0000)]
[MemorySSA & SimpleLoopUnswitch] Update MemorySSA in ReplaceUsesOfWith.

SimpleLoopUnswitch must update MemorySSA when removing instructions.
Resolves PR39197.

llvm-svn: 354919

5 years ago[libFuzzer] fix missing close on opened file
Vitaly Buka [Tue, 26 Feb 2019 19:33:00 +0000 (19:33 +0000)]
[libFuzzer] fix missing close on opened file

Summary:
When running the standalone main on a large corpus, I eventually get a
EMFILE error ("Too many open files").

Patch by Paul Chaignon

Reviewers: kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: lebedev.ri, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 354918

5 years agoOutput ELF files after ThinLTO is run.
Bill Wendling [Tue, 26 Feb 2019 19:29:14 +0000 (19:29 +0000)]
Output ELF files after ThinLTO is run.

Summary:
The gold linker allowed you to output the ELF files after LTO was run. It did
it by using the 'obj-path' option. This replicates that behavior.

Reviewers: espindola, ruiu, MaskRay, pcc

Reviewed By: MaskRay, pcc

Subscribers: grimar, emaste, inglorion, arichardson, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 354917

5 years ago[ASTImporter] Add support for importing ChooseExpr AST nodes.
Tom Roeder [Tue, 26 Feb 2019 19:26:41 +0000 (19:26 +0000)]
[ASTImporter] Add support for importing ChooseExpr AST nodes.

Summary:
This allows ASTs to be merged when they contain ChooseExpr (the GNU
__builtin_choose_expr construction). This is needed, for example, for
cross-CTU analysis of C code that makes use of __builtin_choose_expr.

The node is already supported in the AST, but it didn't have a matcher
in ASTMatchers. So, this change adds the matcher and adds support to
ASTImporter.

This was originally reviewed and approved in
https://reviews.llvm.org/D58292 and submitted as r354832. It was
reverted in r354839 due to failures on the Windows CI builds.

This version fixes the test failures on Windows, which were caused by
differences in template expansion between versions of clang on different
OSes. The version of clang built with MSVC and running on Windows never
expands the template in the C++ test in ImportExpr.ImportChooseExpr in
clang/unittests/AST/ASTImporter.cpp, but the version on Linux does for
the empty arguments and -fms-compatibility.

So, this version of the patch drops the C++ test for
__builtin_choose_expr, since that version was written to catch
regressions of the logic for isConditionTrue() in the AST import code
for ChooseExpr, and those regressions are also caught by
ASTImporterOptionSpecificTestBase.ImportChooseExpr, which does work on
Windows.

Reviewers: shafik, a_sidorin, martong, aaron.ballman, rnk, a.sidorin

Subscribers: cfe-commits, jdoerfert, rnkovacs, aaron.ballman

Tags: #clang

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

llvm-svn: 354916

5 years ago[X86] Add 'znver2' and 'cascadelake' to the __builtin_cpu_is test.
Craig Topper [Tue, 26 Feb 2019 19:20:04 +0000 (19:20 +0000)]
[X86] Add 'znver2' and 'cascadelake' to the __builtin_cpu_is test.

These are supported by at least libgcc trunk so we can include them now.

llvm-svn: 354915

5 years agoMention predicting exception catch at throw site
Jim Ingham [Tue, 26 Feb 2019 19:18:09 +0000 (19:18 +0000)]
Mention predicting exception catch at throw site

llvm-svn: 354914

5 years ago[X86] Use X86_CPU_SUBTYPE_COMPAT for 'cascadelake' cpu.
Craig Topper [Tue, 26 Feb 2019 19:17:12 +0000 (19:17 +0000)]
[X86] Use X86_CPU_SUBTYPE_COMPAT for 'cascadelake' cpu.

This CPU is supported by at least libgcc trunk now so we should make it available to __builtin_cpu_is.

llvm-svn: 354913

5 years ago[lit] Allow setting parallelism groups to None
Julian Lettner [Tue, 26 Feb 2019 19:03:26 +0000 (19:03 +0000)]
[lit] Allow setting parallelism groups to None

Check that we do not crash if a parallelism group is explicitly set to
None. Permits usage of the following pattern.

[lit.common.cfg]
  lit_config.parallelism_groups['my_group'] = None
  if <condition>:
    lit_config.parallelism_groups['my_group'] = 3

[project/lit.cfg]
  config.parallelism_group = 'my_group'

Reviewers: rnk

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

llvm-svn: 354912

5 years agoUpdate docs of memcpy/move/set wrt. align and len
Kristina Brooks [Tue, 26 Feb 2019 18:53:13 +0000 (18:53 +0000)]
Update docs of memcpy/move/set wrt. align and len

Fix https://bugs.llvm.org/show_bug.cgi?id=38583: Describe
how memcpy/memmove/memset behave when len=0. Also fix
some fallout from when the alignment parameter was
replaced by an attribute.

This closes PR38583.

Patch by RalfJung (Ralf)

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

llvm-svn: 354911

5 years ago[TableGen] Make OpcodeMappings sort comparator deterministic NFCI
Andrew Ng [Tue, 26 Feb 2019 18:50:49 +0000 (18:50 +0000)]
[TableGen] Make OpcodeMappings sort comparator deterministic NFCI

The previous sort comparator was not deterministic, i.e. in some
situations it would be possible for lhs < rhs && rhs < lhs. This was
discovered by an STL assertion in a Windows debug build of llvm-tblgen.

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

llvm-svn: 354910

5 years ago[AMDGPU] Allow using integral non-type template parameters
Michael Liao [Tue, 26 Feb 2019 18:49:36 +0000 (18:49 +0000)]
[AMDGPU] Allow using integral non-type template parameters

Summary:
- Allow using integral non-type template parameters in the following
  attributes

  __attribute__((amdgpu_flat_work_group_size(<min>, <max>)))
  __attribute__((amdgpu_waves_per_eu(<min>[, <max>])))

Reviewers: kzhuravl, yaxunl

Subscribers: jvesely, wdng, nhaehnle, dstuttard, tpr, t-tye, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 354909

5 years agoFixed a minor merge error with this patch.
Mitch Phillips [Tue, 26 Feb 2019 18:41:55 +0000 (18:41 +0000)]
Fixed a minor merge error with this patch.

llvm-svn: 354908

5 years ago[compiler-rt] Provide better llvm-lit failure when llvm-config fails.
Mitch Phillips [Tue, 26 Feb 2019 18:41:54 +0000 (18:41 +0000)]
[compiler-rt] Provide better llvm-lit failure when llvm-config fails.

Summary:
The current error message can cause confusion if llvm-config can't be
executed for reasons other than "not found". In my example, cross
compiling generated an llvm-config binary for aarch64 which couldn't be
executed natively. Instead of telling me that the error was with the
file architecture, it reports the file as not being present.

Reviewers: pcc

Subscribers: dberris, javed.absar, kristof.beyls, jdoerfert, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 354907

5 years agoRevert "[compiler-rt] Intercept the bcmp() function."
Vlad Tsyrklevich [Tue, 26 Feb 2019 18:28:15 +0000 (18:28 +0000)]
Revert "[compiler-rt] Intercept the bcmp() function."

This reverts commits r354851, 354852, 354853 and r354888. They were
causing build failures on the android sanitizer bot.

llvm-svn: 354906

5 years ago[InstSimplify] remove zero-shift-guard fold for general funnel shift
Sanjay Patel [Tue, 26 Feb 2019 18:26:56 +0000 (18:26 +0000)]
[InstSimplify] remove zero-shift-guard fold for general funnel shift

As discussed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2019-February/130491.html

We can't remove the compare+select in the general case because
we are treating funnel shift like a standard instruction (as
opposed to a special instruction like select/phi).

That means that if one of the operands of the funnel shift is
poison, the result is poison regardless of whether we know that
the operand is actually unused based on the instruction's
particular semantics.

The motivating case for this transform is the more specific
rotate op (rather than funnel shift), and we are preserving the
fold for that case because there is no chance of introducing
extra poison when there is no anonymous extra operand to the
funnel shift.

llvm-svn: 354905

5 years agoRemove P1272R1, it was not moved in Kona
Marshall Clow [Tue, 26 Feb 2019 18:17:30 +0000 (18:17 +0000)]
Remove P1272R1, it was not moved in Kona

llvm-svn: 354904

5 years ago[clang-tidy] undo bitfields in ExceptionAnalyzer
Jonas Toth [Tue, 26 Feb 2019 18:15:17 +0000 (18:15 +0000)]
[clang-tidy] undo bitfields in ExceptionAnalyzer

Scoped enums do induce some problems with some MSVC and GCC versions
if used as bitfields. Therefor this is deactivated for now.

llvm-svn: 354903

5 years ago[libFuzzer] Remove extra semicolons
Jonathan Metzman [Tue, 26 Feb 2019 17:46:13 +0000 (17:46 +0000)]
[libFuzzer] Remove extra semicolons

Summary:
Remove extra semicolons so that libFuzzer can compile with
-Werror -Wextra-semi

Reviewers: Dor1s, morehouse, thakis

Reviewed By: Dor1s, morehouse

Subscribers: jdoerfert, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 354902

5 years agoPut a 'first implemented' version into the entry for P1357
Marshall Clow [Tue, 26 Feb 2019 17:22:47 +0000 (17:22 +0000)]
Put a 'first implemented' version into the entry for P1357

llvm-svn: 354901

5 years ago[MIPS GlobalISel] Select G_UADDO
Petar Avramovic [Tue, 26 Feb 2019 17:22:42 +0000 (17:22 +0000)]
[MIPS GlobalISel] Select G_UADDO

Lower G_UADDO.
Legalize G_UADDO for MIPS32

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

llvm-svn: 354900

5 years ago[X86] AMD znver2 enablement
Ganesh Gopalasubramanian [Tue, 26 Feb 2019 17:15:36 +0000 (17:15 +0000)]
[X86] AMD znver2 enablement

This patch enables the following

1) AMD family 17h "znver2" tune flag (-march, -mcpu).
2) ISAs that are enabled for "znver2" architecture.
3) For the time being, it uses the znver1 scheduler model.
4) Tests are updated.
5) This patch is the clang counterpart to D58343

Reviewers: craig.topper
Tags: #clang

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

llvm-svn: 354899

5 years agoMark several issues (and one paper) as complete. Reviewed as D58099; but I added...
Marshall Clow [Tue, 26 Feb 2019 17:01:00 +0000 (17:01 +0000)]
Mark several issues (and one paper) as complete. Reviewed as D58099; but I added LWG3101 and LWG3144 and P1357R1 as well.

llvm-svn: 354898

5 years ago[X86] AMD znver2 enablement
Ganesh Gopalasubramanian [Tue, 26 Feb 2019 16:55:10 +0000 (16:55 +0000)]
[X86] AMD znver2 enablement

This patch enables the following

1) AMD family 17h "znver2" tune flag (-march, -mcpu).
2) ISAs that are enabled for "znver2" architecture.
3) For the time being, it uses the znver1 scheduler model.
4) Tests are updated.
5) Scheduler descriptions are yet to be put in place.

Reviewers: craig.topper

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

llvm-svn: 354897

5 years ago[SystemZ] Wait with selection of legal vector/FP constants until Select().
Jonas Paulsson [Tue, 26 Feb 2019 16:47:59 +0000 (16:47 +0000)]
[SystemZ]  Wait with selection of legal vector/FP constants until Select().

This patch aims to make sure that any such constant that can be generated
with a vector instruction (for example VGBM) is recognized as such during
legalization and kept as a target independent node through post-legalize
DAGCombining.

Two new functions named isVectorConstantLegal() and loadVectorConstant()
replace old ways of handling vector/FP constants.

A new struct named SystemZVectorConstantInfo is used to cache the results of
isVectorConstantLegal() and pass them onto loadVectorConstant().

Support for fp128 constants in the presence of FeatureVectorEnhancements1
(z14) has been added.

Review: Ulrich Weigand
https://reviews.llvm.org/D58270

llvm-svn: 354896

5 years ago[scudo][standalone] Introduce platform specific code & mutexes
Kostya Kortchinsky [Tue, 26 Feb 2019 16:47:25 +0000 (16:47 +0000)]
[scudo][standalone] Introduce platform specific code & mutexes

Summary:
This CL adds the platform specific code for Fuchsia, Linux & Android,
as well as some tests related to those (more tests to come later).
While some of it is pretty much a straight port of the existing scudo &
sanitizer_common code, the memory mapping functions have been reworked
a bit to fit the limited usage scenario that Scudo has for them.

For Fuchsia, I can now track the Vmar/Vmo pair for memory mappings if
there is an intent to grow or decommit some mapping (that will be
useful for the Primary).

Reviewers: eugenis, vitalybuka, mcgrathr, phosek, flowerhack, morehouse, dmmoore415

Reviewed By: vitalybuka, morehouse

Subscribers: kcc, dvyukov, srhines, mgorny, delcypher, jfb, jdoerfert, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 354895

5 years ago[InstSimplify] add tests for rotate; NFC
Sanjay Patel [Tue, 26 Feb 2019 16:44:08 +0000 (16:44 +0000)]
[InstSimplify] add tests for rotate; NFC

Rotate is a special-case of funnel shift that has different
poison constraints than the general case. That's not visible
yet in the existing tests, but it needs to be corrected.

llvm-svn: 354894

5 years ago[OpenCL] Fix assertion due to blocks
Yaxun Liu [Tue, 26 Feb 2019 16:20:41 +0000 (16:20 +0000)]
[OpenCL] Fix assertion due to blocks

A recent change caused assertion in CodeGenFunction::EmitBlockCallExpr when a block is called.

There is code

  Func = CGM.getOpenCLRuntime().getInvokeFunction(E->getCallee());
getCalleeDecl calls Expr::getReferencedDeclOfCallee, which does not handle
BlockExpr and returns nullptr, which causes isa to assert.

This patch fixes that.

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

llvm-svn: 354893

5 years agoImplement P1357: Traits for [Un]bounded Arrays; adopted in Kona
Marshall Clow [Tue, 26 Feb 2019 16:07:03 +0000 (16:07 +0000)]
Implement P1357: Traits for [Un]bounded Arrays; adopted in Kona

llvm-svn: 354891

5 years agoFix short options syntax in Minidump test
Tatyana Krasnukha [Tue, 26 Feb 2019 15:38:30 +0000 (15:38 +0000)]
Fix short options syntax in Minidump test

llvm-svn: 354890

5 years ago[InstCombine] remove duplicate (but not updated) tests; NFC
Sanjay Patel [Tue, 26 Feb 2019 15:25:42 +0000 (15:25 +0000)]
[InstCombine] remove duplicate (but not updated) tests; NFC

Not sure how it happened, but rL354886 was a duplicate of rL354881,
but not updated with rL354887.

llvm-svn: 354889

5 years ago[compiler-rt] Disable failing test on darwin during investigation.
Clement Courbet [Tue, 26 Feb 2019 15:25:04 +0000 (15:25 +0000)]
[compiler-rt] Disable failing test on darwin during investigation.

/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/projects/compiler-rt/test/asan/TestCases/Posix/bcmp_test.cc:14:12: error: CHECK: expected string not found in input
 // CHECK: {{#1.*bcmp}}
           ^
<stdin>:2:57: note: scanning from here
==34677==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffee93777c4 at pc 0x0001068a7285 bp 0x7ffee9377770 sp 0x7ffee9376ef8
                                                        ^
<stdin>:6:20: note: possible intended match here
 #2 0x106888e77 in main bcmp_test.cc:12
                   ^

llvm-svn: 354888

5 years ago[InstCombine] canonicalize more unsigned saturated add with 'not'
Sanjay Patel [Tue, 26 Feb 2019 15:18:49 +0000 (15:18 +0000)]
[InstCombine] canonicalize more unsigned saturated add with 'not'

Yet another pattern variation suggested by:
https://bugs.llvm.org/show_bug.cgi?id=14613

There are 8 more potential commuted patterns here on top of the
8 that were already handled (rL354221, rL354276, rL354393).
We have the obvious commute of the 'add' + commute of the cmp
predicate/operands (ugt/ult) + commute of the select operands:

Name: base
%notx = xor i32 %x, -1
%a = add i32 %notx, %y
%c = icmp ult i32 %x, %y
%r = select i1 %c, i32 -1, i32 %a
=>
%c2 = icmp ult i32 %a, %y
%r = select i1 %c2, i32 -1, i32 %a

Name: ugt
%notx = xor i32 %x, -1
%a = add i32 %notx, %y
%c = icmp ugt i32 %y, %x
%r = select i1 %c, i32 -1, i32 %a
=>
%c2 = icmp ult i32 %a, %y
%r = select i1 %c2, i32 -1, i32 %a

Name: commute select
%notx = xor i32 %x, -1
%a = add i32 %notx, %y
%c = icmp ult i32 %y, %x
%r = select i1 %c, i32 %a, i32 -1
=>
%c2 = icmp ult i32 %a, %y
%r = select i1 %c2, i32 -1, i32 %a

Name: ugt + commute select
%notx = xor i32 %x, -1
%a = add i32 %notx, %y
%c = icmp ugt i32 %x, %y
%r = select i1 %c, i32 %a, i32 -1
=>
%c2 = icmp ult i32 %a, %y
%r = select i1 %c2, i32 -1, i32 %a

https://rise4fun.com/Alive/den

llvm-svn: 354887

5 years ago[InstCombine] add more tests for saturated add; NFC
Sanjay Patel [Tue, 26 Feb 2019 15:18:44 +0000 (15:18 +0000)]
[InstCombine] add more tests for saturated add; NFC

llvm-svn: 354886

5 years ago[libclang] Avoid crashing when getting layout info of an undeduced type.
Emilio Cobos Alvarez [Tue, 26 Feb 2019 15:04:18 +0000 (15:04 +0000)]
[libclang] Avoid crashing when getting layout info of an undeduced type.

When the type is not deducible, return an error instead of crashing.

This fixes https://bugs.llvm.org/show_bug.cgi?id=40813.

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

llvm-svn: 354885

5 years ago[DAG] Fix constant store folding to handle non-byte sizes.
Nirav Dave [Tue, 26 Feb 2019 15:02:32 +0000 (15:02 +0000)]
[DAG] Fix constant store folding to handle non-byte sizes.

Avoid crashes from zero-byte values due to sub-byte store sizes.

Reviewers: uabelho, courbet, rnk

Reviewed By: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 354884

5 years agoFix error handling in Options::Parse
Tatyana Krasnukha [Tue, 26 Feb 2019 14:50:40 +0000 (14:50 +0000)]
Fix error handling in Options::Parse

Moved `if (error.Fail())` to correct place to catch all faulty cases such as
"unknown or ambiguous option" which was ignored before.

llvm-svn: 354883

5 years ago[mips] Emit `.module softfloat` directive
Simon Atanasyan [Tue, 26 Feb 2019 14:45:17 +0000 (14:45 +0000)]
[mips] Emit `.module softfloat` directive

This change fixes crash on an assertion in case of using
`soft float` ABI for mips32r6 target.

llvm-svn: 354882

5 years ago[InstCombine] add more tests for saturated add; NFC
Sanjay Patel [Tue, 26 Feb 2019 14:40:23 +0000 (14:40 +0000)]
[InstCombine] add more tests for saturated add; NFC

llvm-svn: 354881

5 years ago[clang-format] SpaceBeforeParens for lambda expressions
Andrew Ng [Tue, 26 Feb 2019 14:34:49 +0000 (14:34 +0000)]
[clang-format] SpaceBeforeParens for lambda expressions

Add support for lambda expressions to the SpaceBeforeParens formatting
option.

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

llvm-svn: 354880