Commit Graph

280289 Commits

Author SHA1 Message Date
Benjamin Kramer 44993ede60 [InstCombine] For cos/sin -> tan copy attributes from cos instead of the
parent function

Ideally we should merge the attributes from the functions somehow, but
this is obviously an improvement over taking random attributes from the
caller which will trip up the verifier if they're nonsensical for an
unary intrinsic call.

llvm-svn: 322284
2018-01-11 15:19:02 +00:00
Sanjay Patel e63d8dda5a [ValueTracking] recognize min/max-of-min/max with notted ops (PR35875)
This was originally planned as the fix for:
https://bugs.llvm.org/show_bug.cgi?id=35834
...but simpler transforms handled that case, so I implemented a 
lesser solution. It turns out we need to handle the case with 'not'
ops too because the real code example that we are trying to solve:
https://bugs.llvm.org/show_bug.cgi?id=35875
...has extra uses of the intermediate values, so we can't rely on 
smaller canonicalizations to get us to the goal.

As with rL321672, I've tried to show every possibility in the
codegen tests because that's the simplest way to prove we're doing
the right thing in the wide variety of permutations of this pattern.

We can also show an InstCombine win because we added a fold for
this case in:
rL321998 / D41603

An Alive proof for one variant of the pattern to show that the 
InstCombine and codegen results are correct:
https://rise4fun.com/Alive/vd1

Name: min3_nots
  %nx = xor i8 %x, -1
  %ny = xor i8 %y, -1
  %nz = xor i8 %z, -1
  %cmpxz = icmp slt i8 %nx, %nz
  %minxz = select i1 %cmpxz, i8 %nx, i8 %nz
  %cmpyz = icmp slt i8 %ny, %nz
  %minyz = select i1 %cmpyz, i8 %ny, i8 %nz
  %cmpyx = icmp slt i8 %y, %x
  %r = select i1 %cmpyx, i8 %minxz, i8 %minyz
=>
  %cmpxyz = icmp slt i8 %minxz, %ny
  %r = select i1 %cmpxyz, i8 %minxz, i8 %ny

Name: min3_nots_alt
  %nx = xor i8 %x, -1
  %ny = xor i8 %y, -1
  %nz = xor i8 %z, -1
  %cmpxz = icmp slt i8 %nx, %nz
  %minxz = select i1 %cmpxz, i8 %nx, i8 %nz
  %cmpyz = icmp slt i8 %ny, %nz
  %minyz = select i1 %cmpyz, i8 %ny, i8 %nz
  %cmpyx = icmp slt i8 %y, %x
  %r = select i1 %cmpyx, i8 %minxz, i8 %minyz
=>
  %xz = icmp sgt i8 %x, %z
  %maxxz = select i1 %xz, i8 %x, i8 %z
  %xyz = icmp sgt i8 %maxxz, %y
  %maxxyz = select i1 %xyz, i8 %maxxz, i8 %y
  %r = xor i8 %maxxyz, -1

llvm-svn: 322283
2018-01-11 15:13:47 +00:00
Andrey Churbanov 5388acd3de Fixed libomp static build broken by the commit rL322202.
Patch by simone <simone@cs.utah.edu>.

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

llvm-svn: 322282
2018-01-11 15:09:49 +00:00
Sanjay Patel e0df4650f8 [InstCombine] add min3-with-nots test (PR35875); NFC
llvm-svn: 322281
2018-01-11 14:53:45 +00:00
Igor Laevsky 06fe558246 [FuzzMutate] Avoid using swifterror as a source operand
Differential Revision: https://reviews.llvm.org/D41107

llvm-svn: 322280
2018-01-11 14:43:05 +00:00
Simon Pilgrim 6e6da3f449 [X86][SSE] Add ISD::VECTOR_SHUFFLE to faux shuffle decoding
Primarily, this allows us to use the aggressive extraction mechanisms in combineExtractWithShuffle earlier and make use of UNDEF elements that may be lost during lowering.

