platform/upstream/llvm.git
5 years ago[GISel] Add parentheses to an assert because gcc is mean.
Craig Topper [Tue, 11 Dec 2018 22:07:06 +0000 (22:07 +0000)]
[GISel] Add parentheses to an assert because gcc is mean.

llvm-svn: 348900

5 years agoReplace Const-Member checking with non-recursive version.
Erich Keane [Tue, 11 Dec 2018 21:54:52 +0000 (21:54 +0000)]
Replace Const-Member checking with non-recursive version.

As reported in PR39946, these two implementations cause stack overflows
to occur when a type recursively contains itself.  While this only
happens when an incomplete version of itself is used by membership (and
thus an otherwise invalid program), the crashes might be surprising.

The solution here is to replace the recursive implementation with one
that uses a std::vector as a queue.  Old values are kept around to
prevent re-checking already checked types.

Change-Id: I582bb27147104763d7daefcfee39d91f408b9fa8
llvm-svn: 348899

5 years ago Revert "debuginfo: Use symbol difference for CU length to simplify assembly reading...
Jordan Rupprecht [Tue, 11 Dec 2018 21:26:52 +0000 (21:26 +0000)]
 Revert "debuginfo: Use symbol difference for CU length to simplify assembly reading/editing"

Temporarily reverts commit r348806 due to strange asm compilation issues in certain modes (combination of asan+cuda+other things). Will provide repro soon.

llvm-svn: 348898

5 years ago[coroutines] Improve suspend point simplification
Gor Nishanov [Tue, 11 Dec 2018 21:23:09 +0000 (21:23 +0000)]
[coroutines] Improve suspend point simplification

Summary:
Enable suspend point simplification for cases where:
* coro.save and coro.suspend are in different basic blocks
* where there are intervening intrinsics

Reviewers: modocache, tks2103, lewissbaker

Reviewed By: modocache

Subscribers: EricWF, llvm-commits

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

llvm-svn: 348897

5 years ago[Debuginfo] Prevent CodeGenPrepare from dropping debuginfo references.
Wolfgang Pieb [Tue, 11 Dec 2018 21:13:53 +0000 (21:13 +0000)]
[Debuginfo] Prevent CodeGenPrepare from dropping debuginfo references.

This fixes PR39845. CodeGenPrepare employs a transactional model when
performing optimizations, i.e. it changes the IR to attempt an optimization
and rolls back the change when it finds the change inadequate. It is during
the rollback that references to locals were dropped from debug value
intrinsics. This patch reinstates debuginfo references during rollbacks.

Reviewers: aprantl, vsk

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

llvm-svn: 348896

5 years ago[ConstantFolding] Handle leading zero-size elements in load folding
Nikita Popov [Tue, 11 Dec 2018 20:29:16 +0000 (20:29 +0000)]
[ConstantFolding] Handle leading zero-size elements in load folding

Struct types may have leading zero-size elements like [0 x i32], in
which case the "real" element at offset 0 will not necessarily coincide
with the 0th element of the aggregate. ConstantFoldLoadThroughBitcast()
wants to drill down the element at offset 0, but currently always picks
the 0th aggregate element to do so. This patch changes the code to find
the first non-zero-size element instead, for the struct case.

The motivation behind this change is https://github.com/rust-lang/rust/issues/48627.
Rust is fond of emitting [0 x iN] separators between struct elements to
enforce alignment, which prevents constant folding in this particular case.

The additional tests with [4294967295 x [0 x i32]] check that we don't
end up unnecessarily looping over a large number of zero-size elements
of a zero-size array.

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

llvm-svn: 348895

5 years ago[Driver] Simplify OptionData. NFC
Jonas Devlieghere [Tue, 11 Dec 2018 20:19:53 +0000 (20:19 +0000)]
[Driver] Simplify OptionData. NFC

Hopefully this makes the option data easier to understand and maintain.

 - Group the member variables.
 - Do the initialization in the header as it's less error prone.
 - Rename the Clean method. It was called only once and was
   re-initializing some but not all (?) members. The only useful thing it
   does is dealing with the local lldbinit file so keep that and make the
   name reflect that.

llvm-svn: 348894

5 years ago[GISel]: Add MachineIRBuilder support for passing in Flags while building
Aditya Nandakumar [Tue, 11 Dec 2018 20:04:40 +0000 (20:04 +0000)]
[GISel]: Add MachineIRBuilder support for passing in Flags while building

https://reviews.llvm.org/D55516

Add the ability to pass in flags to buildInstr calls. Currently no
validation is performed but that can be easily performed based on the
opcode (if necessary).

Reviewed by: paquette.

llvm-svn: 348893

5 years agoRevert r348889; it fails some tests.
Aaron Ballman [Tue, 11 Dec 2018 19:42:04 +0000 (19:42 +0000)]
Revert r348889; it fails some tests.

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/40784

llvm-svn: 348892

5 years agoStop stripping comments from AST matcher example code.
Aaron Ballman [Tue, 11 Dec 2018 19:30:49 +0000 (19:30 +0000)]
Stop stripping comments from AST matcher example code.

The AST matcher documentation dumping script was being a bit over-zealous about stripping comment markers, which ended up causing comments in example code to stop being comments. Fix that by only stripping comments at the start of a line, rather than removing any forward slash (which also impacts prose text).

llvm-svn: 348891

5 years agoAdd ObjectFileBreakpad.{cpp,h} to the Xcode project.
Jim Ingham [Tue, 11 Dec 2018 19:25:03 +0000 (19:25 +0000)]
Add ObjectFileBreakpad.{cpp,h} to the Xcode project.

llvm-svn: 348890

5 years agoEmit -Wformat properly for bit-field promotions.
Aaron Ballman [Tue, 11 Dec 2018 19:18:01 +0000 (19:18 +0000)]
Emit -Wformat properly for bit-field promotions.

Only explicitly look through integer and floating-point promotion where the result type is actually a promotion, which is not always the case for bit-fields in C.