llvm-svn: 322279
2018-01-11 14:25:18 +00:00
Sven van Haastregt 774355e321 [OpenCL] Reorder the CLK_sRGBx/sRGBA defines, NFC
Swap them so that all channel order defines are ordered according to
their values.

llvm-svn: 322278
2018-01-11 14:05:38 +00:00
Alex Bradbury d53ce4a8b5 [Driver][RISCV] Fix r322276 by adding missing dummy crtbegin.o files to test input
The dummy crtbegin.o files were left out in r322276 (as they were ignored by 
svn add of test/Driver/Inputs/multilib_riscv_linux_sdk) and are necessary for 
the driver test to work.

llvm-svn: 322277
2018-01-11 13:51:06 +00:00
Alex Bradbury 71f45455e1 [RISCV] Add the RISCV target and compiler driver
As RV64 codegen has not yet been upstreamed into LLVM, we focus on RV32 driver 
support (RV64 to follow).

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

llvm-svn: 322276
2018-01-11 13:36:56 +00:00
Jonas Paulsson 9b395a12ed [VectorLegalizer] Remove broken code in ExpandStore.
The code that is supposed to "Round odd types to the next pow of two" seems
broken and as well completely unused (untested). It also seems that
ExpandStore really shouldn't ever change the memory VT, which this in fact
does.

As a first step in fixing the broken handling of vector stores (of irregular
types, e.g. an i1 vector), this code is removed. For discussion, see
https://bugs.llvm.org/show_bug.cgi?id=35520.

Review: Eli Friedman
llvm-svn: 322275
2018-01-11 13:03:21 +00:00
Alexander Kornienko 5a65e67d5d [clang-tidy] Fix google-readability-namespace-comments handling of C++17 nested namespaces
Summary:
Fixes bug 34701

When we encounter a namespace find the location of the left bracket.
Then if the text between the name and the left bracket contains a ':'
then it's a C++17 nested namespace.

Reviewers: #clang-tools-extra, alexfh, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: curdeius, cfe-commits, krasimir, JonasToth, JDevlieghere, xazax.hun

Tags: #clang-tools-extra

Patch by Alexandru Octavian Buțiu!

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

llvm-svn: 322274
2018-01-11 13:00:28 +00:00
Pavel Labath 7488d3a81c Remove leftover empty folders
These were created by moving stuff around with git. After committing the move
back to svn, the folders holding the original files remained.

llvm-svn: 322273
2018-01-11 12:57:23 +00:00
Zvi Rackover 3ee66d9cd1 X86: Fix LowerBUILD_VECTORAsVariablePermute for case Src is smaller than Indices
Summary:
As RKSimon suggested in pr35820, in the case that Src is smaller in
bit-size than Indices, need to widen Src to avoid type mismatch.

Fixes pr35820

Reviewers: RKSimon, craig.topper

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 322272
2018-01-11 12:26:52 +00:00
Pavel Labath b6ac2d9694 Make the bundle folders in the find-app-in-bundle test non-empty
git will not create empty folders, which makes this test fail if the repo is
checked out with git.

llvm-svn: 322271
2018-01-11 12:21:58 +00:00
Tatyana Krasnukha 6c2c08f3a1 Check existence of each required component during construction of LLVMCDisassembler.
Summary:
Actually, fix two issues:

  # remove repeat creation of reg_info, use m_reg_info_ap  for createMCAsmInfo instead;

  # remove possibility to dereference nullptr during createMCAsmInfo invocation, that could lead to undefined behavior.

Placed checking of a component right after its creation to simplify the code and avoid same issues later.

Reviewers: zturner, clayborg, jingham, jasonmolenda, labath

Reviewed By: clayborg, labath

Subscribers: labath, lldb-commits

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

llvm-svn: 322270
2018-01-11 12:06:22 +00:00
Alex Bradbury 0715d35ed5 [RISCV] Reserve an emergency spill slot for the register scavenger when necessary
Although the register scavenger can often find a spare register, an emergency 
spill slot is needed to guarantee success. Reserve this slot in cases where 
the function is known to have a large stack (meaning the scavenger may be 
needed when forming stack addresses).

llvm-svn: 322269
2018-01-11 11:17:19 +00:00
Pavel Labath da45439fba [Lex] Use WritableMemoryBuffer in ScratchBuffer.cpp
This avoids the need to const_cast the buffer contents to write to it.

NFCI.

llvm-svn: 322268
2018-01-11 10:43:45 +00:00
Andrew V. Tischenko d037b1446b Implementation of X86Operand::print.
Differential Revision: https://reviews.llvm.org/D41610

llvm-svn: 322267
2018-01-11 10:31:01 +00:00
Stefan Maksimovic 5481c2176e [Mips] Handle one byte unsupported relocations
Fail gracefully instead of crashing upon encountering
this type of relocation.

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

llvm-svn: 322266
2018-01-11 10:07:47 +00:00
Sander de Smalen ba5fd775ad [AArch64][SVE] Asm: Negative tests for predicated ADD/SUB register constraints
Summary: Patch [3/3] in a series to add operand constraint checks for SVE's predicated ADD/SUB.

Reviewers: rengolin, mcrosier, evandro, fhahn, echristo

Reviewed By: rengolin, fhahn

Subscribers: aemerson, javed.absar, tschuett, kristof.beyls, llvm-commits

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

llvm-svn: 322265
2018-01-11 10:02:27 +00:00
Dimitry Andric 656714a311 Fix thread race between SectionPiece's OutputOff and Live members
Summary:
As reported in bug 35788, rL316280 reintroduces a race between two
members of SectionPiece, which share the same 64 bit memory location.

To fix the race, check the hash before checking the Live member, as
suggested by Rafael.

Reviewers: ruiu, rafael

Reviewed By: ruiu

Subscribers: smeenai, emaste, llvm-commits

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

llvm-svn: 322264
2018-01-11 08:03:22 +00:00
Rui Ueyama 45fcbf0991 Remove redundnat Args.filter() argument.
OPT_plugin_opt_eq is an alias to OPT_plugin_opt, so we don't need
to give that twice.

llvm-svn: 322263
2018-01-11 07:55:01 +00:00
Craig Topper d1696e8d6c [X86] Fix unused variable in release builds.
llvm-svn: 322262
2018-01-11 07:19:29 +00:00
Petr Hosek bf8751dc48 Revert "Install resource files into a share/ directory"
This reverts commit r322256: broke the dfsan build.

llvm-svn: 322261
2018-01-11 07:05:41 +00:00
Petr Hosek 605d3b9225 Revert "[Driver] Update default sanitizer blacklist location"
This reverts commit r322258: broke the dfsan build.

llvm-svn: 322260
2018-01-11 07:05:38 +00:00
Shoaib Meenai d79bbf4474 [ELF] Fix SysV hash tables with --no-rosegment
When setting up the chain, we copy over the bucket's previous symbol
index, assuming that this index will be 0 (STN_UNDEF) for an unused
bucket (marking the end of the chain). When linking with --no-rosegment,
however, unused buckets will in fact contain the padding value, and so
the hash table will end up containing invalid chains. Zero out the hash
table section explicitly to avoid this, similar to what's already done
for GNU hash sections.

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

llvm-svn: 322259
2018-01-11 06:57:01 +00:00
Petr Hosek bb9c6fc3bc Reland "[Driver] Update default sanitizer blacklist location"
This is related to moving the sanitizer blacklists to share/
subdirectory.

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

llvm-svn: 322258
2018-01-11 06:42:12 +00:00
Aaron Smith a73fa2a0ed [CodeView] Fix the type for a variadic argument
Summary:
- MSVC uses the none type for a variadic argument in CodeView
- Add a unit test

Reviewers: zturner, llvm-commits

Reviewed By: zturner

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

llvm-svn: 322257
2018-01-11 06:42:11 +00:00
Petr Hosek 17850f67ff Reland "Install resource files into a share/ directory"
Currently these files are being installed into a root installation
directory, but this triggers an error when the installation directory
is set to an empty string which is often the case when DESTDIR is
used to control the installation destination.

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