llvm-svn: 348889

5 years ago[Sanitizer] Expand FSEEK interception to FreeBSD
David Carlier [Tue, 11 Dec 2018 19:08:40 +0000 (19:08 +0000)]
[Sanitizer] Expand FSEEK interception to FreeBSD

Reviewers: krytarowski

Reviewed By: krytarowski

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

llvm-svn: 348888

5 years ago[NewPM] fixing asserts on deleted loop in -print-after-all
Fedor Sergeev [Tue, 11 Dec 2018 19:05:35 +0000 (19:05 +0000)]
[NewPM] fixing asserts on deleted loop in -print-after-all

IR-printing AfterPass instrumentation might be called on a loop
that has just been invalidated. We should skip printing it to
avoid spurious asserts.

Reviewed By: chandlerc, philip.pfaffe
Differential Revision: https://reviews.llvm.org/D54740

llvm-svn: 348887

5 years ago[runtime] Disable KMP_HAVE_QUAD on NetBSD gcc
Michal Gorny [Tue, 11 Dec 2018 19:02:14 +0000 (19:02 +0000)]
[runtime] Disable KMP_HAVE_QUAD on NetBSD gcc

Disable KMP_HAVE_QUAD when building via gcc on NetBSD system,
as the build fails due to unimplemented builtins:

  .../kmp_atomic.cpp.o: In function `__kmpc_atomic_cmplx16_mul':
  .../kmp_atomic.cpp:1332: undefined reference to `__multc3'
  .../kmp_atomic.cpp.o: In function `__kmpc_atomic_cmplx16_div':
  .../kmp_atomic.cpp:1334: undefined reference to `__divtc3'
  ...

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

llvm-svn: 348886

5 years ago[runtime] Use getloadavg() on NetBSD as well
Michal Gorny [Tue, 11 Dec 2018 19:02:09 +0000 (19:02 +0000)]
[runtime] Use getloadavg() on NetBSD as well

Switch NetBSD from reading /proc (which is broken) to getloadavg()
(which is already used by Darwin).  NetBSD discourages using procfs
in favor of system API calls.

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

llvm-svn: 348885

5 years ago[analyzer][CStringChecker] evaluate explicit_bzero
David Carlier [Tue, 11 Dec 2018 18:57:07 +0000 (18:57 +0000)]
[analyzer][CStringChecker] evaluate explicit_bzero

- explicit_bzero has limited scope/usage only for security/crypto purposes but is non-optimisable version of memset/0 and bzero.
- explicit_memset has similar signature and semantics as memset but is also a non-optimisable version.

Reviewers: NoQ

Reviewed By: NoQ

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

llvm-svn: 348884

5 years ago[COFF, ARM64] Emit COFF function header
Mandeep Singh Grang [Tue, 11 Dec 2018 18:36:14 +0000 (18:36 +0000)]
[COFF, ARM64] Emit COFF function header

Summary:
Emit COFF header when printing out the function. This is important as the
header contains two important pieces of information: the storage class for the
symbol and the symbol type information. This bit of information is required for
the linker to correctly identify the type of symbol that it is dealing with.

This patch mimics X86 and ARM COFF behavior for function header emission.

Reviewers: rnk, mstorsjo, compnerd, TomTan, ssijaric

Reviewed By: mstorsjo

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

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

llvm-svn: 348875

5 years agoImplement __kmp_is_address_mapped() for NetBSD
Kamil Rytarowski [Tue, 11 Dec 2018 18:35:07 +0000 (18:35 +0000)]
Implement __kmp_is_address_mapped() for NetBSD

Summary:
Use the sysctl(3) function to check whether an address is mapped
into the address space.

Reviewers: mgorny, joerg, #openmp

Reviewed By: mgorny

Subscribers: openmp-commits

Tags: #openmp

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

llvm-svn: 348874

5 years agoImplement __kmp_gettid() for NetBSD
Kamil Rytarowski [Tue, 11 Dec 2018 18:34:33 +0000 (18:34 +0000)]
Implement __kmp_gettid() for NetBSD

Summary: _lwp_self() returns current Thread Id in a numeric version on NetBSD.

Reviewers: joerg, mgorny, #openmp

Reviewed By: mgorny

Subscribers: llvm-commits, openmp-commits, #openmp

Tags: #openmp

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

llvm-svn: 348873

5 years ago[test] Permit NetBSD in filesystem_dynamic_test_helper.py
Michal Gorny [Tue, 11 Dec 2018 18:29:35 +0000 (18:29 +0000)]
[test] Permit NetBSD in filesystem_dynamic_test_helper.py

llvm-svn: 348872

5 years ago[libcxx] Only enable the availability LIT feature when we're testing libc++
Louis Dionne [Tue, 11 Dec 2018 18:05:38 +0000 (18:05 +0000)]
[libcxx] Only enable the availability LIT feature when we're testing libc++

Other standard libraries don't implement availability markup, so it doesn't
make sense to e.g. XFAIL tests based on availability markup outside of
libc++.

llvm-svn: 348871

5 years ago[HotColdSplitting] Disable outlining landingpad instructions (PR39917)
Vedant Kumar [Tue, 11 Dec 2018 18:05:31 +0000 (18:05 +0000)]
[HotColdSplitting] Disable outlining landingpad instructions (PR39917)

It's currently not safe to outline landingpad instructions (see
llvm.org/PR39917). Like @llvm.eh.typeid.for, the order and content of
previous landingpad instructions in a function alters the lowering of
subsequent landingpads by renumbering type info ID's. Outlining a
landingpad therefore breaks exception handling & unwinding.

llvm-svn: 348870

5 years ago[XRay] Add a helper function sortByKey to simplify code
Fangrui Song [Tue, 11 Dec 2018 17:34:15 +0000 (17:34 +0000)]
[XRay] Add a helper function sortByKey to simplify code

Reviewers: dberris, mboerger

Reviewed By: dberris