llvm-svn: 322256
2018-01-11 06:42:10 +00:00
Dmitry Venikov e5fbf591a7 [InstCombine] Missed optimization in math expression: sin(x) / cos(x) => tan(x)
Summary: This patch enables folding sin(x) / cos(x) -> tan(x), cos(x) / sin(x) -> 1 / tan(x) under -ffast-math flag

Reviewers: hfinkel, spatel

Reviewed By: spatel

Subscribers: andrew.w.kaylor, efriedma, scanon, llvm-commits

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

llvm-svn: 322255
2018-01-11 06:33:00 +00:00
Craig Topper 0b59034b15 [X86] Optimize v2i32/v2f32 scatters.
If the index is v2i64 we can use the scatter instruction that has v4i32/v4f32 data register, v2i64 index, and v2i1 mask. Similar was already done for gather.

Implement custom widening for v2i32 data to remove the code that reverses type legalization during lowering.

llvm-svn: 322254
2018-01-11 06:31:28 +00:00
Petr Hosek 98a57ad6ce [Fuchsia] Remove LLDB from the toolchain distribution
This is currently not being used so disable it to reduce toolchain size.

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

llvm-svn: 322253
2018-01-11 04:25:30 +00:00
Petr Hosek e4825b8dc4 [Fuchsia] Use llvm-objcopy as objcopy on non-Darwin hosts
llvm-objcopy already supports all the necessary functionality for ELF.

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

llvm-svn: 322252
2018-01-11 04:17:57 +00:00
Eugene Zemtsov b7386d9943 Advanced guessing of rendezvous breakpoint (resubmit)
When rendezvous structure is not initialized we need to set up
rendezvous breakpoint anyway. In this case the code will locate
dynamic loader (interpreter) and look for known function names.

This is r322209, but with fixed VDSO loading fixed.

Bug: https://bugs.llvm.org/show_bug.cgi?id=25806
Differential Revision: https://reviews.llvm.org/D41533

llvm-svn: 322251
2018-01-11 03:46:35 +00:00
Wolfgang Pieb 20a745375c [DWARF][NFC] Overload AsmPrinter::emitDwarfStringOffsets() to take a DwarfStringPoolEntry
record.

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

llvm-svn: 322250
2018-01-11 02:35:00 +00:00
Marcello Maggioni ddccd50313 [NFC] Commit to mention that r322248 is actually made by AndrewScheidecker
llvm-svn: 322249
2018-01-11 02:06:28 +00:00
Marcello Maggioni 7083423f22 [SimplifyCFG] Add cut-off for InitializeUniqueCases.
The function can take a significant amount of time on some
complicated test cases, but for the currently only use of
the function we can stop the initialization much earlier
when we find out we are going to discard the result anyway
in the caller of the function.

Adding configurable cut-off points so that we avoid wasting time.
NFCI.

llvm-svn: 322248
2018-01-11 02:01:16 +00:00
Craig Topper 919264371b [X86][Sema] Range check the constant argument for the vpshld/vpshrd builtins to ensure it fits in 8-bits.
llvm-svn: 322247
2018-01-11 01:38:02 +00:00
Craig Topper 71d4aaa523 [X86] Fix vpshrd builtins to require an ICE for their constant argument to match vpshld.
llvm-svn: 322246
2018-01-11 01:38:00 +00:00
Craig Topper a1ef12a051 [X86] Make -mavx512f imply -mfma and -mf16c in the frontend like it does in the backend.
Similarly, make -mno-fma and -mno-f16c imply -mno-avx512f.

Withou this  "-mno-sse -mavx512f" ends up with avx512f being enabled in the frontend but disabled in the backend.

llvm-svn: 322245
2018-01-11 01:37:59 +00:00
Craig Topper 8e63fc70be [X86][Sema] Remove constant range checks on on builtins that take a char.
The constant is already reduced to 8-bits by the time we get here and the checks were just ensuring that it was 8 bits. Thus I don't think there's anyway for them to fail.