Subscribers: mgrang, llvm-commits

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

llvm-svn: 348869

5 years ago[libcxx] Remove the no_default_flags LIT configuration
Louis Dionne [Tue, 11 Dec 2018 17:29:55 +0000 (17:29 +0000)]
[libcxx] Remove the no_default_flags LIT configuration

This is part of an ongoing cleanup of the LIT test suite, where I'm
trying to reduce the number of configuration options. In this case,
the original intent seemed to be running the test suite with libstdc++,
but this is now supported by specifying cxx_stdlib_under_test=libstdc++.

llvm-svn: 348868

5 years ago[NFC] Fix incorrect (but unreachable) LIT error message
Louis Dionne [Tue, 11 Dec 2018 17:05:20 +0000 (17:05 +0000)]
[NFC] Fix incorrect (but unreachable) LIT error message

It is unreachable because we test that the cxx_stdlib_under_test is
in the supported set of libraries elsewhere. Furthermore, this code
relied on the `use_stdlib_type`, which is never defined.

llvm-svn: 348867

5 years agoRemove CGDebugInfo::getOrCreateFile() and use TheCU->getFile() directly.
Adrian Prantl [Tue, 11 Dec 2018 16:58:46 +0000 (16:58 +0000)]
Remove CGDebugInfo::getOrCreateFile() and use TheCU->getFile() directly.

llvm-svn: 348866

5 years agoReuse code from CGDebugInfo::getOrCreateFile() when creating the file
Adrian Prantl [Tue, 11 Dec 2018 16:58:43 +0000 (16:58 +0000)]
Reuse code from CGDebugInfo::getOrCreateFile() when creating the file
for the DICompileUnit.

This addresses post-commit feedback for D55085. Without this patch, a
main source file with an absolute paths may appear in different
DIFiles, once with the absolute path and once with the common prefix
between the absolute path and the current working directory.

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

llvm-svn: 348865

5 years agoPass PartialOverloading argument to the correct corresponding parameter
Eric Fiselier [Tue, 11 Dec 2018 16:53:25 +0000 (16:53 +0000)]
Pass PartialOverloading argument to the correct corresponding parameter

llvm-svn: 348864

5 years ago[ASan] Minor documentation fix: clarify static linking limitation.
Max Moroz [Tue, 11 Dec 2018 16:47:12 +0000 (16:47 +0000)]
[ASan] Minor documentation fix: clarify static linking limitation.

Summary:
ASan does not support statically linked binaries, but ASan runtime itself can
be statically linked into a target binary executable.

Reviewers: eugenis, kcc

Reviewed By: eugenis

Subscribers: cfe-commits, llvm-commits

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

llvm-svn: 348863

5 years ago[InstCombine] try to convert x86 movmsk intrinsic to generic IR (PR39927)
Sanjay Patel [Tue, 11 Dec 2018 16:38:03 +0000 (16:38 +0000)]
[InstCombine] try to convert x86 movmsk intrinsic to generic IR (PR39927)

call iM movmsk(sext <N x i1> X) --> zext (bitcast <N x i1> X to iN) to iM

This has the potential to create less-than-8-bit scalar types as shown in
some of the test diffs, but it looks like the backend knows how to deal
with that in these patterns. This is the simple part of the fix suggested in:
https://bugs.llvm.org/show_bug.cgi?id=39927

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

llvm-svn: 348862

5 years ago[BDCE] Add tests for PR39771; NFC
Nikita Popov [Tue, 11 Dec 2018 16:37:26 +0000 (16:37 +0000)]
[BDCE] Add tests for PR39771; NFC

These involve cases where certain uses are dead by means of having
no demanded bits, even though the used instruction still has demanded
bits when other uses are taken into account. BDCE currently does not
simplify such cases.

llvm-svn: 348861

5 years agoAdding tests for -ast-dump; NFC.
Aaron Ballman [Tue, 11 Dec 2018 16:34:59 +0000 (16:34 +0000)]
Adding tests for -ast-dump; NFC.

This adds tests for expressions in C++.

llvm-svn: 348860

5 years ago[llvm-readelf] Add -e/--headers support to readobj/elf
Sid Manning [Tue, 11 Dec 2018 16:15:03 +0000 (16:15 +0000)]
[llvm-readelf] Add -e/--headers support to readobj/elf

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

llvm-svn: 348859

5 years agoRevert "[PowerPC] Make no-PIC default to match GCC - CLANG"
Stefan Pintilie [Tue, 11 Dec 2018 15:47:57 +0000 (15:47 +0000)]
Revert "[PowerPC] Make no-PIC default to match GCC - CLANG"

This reverts commit rL348299.

llvm-svn: 348858

5 years ago[test] [runtime] Permit omp_get_wtick() to return 0.01
Michal Gorny [Tue, 11 Dec 2018 15:39:34 +0000 (15:39 +0000)]
[test] [runtime] Permit omp_get_wtick() to return 0.01

Increase the range for omp_get_wtick() test to allow for 0.01
(from <0.01).  This is needed for NetBSD where it returns exactly that
value due to CLOCKS_PER_SEC being 100.  This should not cause
a significant difference from e.g. FreeBSD where it is 128,
and especially from Linux where CLOCKS_PER_SEC is apparently meaningless
and sysconf(_SC_CLK_TCK) gives 100 as well.

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

llvm-svn: 348857

5 years ago[test] [runtime] Do not include alloca.h on NetBSD
Michal Gorny [Tue, 11 Dec 2018 15:39:30 +0000 (15:39 +0000)]
[test] [runtime] Do not include alloca.h on NetBSD

On NetBSD, alloca() is in stdlib.h and there is no alloca.h.  Adjust
the includes appopriately.

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

llvm-svn: 348856

5 years ago[runtime] [test] Use more portable short options to sort(1)
Michal Gorny [Tue, 11 Dec 2018 15:39:26 +0000 (15:39 +0000)]
[runtime] [test] Use more portable short options to sort(1)

Pass `-n -s` instead of `--numeric --stable` to sort(1), as long options
are not supported by NetBSD sort implementation.  `-n` is defined
by POSIX, so it should be fully portable.  `-s` is used consistently
at least in GNU sort and FreeBSD sort, and I honestly doubt it would
cause issues with any other implementation supporting `--stable`.

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

llvm-svn: 348855

5 years ago[cmake] Use -std=gnu++11 to fix alloca() on NetBSD
Michal Gorny [Tue, 11 Dec 2018 15:39:22 +0000 (15:39 +0000)]
[cmake] Use -std=gnu++11 to fix alloca() on NetBSD

Prefer using '-std=gnu++11' over '-std=c++11' when available, as NetBSD
exposes the correct alloca() implementation only with gnu* C/C++
standards.

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

llvm-svn: 348854

5 years agoFix not correct imm operand assertion for SUB32ri in X86CondBrFolding::analyzeCompare
Craig Topper [Tue, 11 Dec 2018 15:32:14 +0000 (15:32 +0000)]
Fix not correct imm operand assertion for SUB32ri in X86CondBrFolding::analyzeCompare

Summary:
When doing X86CondBrFolding::analyzeCompare, it will meet the SUB32ri instruction as below to use the global address for its operand,
  %733:gr32 = SUB32ri %62:gr32(tied-def 0), @img2buf_normal, implicit-def $eflags
  JNE_1 %bb.41, implicit $eflags

so the assertion "assert(MI.getOperand(ValueIndex).isImm() && "Expecting Imm operand")" is not correct and change the assert to if make X86CondBrFolding::analyzeCompare return false as not finding the compare for this

Patch by Jianping Chen

Reviewers: smaslov, LuoYuanke, liutianle, Jianping

Reviewed By: Jianping

Subscribers: lebedev.ri, llvm-commits

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

llvm-svn: 348853

5 years ago[cmake] Rename append_if to avoid collision with LLVM
Michal Gorny [Tue, 11 Dec 2018 15:30:04 +0000 (15:30 +0000)]
[cmake] Rename append_if to avoid collision with LLVM

Rename the 'append_if' macro used in libunwind to 'unwind_append_if'.
Otherwise, when used in a combined LLVM+libunwind build, it overrides
the *incompatible* 'append_if' function from LLVM and breaks projects
following libunwind, e.g. OpenMP.

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

llvm-svn: 348852

5 years ago[x86] clean up code for converting 16-bit ops to LEA; NFC
Sanjay Patel [Tue, 11 Dec 2018 15:29:40 +0000 (15:29 +0000)]
[x86] clean up code for converting 16-bit ops to LEA; NFC

As discussed in D55494, we want to extend this to handle 8-bit
ops too, but that could be extended further to enable this on
32-bit systems too.

llvm-svn: 348851

5 years ago[libcxx] Fix test failure on GCC 4.9
Louis Dionne [Tue, 11 Dec 2018 15:27:10 +0000 (15:27 +0000)]
[libcxx] Fix test failure on GCC 4.9

GCC 4.9 seems to think that a constexpr default constructor implies
the constructor to be noexcept.

llvm-svn: 348850

5 years agoRename ObjectFile::GetHeaderAddress to GetBaseAddress
Pavel Labath [Tue, 11 Dec 2018 15:21:15 +0000 (15:21 +0000)]
Rename ObjectFile::GetHeaderAddress to GetBaseAddress

Summary:
This function was named such because in the case of MachO files, the
mach header is located at this address. However all (most?) usages of
this function were not interested in that fact, but the fact that this
address is used as the base address for expressing various relative
addresses in the object file.

For other object file formats, this name is not appropriate (and it's
probably the reason why this function was not implemented in these
classes). In the ELF case the ELF header will usually end up at this
address, but this is a result of the linker optimizing the file layout
and not a requirement of the spec. For COFF files, I believe the is no
header located at this address either.

Reviewers: clayborg, jasonmolenda, amccarth, lemo, stella.stamenova

Subscribers: lldb-commits

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

llvm-svn: 348849

5 years ago[analyzer] Fix a minor typo.
Gabor Horvath [Tue, 11 Dec 2018 14:40:48 +0000 (14:40 +0000)]
[analyzer] Fix a minor typo.

llvm-svn: 348848

5 years ago[pair] Mark constructors as conditionally noexcept
Louis Dionne [Tue, 11 Dec 2018 14:22:28 +0000 (14:22 +0000)]
[pair] Mark constructors as conditionally noexcept

Summary:
std::tuple marks its constructors as noexcept when the corresponding
memberwise constructors are noexcept too -- this commit improves std::pair
so that it behaves the same.

This is a re-application of r348824, which broke the build in C++03 mode
because a test was marked as supported in C++03 when it shouldn't be.