llvm-svn: 322244
2018-01-11 01:37:57 +00:00
Petr Hosek b00060137e Revert "Install resource files into a share/ directory"
This reverts commit r322234: this is breaking dfsan tests.

llvm-svn: 322243
2018-01-11 00:12:03 +00:00
Petr Hosek aaf4da6c10 Revert "[Driver] Update default sanitizer blacklist location"
This reverts commit r322233: this is breaking dfsan tests.

llvm-svn: 322242
2018-01-11 00:12:02 +00:00
Matt Morehouse 527352b6ac SmallVector: fix use-after-poison MSAN error in destructor
Summary:
Addresses issue: https://bugs.llvm.org/show_bug.cgi?id=34595

The topmost class, `SmallVector`, has internal storage for some
elements; `N - 1` elements' bytes worth of space.  Meanwhile a base
class `SmallVectorTemplateCommon` has room for one element as well,
totaling `N` elements' worth of space.

The space for the N elements is contiguous and straddles
`SmallVectorTemplateCommon` and `SmallVector`.

A class "between" those two owning the storage, `SmallVectorImpl`, in
its destructor, calls the destructor for elements contained in the
vector, if any.  It uses `destroy_range(begin, end)` and deletes all
items in sequence, starting from the end.

By the time the destructor for `SmallVectorImpl` is running, though, the
memory for elements `[1, N)` is already poisoned, due to `SmallVector`'s
destructor having done its thing already.

So if the element type `T` has a nontrivial destructor that accesses any
members of the `T` instance being destroyed, we'll run into a
user-after-poison bug.

This patch moves the destruction loop into `SmallVector`'s destructor,
so any memory being accessed while dtors are running is not yet
poisoned.

Confirmed this broke before (and now works with this patch) with these
compiler flags:

  -fsanitize=memory
  -fsanitize-memory-use-after-dtor
  -fsanitize-memory-track-origins

and with the cmake flag
`-DLLVM_USE_SANITIZER='MemoryWithOrigins;Undefined'` as well as
`MSAN_OPTIONS=poison_in_dtor=1`.

Patch By: elsteveogrande

Reviewers: eugenis, morehouse, dblaikie

Reviewed By: eugenis, dblaikie

Subscribers: llvm-commits

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

llvm-svn: 322241
2018-01-10 23:53:11 +00:00
Volodymyr Sapsai cbafa59527 [Lex] Inline a variable in test in preparation for more similar tests. NFC.
llvm-svn: 322240
2018-01-10 23:37:29 +00:00
Jim Ingham e8db13da0a Running this on other systems won't work because I don't
know how to specifically build a MachO binary on other systems.

llvm-svn: 322239
2018-01-10 23:32:43 +00:00
Sanjay Patel f16fe0f205 [AArch64] add tests for notted variants of min/max; NFC
Like rL321668 / rL321672, the planned optimizer change to 
fix these will be in ValueTracking, but we can test the
changes cleanly here with AArch64 codegen.

llvm-svn: 322238
2018-01-10 23:31:42 +00:00
Jason Molenda 8049b4db55 Remove Environment.h, test-dwarf.cpp, test-dwarf.exe
from being listed as a part of the desktop or 
desktop/desktop_no_xpc Targets - they should not be
a part of any target.  Having them listed as a part of
desktop target results in them being added to the 
Copy Files build phase for desktop and I'm guessing
they'd end up in the manpage directory or something.

llvm-svn: 322237
2018-01-10 23:11:29 +00:00
Richard Smith 93ee9caaed In C++17, when instantiating an out-of-line definition of an inline static data
member, don't forget to instantiate the initializer too.

llvm-svn: 322236
2018-01-10 23:08:26 +00:00
Jim Ingham 1f74a24ac0 Runs the part of the test that just finds the binary on all systems.
That should work everywhere. Then only try actually running on macosx.

llvm-svn: 322235
2018-01-10 23:06:34 +00:00