Note:
I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)`
constructors because those are non-standard extensions, and supporting them
properly is tedious (we have to copy the rvalue-referenceness of the deduced
_Tuple&& onto the result of tuple_element).

<rdar://problem/29537079>

Reviewers: mclow.lists, EricWF

Subscribers: christof, llvm-commits

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

llvm-svn: 348847

5 years ago[libcxx] Fix test on compilers that do not support char8_t yet
Louis Dionne [Tue, 11 Dec 2018 14:15:54 +0000 (14:15 +0000)]
[libcxx] Fix test on compilers that do not support char8_t yet

llvm-svn: 348846

5 years ago[x86] remove dead code for 16-bit LEA formation; NFC
Sanjay Patel [Tue, 11 Dec 2018 14:05:03 +0000 (14:05 +0000)]
[x86] remove dead code for 16-bit LEA formation; NFC

As discussed in:
D55494
...this code has been disabled/dead for a long time (the code references
Athlon and Pentium 4), and there's almost no chance that it will be used
given the last decade of uarch evolution. Also, in SDAG we promote 16-bit
ops to 32-bit, so there's almost no way to test this code any more.

llvm-svn: 348845

5 years agoRevert r348843 "[CodeGen] Allow mempcy/memset to generate small overlapping stores."
Clement Courbet [Tue, 11 Dec 2018 13:38:43 +0000 (13:38 +0000)]
Revert r348843 "[CodeGen] Allow mempcy/memset to generate small overlapping stores."

Breaks ARM/memcpy-inline.ll

llvm-svn: 348844

5 years ago[CodeGen] Allow mempcy/memset to generate small overlapping stores.
Clement Courbet [Tue, 11 Dec 2018 13:15:56 +0000 (13:15 +0000)]
[CodeGen] Allow mempcy/memset to generate small overlapping stores.

Summary:
All targets either just return false here or properly model `Fast`, so I
don't think there is any reason to prevent CodeGen from doing the right
thing here.

Subscribers: nemanjai, javed.absar, eraman, jsji, llvm-commits

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

llvm-svn: 348843

5 years agoUse the standard Duration factory matcher
Jonas Toth [Tue, 11 Dec 2018 12:45:51 +0000 (12:45 +0000)]
Use the standard Duration factory matcher

Summary: A new check came in over the weekend; it should use our existing infrastructure for matching `absl::Duration` factories.

Patch by hwright.

Reviewers: JonasToth

Reviewed By: JonasToth

Subscribers: astrelni

Tags: #clang-tools-extra

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

llvm-svn: 348842

5 years agoFix bug where we'd try symbolize a second time with the same arguments.
Dan Liew [Tue, 11 Dec 2018 12:43:44 +0000 (12:43 +0000)]
Fix bug where we'd try symbolize a second time with the same arguments.

Summary:
Fix bug where we'd try symbolize a second time with the same arguments even though symbolization failed the first time.

This looks like a long standing typo given that the guard for trying
symbolization again is to only try it if symbolization failed using
`binary` and `original_binary != binary`.

Reviewers: kubamracek, glider, samsonov

Subscribers: #sanitizers, llvm-commits

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

llvm-svn: 348841

5 years ago[clang-tidy] NFC Consolidate test absl::Time implementation
Jonas Toth [Tue, 11 Dec 2018 12:42:17 +0000 (12:42 +0000)]
[clang-tidy] NFC Consolidate test absl::Time implementation

Summary: Several tests re-implement these same prototypes (differently), so we can put them in a common location.

Patch by hwright.

Reviewers: JonasToth

Reviewed By: JonasToth

Tags: #clang-tools-extra

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

llvm-svn: 348840

5 years ago[TargetLowering] Add ISD::EXTRACT_VECTOR_ELT support to SimplifyDemandedBits
Simon Pilgrim [Tue, 11 Dec 2018 11:08:40 +0000 (11:08 +0000)]
[TargetLowering] Add ISD::EXTRACT_VECTOR_ELT support to SimplifyDemandedBits

Let SimplifyDemandedBits attempt to simplify all elements of a vector extraction.

Part of PR39689.

llvm-svn: 348839

5 years agoFix "not all control paths return a value" MSVC warnings. NFCI.
Simon Pilgrim [Tue, 11 Dec 2018 10:44:54 +0000 (10:44 +0000)]
Fix "not all control paths return a value" MSVC warnings. NFCI.

llvm-svn: 348838

5 years ago[DeadArgElim] Fixes for dbg.values using dead arg/return values
David Stenberg [Tue, 11 Dec 2018 10:33:38 +0000 (10:33 +0000)]
[DeadArgElim] Fixes for dbg.values using dead arg/return values

Summary:
When eliminating a dead argument or return value in a function with
local linkage, all uses, including in dbg.value intrinsics, would be
replaced with null constants. This would mean that, for example for an
integer argument, the debug info would incorrectly express that the
value is 0. Instead, replace all uses with undef to indicate that the
argument/return value is optimized out.

Also, make sure that metadata uses of return values are rewritten even
if there are no non-metadata uses of the value.

As a bit of historical curiosity, the code that emitted null constants
was introduced in the initial check-in of the pass in 2003, before
'undef' values even existed in LLVM.

This fixes PR23260.

Reviewers: dblaikie, aprantl, vsk, djtodoro

Reviewed By: aprantl

Subscribers: llvm-commits

Tags: #debug-info

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

llvm-svn: 348837

5 years ago[SEH] Zero-initialize EXCEPTION_RECORD and UNWIND_HISTORY_TABLE before calling RtlUnw...
Martin Storsjo [Tue, 11 Dec 2018 09:53:11 +0000 (09:53 +0000)]
[SEH] Zero-initialize EXCEPTION_RECORD and UNWIND_HISTORY_TABLE before calling RtlUnwindEx

This fixes PR39935.

llvm-svn: 348836

5 years agoCleanup test case by removing unused attribute dso_local
Ranjeet Singh [Tue, 11 Dec 2018 09:32:49 +0000 (09:32 +0000)]
Cleanup test case by removing unused attribute dso_local

Attribute 'dso_local' generated in bitcode from compiling
original C file but isn't needed.

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

llvm-svn: 348835

5 years agoReland r348741 "[Sema] Further improvements to to static_assert diagnostics."
Clement Courbet [Tue, 11 Dec 2018 08:39:11 +0000 (08:39 +0000)]
Reland r348741 "[Sema] Further improvements to to static_assert diagnostics."

Fix a dangling reference to temporary, never return nullptr.

llvm-svn: 348834

5 years ago[X86] Switch the 64-bit mulx schedule test to use inline assembly.
Craig Topper [Tue, 11 Dec 2018 07:41:06 +0000 (07:41 +0000)]
[X86] Switch the 64-bit mulx schedule test to use inline assembly.

I'm not sure we should always prefer MULX over MUL. So making the MULX guaranteed with inline assembly.

llvm-svn: 348833

5 years agoDon't export assembly functions when function visibility annotations are disabled
Martin Storsjo [Tue, 11 Dec 2018 07:34:14 +0000 (07:34 +0000)]
Don't export assembly functions when function visibility annotations are disabled

Patch by Peiyuan Song!

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

llvm-svn: 348832

5 years agoRevert r348830 "[Sema]improve static_assert(!expr)"
Clement Courbet [Tue, 11 Dec 2018 07:28:00 +0000 (07:28 +0000)]
Revert r348830 "[Sema]improve static_assert(!expr)"

Submitted the wrong change.

llvm-svn: 348831

5 years ago[Sema]improve static_assert(!expr)
Clement Courbet [Tue, 11 Dec 2018 07:04:49 +0000 (07:04 +0000)]
[Sema]improve static_assert(!expr)

llvm-svn: 348830

5 years agoFix problems with char8_t stuff on compilers that don't support char8_t yet
Marshall Clow [Tue, 11 Dec 2018 06:06:49 +0000 (06:06 +0000)]
Fix problems with char8_t stuff on compilers that don't support char8_t yet

llvm-svn: 348829

5 years agoSecond part of P0482 - char8_t. Reviewed as https://reviews.llvm.org/D55308
Marshall Clow [Tue, 11 Dec 2018 04:35:44 +0000 (04:35 +0000)]
Second part of P0482 - char8_t. Reviewed as https://reviews.llvm.org/D55308

llvm-svn: 348828

5 years agoMove CodeGenOptions from Frontend to Basic
Richard Trieu [Tue, 11 Dec 2018 03:18:39 +0000 (03:18 +0000)]
Move CodeGenOptions from Frontend to Basic

Basic uses CodeGenOptions and should not depend on Frontend.

llvm-svn: 348827

5 years ago[PPC][NFC] store operands are dst not src
Martell Malone [Tue, 11 Dec 2018 03:14:56 +0000 (03:14 +0000)]
[PPC][NFC] store operands are dst not src

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

llvm-svn: 348826

5 years agoRevert "[pair] Mark constructors as conditionally noexcept"
Louis Dionne [Tue, 11 Dec 2018 02:32:46 +0000 (02:32 +0000)]
Revert "[pair] Mark constructors as conditionally noexcept"

This broke the tests on Linux. Reverting until I find out why the tests
are broken (tomorrow).

llvm-svn: 348825

5 years ago[pair] Mark constructors as conditionally noexcept
Louis Dionne [Tue, 11 Dec 2018 02:17:23 +0000 (02:17 +0000)]
[pair] Mark constructors as conditionally noexcept

Summary:
std::tuple marks its constructors as noexcept when the corresponding
memberwise constructors are noexcept too -- this commit improves std::pair
so that it behaves the same.

Note:
I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)`
constructors because those are non-standard extensions, and supporting them
properly is tedious (we have to copy the rvalue-referenceness of the deduced
_Tuple&& onto the result of tuple_element).

<rdar://problem/29537079>

Reviewers: mclow.lists, EricWF

Subscribers: christof, llvm-commits

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

llvm-svn: 348824

5 years ago[gn build] Add build files for AsmParser, MIRParser, IRReader, MCDisassembler, Vectorize
Nico Weber [Tue, 11 Dec 2018 02:09:32 +0000 (02:09 +0000)]
[gn build] Add build files for AsmParser, MIRParser, IRReader, MCDisassembler, Vectorize

These are all remaining build dependencies of llc, except for Target/X86 which
is in a separate patch at https://reviews.llvm.org/D55524

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

llvm-svn: 348823

5 years ago[analyzer] Remove memoization from RunLoopAutoreleaseLeakChecker
George Karpenkov [Tue, 11 Dec 2018 01:14:17 +0000 (01:14 +0000)]
[analyzer] Remove memoization from RunLoopAutoreleaseLeakChecker

Memoization dose not seem to be necessary, as other statement visitors
run just fine without it,
and in fact seems to be causing memory corruptions.
Just removing it instead of investigating the root cause.

rdar://45945002

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

llvm-svn: 348822

5 years ago[analyzer] Hack for backwards compatibility for options for RetainCountChecker.
George Karpenkov [Tue, 11 Dec 2018 01:13:58 +0000 (01:13 +0000)]
[analyzer] Hack for backwards compatibility for options for RetainCountChecker.

To be removed once the clients update.

llvm-svn: 348821

5 years ago[analyzer] Display a diagnostics when an inlined function violates its os_consumed...
George Karpenkov [Tue, 11 Dec 2018 01:13:40 +0000 (01:13 +0000)]
[analyzer] Display a diagnostics when an inlined function violates its os_consumed summary

This is currently a diagnostics, but might be upgraded to an error in the future,
especially if we introduce os_return_on_success attributes.

rdar://46359592

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

llvm-svn: 348820

5 years ago[analyzer] Resolve another bug where the name of the leaked object was not printed...
George Karpenkov [Tue, 11 Dec 2018 01:13:20 +0000 (01:13 +0000)]
[analyzer] Resolve another bug where the name of the leaked object was not printed properly

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

llvm-svn: 348819

5 years ago[WebAssembly] Add '.eventtype' directive support
Heejin Ahn [Tue, 11 Dec 2018 01:11:04 +0000 (01:11 +0000)]
[WebAssembly] Add '.eventtype' directive support

Summary:
This patch supports `.eventtype` directive printing and parsing in the
same syntax with `.functype`.

Reviewers: aardappel, sbc100

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

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

llvm-svn: 348818

5 years ago[TextAPI][elfabi] Make SoName optional
Armando Montanez [Tue, 11 Dec 2018 01:00:16 +0000 (01:00 +0000)]
[TextAPI][elfabi] Make SoName optional

This change makes DT_SONAME treated as an optional trait for ELF TextAPI
stubs. This change accounts for the fact that shared objects aren't
guaranteed to have a DT_SONAME entry. Tests have been updated to check
for correct behavior of an optional soname.

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

llvm-svn: 348817

5 years ago[WebAssembly] TargetStreamer cleanup (NFC)
Heejin Ahn [Tue, 11 Dec 2018 00:53:59 +0000 (00:53 +0000)]
[WebAssembly] TargetStreamer cleanup (NFC)

Summary:
- Unify mixed argument names (`Symbol` and `Sym`) to `Sym`
- Changed `MCSymbolWasm*` argument of `emit***` functions to `const
  MCSymbolWasm*`. It seems not very intuitive that emit function in the
  streamer modifies symbol contents.
- Moved empty function bodies to the header
- clang-format

Reviewers: aardappel, dschuff, sbc100

Subscribers: jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 348816

5 years ago[GISel]: Refactor MachineIRBuilder to allow passing additional parameters to build...
Aditya Nandakumar [Tue, 11 Dec 2018 00:48:50 +0000 (00:48 +0000)]
[GISel]: Refactor MachineIRBuilder to allow passing additional parameters to build Instrs

https://reviews.llvm.org/D55294

Previously MachineIRBuilder::buildInstr used to accept variadic
arguments for sources (which were either unsigned or
MachineInstrBuilder). While this worked well in common cases, it doesn't
allow us to build instructions that have multiple destinations.
Additionally passing in other optional parameters in the end (such as
flags) is not possible trivially. Also a trivial call such as

B.buildInstr(Opc, Reg1, Reg2, Reg3)
can be interpreted differently based on the opcode (2defs + 1 src for
unmerge vs 1 def + 2srcs).
This patch refactors the buildInstr to

buildInstr(Opc, ArrayRef<DstOps>, ArrayRef<SrcOps>)
where DstOps and SrcOps are typed unions that know how to add itself to
MachineInstrBuilder.
After this patch, most invocations would look like

B.buildInstr(Opc, {s32, DstReg}, {SrcRegs..., SrcMIBs..});
Now all the other calls (such as buildAdd, buildSub etc) forward to
buildInstr. It also makes it possible to build instructions with
multiple defs.
Additionally in a subsequent patch, we should make it possible to add
flags directly while building instructions.
Additionally, the main buildInstr method is now virtual and other
builders now only have to override buildInstr (for say constant
folding/cseing) is straightforward.

Also attached here (https://reviews.llvm.org/F7675680) is a clang-tidy
patch that should upgrade the API calls if necessary.

llvm-svn: 348815

5 years agoFollow-up fix to r348811 for null Errors (which is the case for end iterators)
David Blaikie [Tue, 11 Dec 2018 00:17:36 +0000 (00:17 +0000)]
Follow-up fix to r348811 for null Errors (which is the case for end iterators)

Not sure how I missed that in my testing, but obvious enough - this
causes segfaults when attempting to dereference the Error in end
iterators.

llvm-svn: 348814

5 years agoFix undefined behavior in Variable.h
Zachary Turner [Tue, 11 Dec 2018 00:15:03 +0000 (00:15 +0000)]
Fix undefined behavior in Variable.h

m_loc_is_constant_data was uninitialized, so unless someone
explicitly called SetLocIsConstantData(), this would be UB.

I think every existing call-site would always call the proper
function to initialize the value, so there were no existing
bugs, but I encountered this when I tried to use it without
calling this function and encountered this.

llvm-svn: 348813

5 years agoAdd a version of std::function that includes a few optimizations in ABI V2.
Eric Fiselier [Tue, 11 Dec 2018 00:14:34 +0000 (00:14 +0000)]
Add a version of std::function that includes a few optimizations in ABI V2.

Patch by Jordan Soyke (jsoyke@google.com)
Reviewed as D55045

The result of running the benchmarks and comparing them can be found
here: https://gist.github.com/EricWF/a77fd42ec87fc98da8039e26d0349498

llvm-svn: 348812

5 years agollvm-objcopy: Improve/simplify llvm::Error handling during notes iteration
David Blaikie [Tue, 11 Dec 2018 00:09:06 +0000 (00:09 +0000)]
llvm-objcopy: Improve/simplify llvm::Error handling during notes iteration

Using an Error as an out parameter from an indirect operation like
iteration as described in the documentation (
http://llvm.org/docs/ProgrammersManual.html#building-fallible-iterators-and-iterator-ranges
) seems to be a little fussy - so here's /one/ possible solution, though
I'm not sure it's the right one.

Alternatively such APIs may be better off being switched to a standard
algorithm style, where they take a lambda to do the iteration work that
is then called back into (eg: "Error e = obj.for_each_note([](const
Note& N) { ... });"). This would be safer than having an unwritten
assumption that the user of such an iteration cannot return early from
the inside of the function - and must always exit through the gift
shop... I mean error checking. (even though it's guaranteed that if
you're mid-way through processing an iteration, it's not in an  error
state).

Alternatively we'd need some other (the super untrustworthy/thing we've
generally tried to avoid) error handling primitive that actually clears
the error state entirely so it's safe to ignore.

Fleshed this solution out a bit further during review - it now relies on
op==/op!= comparison as the equivalent to "if (Err)" testing the Error.
So just like an Error must be checked (even if it's in a success state),
the Error hiding in the iterator must be checked after each increment
(including by comparison with another iterator - perhaps this could be
constrained to only checking if the iterator is compared to the end
iterator? Not sure it's too important).

So now even just creating the iterator and not incrementing it at all
should still assert because the Error has not been checked.

Reviewers: lhames, jakehehrlich

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

llvm-svn: 348811

5 years ago[DataFormatters] Fixes to libc++ std::function formatter to deal with ABI change see
Shafik Yaghmour [Mon, 10 Dec 2018 23:26:38 +0000 (23:26 +0000)]
[DataFormatters] Fixes to libc++ std::function formatter to deal with ABI change see

    https://reviews.llvm.org/D55045

llvm-svn: 348810

5 years agoUpdate test for instcombine change
Matt Arsenault [Mon, 10 Dec 2018 23:02:40 +0000 (23:02 +0000)]
Update test for instcombine change

llvm-svn: 348809

5 years agoRewrite pexpect-based test in LIT/FileCheck.
Adrian Prantl [Mon, 10 Dec 2018 22:57:47 +0000 (22:57 +0000)]
Rewrite pexpect-based test in LIT/FileCheck.

pexecpt-based tests are flakey because they involve timeouts and this
test is eprfectly serializable.

llvm-svn: 348808

5 years ago[builtins] Remove trailing whitespaces, NFC
Yi Kong [Mon, 10 Dec 2018 22:52:59 +0000 (22:52 +0000)]
[builtins] Remove trailing whitespaces, NFC

Remove trailing whitespaces so that it is easier to diff the code between
div{s,d,t}f3.c

llvm-svn: 348807

5 years agodebuginfo: Use symbol difference for CU length to simplify assembly reading/editing
David Blaikie [Mon, 10 Dec 2018 22:44:48 +0000 (22:44 +0000)]
debuginfo: Use symbol difference for CU length to simplify assembly reading/editing

Mucking about simplifying a test case ( https://reviews.llvm.org/D55261 ) I stumbled across something I've hit before - that LLVM's (GCC's does too, FWIW) assembly output includes a hardcode length for a DWARF unit in its header. Instead we could emit a label difference - making the assembly easier to read/edit (though potentially at a slight (I haven't tried to observe it) performance cost of delaying/sinking the length computation into the MC layer).

Reviewers: JDevlieghere, probinson, ABataev

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

llvm-svn: 348806

5 years agoReflow a multi-line string and add a newline
Frederic Riss [Mon, 10 Dec 2018 22:30:19 +0000 (22:30 +0000)]
Reflow a multi-line string and add a newline

llvm-svn: 348805

5 years ago[Local] Promote an utility that could be used elsewhere. NFCI.
Davide Italiano [Mon, 10 Dec 2018 22:17:04 +0000 (22:17 +0000)]
[Local] Promote an utility that could be used elsewhere. NFCI.

llvm-svn: 348804

5 years agoFix LLVM_LINK_LLVM_DYLIB build of TapiTests
Sam Clegg [Mon, 10 Dec 2018 22:01:33 +0000 (22:01 +0000)]
Fix LLVM_LINK_LLVM_DYLIB build of TapiTests

A dependency on TestingSupport was introduced in rL348735 but
library was not incldued in the LLVM_LINK_LLVM_DYLIB build.

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

llvm-svn: 348803

5 years ago[Hexagon] Couple of fixes in optimize addressing mode
Krzysztof Parzyszek [Mon, 10 Dec 2018 21:56:04 +0000 (21:56 +0000)]
[Hexagon] Couple of fixes in optimize addressing mode

- Check if an operand is an immediate before calling getImm. Some operands
  that take constant values can actually have global symbols or other
  constant expressions.
- When a load-constant instruction can be folded into users, make sure to
  only delete it when all users have been successfully converted.

llvm-svn: 348802

5 years agoInstCombine: Scalarize single use icmp/fcmp
Matt Arsenault [Mon, 10 Dec 2018 21:50:54 +0000 (21:50 +0000)]
InstCombine: Scalarize single use icmp/fcmp

llvm-svn: 348801

5 years ago[InstCombine] add tests for movmsk (PR39927) NFC
Sanjay Patel [Mon, 10 Dec 2018 21:44:20 +0000 (21:44 +0000)]
[InstCombine] add tests for movmsk (PR39927) NFC

llvm-svn: 348800

5 years agoRevert "Change InitListExpr dump to label and pointer"
Stephen Kelly [Mon, 10 Dec 2018 21:20:05 +0000 (21:20 +0000)]
Revert "Change InitListExpr dump to label and pointer"

This reverts commit r348794.

llvm-svn: 348799

5 years agoFix nits
Stephen Kelly [Mon, 10 Dec 2018 21:04:04 +0000 (21:04 +0000)]
Fix nits

llvm-svn: 348798

5 years agoRe-order content of template parameter dumps
Stephen Kelly [Mon, 10 Dec 2018 21:03:00 +0000 (21:03 +0000)]
Re-order content of template parameter dumps

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 348797

5 years ago[Targets] Fixup incorrect targets in codemodel tests
David Green [Mon, 10 Dec 2018 20:55:34 +0000 (20:55 +0000)]
[Targets] Fixup incorrect targets in codemodel tests

llvm-svn: 348796

5 years agoRe-order content in OMPDeclareReductionDecl dump
Stephen Kelly [Mon, 10 Dec 2018 20:53:39 +0000 (20:53 +0000)]
Re-order content in OMPDeclareReductionDecl dump

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 348795

5 years agoChange InitListExpr dump to label and pointer
Stephen Kelly [Mon, 10 Dec 2018 20:53:32 +0000 (20:53 +0000)]
Change InitListExpr dump to label and pointer

Summary: Don't add a child just for the label.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 348794

5 years ago[clang-tidy] insert release notes for new checkers alphabetically
Jonas Toth [Mon, 10 Dec 2018 19:41:53 +0000 (19:41 +0000)]
[clang-tidy]  insert release notes for new checkers alphabetically

Summary:
Almost all code review comments on new checkers {D55433} {D48866} {D54349} seem to ask for the release notes to be added alphabetically, plus I've seen commits by @Eugene.Zelenko reordering the lists

Make add_new_check.py add those release notes alphabetically based on checker name

If include-fixer section is seen add it at the end

Minor change in the message format to prevent double newlines added before the checker.

Do the tools themselves have unit tests? (sorry new to this game)

- Tested adding new checker at the beginning
- Tested on adding new checker in the middle
- Tested on empty ReleasesNotes.rst (as we would see after RC)

Patch by MyDeveloperDay.

Reviewers: alexfh, JonasToth, curdeius, aaron.ballman, benhamilton, hokein

Reviewed By: JonasToth

Subscribers: cfe-commits, xazax.hun, Eugene.Zelenko

Tags: #clang-tools-extra

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

llvm-svn: 348793