Commit Graph

256738 Commits

Author SHA1 Message Date
Dan Albert 1dc735bf64 Fix GNU strerror_r check for Android.
Summary:
Bionic didn't get a GNU style strerror_r until Android M. Until then
we unconditionally exposed the POSIX one. Expand the check to account
for this.

Reviewers: pirama, AndreyChurbanov, jlpeyton

Reviewed By: jlpeyton

Subscribers: openmp-commits, srhines

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

llvm-svn: 297235
2017-03-07 22:18:05 +00:00
Duncan P. N. Exon Smith 14ab3e6885 ADT: Fix SmallPtrSet iterators in reverse mode
Fix SmallPtrSet::iterator behaviour and creation ReverseIterate is true.

  - Any function that creates an iterator now uses
    SmallPtrSet::makeIterator, which creates an iterator that
    dereferences to the given pointer.

  - In reverse-iterate mode, initialze iterator::End with "CurArray"
    instead of EndPointer.

  - In reverse-iterate mode, the current node is iterator::Buffer[-1].
    iterator::operator* and SmallPtrSet::makeIterator are the only ones
    that need to know.

  - Fix the assertions for reverse-iterate mode.

This fixes the tests Danny B added in r297182, and adds a couple of
others to confirm that dereferencing does the right thing, regardless of
how the iterator was found, and that iteration works correctly from each
return from find.

llvm-svn: 297234
2017-03-07 21:56:32 +00:00
Zachary Turner 48d257d76c Fix source-lines test on Windows.
llvm-svn: 297233
2017-03-07 21:53:21 +00:00
Sanjay Patel 53fa17a014 [InstCombine] shrink truncated splat shuffle (2nd try)
This was committed at r297155 and reverted at r297166 because of an
over-reaching clang test. That should be fixed with r297189.

This is one part of solving a recent bug report:
http://lists.llvm.org/pipermail/llvm-dev/2017-February/110293.html

This keeps with our general approach: changing arbitrary shuffles is off-limts,
but changing splat is ok. The transform is very similar to the existing
shrinkBitwiseLogic() canonicalization.

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

llvm-svn: 297232
2017-03-07 21:45:16 +00:00
Eugene Zemtsov 7993cc5eed Make LLDB skip server-client roundtrip for signals that don't require any actions
If QPassSignals packaet is supported by lldb-server, lldb-client will
utilize it and ask the server to ignore signals that don't require stops
or notifications.
Such signals will be immediately re-injected into inferior to continue
normal execution.

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

llvm-svn: 297231
2017-03-07 21:34:40 +00:00
Chris Bieneman a03cbcc6a6 [ObjectYAML] Fix issue with DWARF2 AddrSize 8
In my refactoring I introduced a bug where we were using the reference size instead of the offset size for DW_FORM_strp and similar forms.

This patch resolves the error and adds a test case testing all the DWARF forms for DWARF2 AddrSize 8. There is similar coverage already in the DWARFDebugInfoTest sources that covers the parser. Once I migrate the DWARFGenerator APIs to be built on the YAML tools they will be fully covered under the same tests.

llvm-svn: 297230
2017-03-07 21:34:35 +00:00
Rui Ueyama 9accea6feb Pass archive files to link.exe if they contain at least one native object file.
Some archive files created during chromium build contains both BC
and native files. If that's the case, we want to pass the archive
file to link.exe. Otherwise, the MSVC linker would complain that
there's an unresolved symbol in a given set of files.

I cannot explain why link.exe doesn't complain about the presence
of bitcode files in this case, but it seems link.exe doesn't touch BC.

llvm-svn: 297229
2017-03-07 21:26:10 +00:00
Tim Hammerquist a64fafc7b6 fix format specifier warnings
llvm-svn: 297228
2017-03-07 21:26:04 +00:00
Joel Jones 15467df982 [AArch64] Vulcan is now ThunderXT99
Broadcom Vulcan is now Cavium ThunderX2T99.

LLVM Bugzilla: http://bugs.llvm.org/show_bug.cgi?id=32113
Corresponding LLVM change: https://reviews.llvm.org/rL297190

Changes to clang to support the change.

Patch by Joel Jones

llvm-svn: 297227
2017-03-07 21:24:53 +00:00
Tim Northover 2eb18d3c4b GlobalISel: fix legalization of G_INSERT
We were calculating incorrect extract/insert offsets by trying to be too
tricksy with min/max. It's clearer to just split the logic up into "register
starts before this segment" vs "after".

llvm-svn: 297226
2017-03-07 21:24:33 +00:00
Simon Pilgrim 7f81c3d495 Strip trailing whitespace.
llvm-svn: 297225
2017-03-07 21:16:38 +00:00
Gor Nishanov c611ab251b [coroutines] update coro_end builtin to match llvm
Summary: llvm.coro.end intrinsic now returns bool. Updating clang to match it.

Reviewers: GorNishanov, rsmith

Reviewed By: rsmith

Subscribers: mehdi_amini, cfe-commits, EricWF

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

llvm-svn: 297224
2017-03-07 21:01:08 +00:00
Gor Nishanov c52006ab09 [coroutines] Add handling for unwind coro.ends
Summary:
The purpose of coro.end intrinsic is to allow frontends to mark the cleanup and
other code that is only relevant during the initial invocation of the coroutine
and should not be present in resume and destroy parts.

In landing pads coro.end is replaced with an appropriate instruction to unwind to
caller. The handling of coro.end differs depending on whether the target is
using landingpad or WinEH exception model.

For landingpad based exception model, it is expected that frontend uses the
`coro.end`_ intrinsic as follows:

```
    ehcleanup:
      %InResumePart = call i1 @llvm.coro.end(i8* null, i1 true)
      br i1 %InResumePart, label %eh.resume, label %cleanup.cont

    cleanup.cont:
      ; rest of the cleanup

    eh.resume:
      %exn = load i8*, i8** %exn.slot, align 8
      %sel = load i32, i32* %ehselector.slot, align 4
      %lpad.val = insertvalue { i8*, i32 } undef, i8* %exn, 0
      %lpad.val29 = insertvalue { i8*, i32 } %lpad.val, i32 %sel, 1
      resume { i8*, i32 } %lpad.val29

```
The `CoroSpit` pass replaces `coro.end` with ``True`` in the resume functions,
thus leading to immediate unwind to the caller, whereas in start function it
is replaced with ``False``, thus allowing to proceed to the rest of the cleanup
code that is only needed during initial invocation of the coroutine.

For Windows Exception handling model, a frontend should attach a funclet bundle
referring to an enclosing cleanuppad as follows:

```
    ehcleanup:
      %tok = cleanuppad within none []
      %unused = call i1 @llvm.coro.end(i8* null, i1 true) [ "funclet"(token %tok) ]
      cleanupret from %tok unwind label %RestOfTheCleanup
```

The `CoroSplit` pass, if the funclet bundle is present, will insert
``cleanupret from %tok unwind to caller`` before
the `coro.end`_ intrinsic and will remove the rest of the block.

Reviewers: majnemer

Reviewed By: majnemer

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 297223
2017-03-07 21:00:54 +00:00
Yaron Keren 75fadfc774 Implement FreeMachineFunction::getPassName().
llvm-svn: 297222
2017-03-07 20:59:08 +00:00
Ahmed Bougacha 55d10423a6 [GlobalISel] Don't translate intrinsics with metadata parameters.
Some intrinsics take metadata parameters.  These all need custom
handling of some form, and cannot possibly be lowered generically to
G_INTRINSIC calls with vreg operands.
Reject them, instead of hitting an assert later in getOrCreateVReg.

llvm-svn: 297209
2017-03-07 20:53:09 +00:00
Ahmed Bougacha 5c7924fca5 [GlobalISel] Avoid invalidating ValToVReg when translating no-op bitcast.
When we translate a no-op (same type) bitcast, we try to be clever and
only emit a COPY if we already assigned a vreg to the defined value.
However, when we didn't, we tried to assign to a reference into the
ValToVReg DenseMap, even though the RHS of the assignment
(getOrCreateVReg) could potentially grow that DenseMap, invalidating the
reference.

Avoid that by getting the source vreg first.
I audited the rest of the translator; this is the only tricky case.

The test is quite unwieldy, as the problem is caused by the DenseMap
growing, which happens after the 47th mapped value.

llvm-svn: 297208
2017-03-07 20:53:06 +00:00
Ahmed Bougacha 38455ea8a6 [GlobalISel] Relax vector G_SELECT assertion.
For vector operands, the `select` instruction supports both vector and
non-vector conditions.  The MIR builder had an overly restrictive
assertion, that only accepted vector conditions for vector selects
(in effect implementing ISD::VSELECT).

Make it possible to express the full range of G_SELECTs.

llvm-svn: 297207
2017-03-07 20:53:03 +00:00
Ahmed Bougacha 70dd6c2212 [GlobalISel] Add vector select translation test. NFC.
llvm-svn: 297206
2017-03-07 20:53:00 +00:00
Ahmed Bougacha adce3ee219 [GlobalISel] Slightly clean up DBG_VALUE FP build code.
I messed up my rebases leading to r297200, and ended up with stale (but
working) code.  Fix it.

llvm-svn: 297205
2017-03-07 20:52:57 +00:00
Vitaly Buka 91266b4752 [fuzzer] Don't crash if LLVMFuzzerMutate was called by CustomCrossOver
Reviewers: kcc

Subscribers: llvm-commits, mgorny

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

llvm-svn: 297202
2017-03-07 20:37:38 +00:00
Ahmed Bougacha c373262d52 [GlobalISel] Ignore %noreg when applying default regbank mapping.
When computing the mapping for non-generic instructions, we skipped
%noreg operands, because we can't always reason about their banks.

Also skip them when applying the mapping.  Otherwise, we could end
up with mappings that we can't apply.

While there, duplicate an assert to distinguish between the two
error conditions.

llvm-svn: 297201
2017-03-07 20:34:23 +00:00
Ahmed Bougacha 4826bae8b4 [GlobalISel] Emit DBG_VALUE %noreg for non-int/fp constant values.
When a dbg_value has a constant operand that isn't representable in MI,
there isn't much we can do.  Use %noreg (0) for those situations.
This matches the SelectionDAG behavior.

llvm-svn: 297200
2017-03-07 20:34:20 +00:00
Ahmed Bougacha ab50ecb1c7 [GlobalISel] Add constant dbg.value translation tests. NFC.
llvm-svn: 297199
2017-03-07 20:34:13 +00:00
Artem Belevich 2524a22562 [NVPTX] Fixed lowering of unaligned loads/stores of f16 scalars and vectors.
Differential Revision: https://reviews.llvm.org/D30672

llvm-svn: 297198
2017-03-07 20:33:38 +00:00
Arnold Schwaighofer 69e74b48f2 SjLjEHPrepare: Fix the pass for swifterror arguments
We cannot leave the identity copies 'select true, arg, undef' that this pass
inserts for arguments to simplify handling of values on swifterror arguments.

swifterror arguments have restrictions on their uses.

rdar://30839288

llvm-svn: 297197
2017-03-07 20:29:02 +00:00
Arnold Schwaighofer a8f5a8298c Fix bugpoint to work with swifterror values
llvm-svn: 297196
2017-03-07 20:28:59 +00:00
Michael Kruse 5a4ec5c42b [ScopDetection] Require LoadInst base pointers to be hoisted.
Only when load-hoisted we can be sure the base pointer is invariant
during the SCoP's execution. Most of the time it would be added to
the required hoists for the alias checks anyway, except with
-polly-ignore-aliasing, -polly-use-runtime-alias-checks=0 or if
AliasAnalysis is already sure it doesn't alias with anything
(for instance if there is no other pointer to alias with).

Two more parts in Polly assume that this load-hoisting took place:
- setNewAccessRelation() which contains an assert which tests this.
- BlockGenerator which would use to the base ptr from the original
  code if not load-hoisted (if the access expression is regenerated)

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

llvm-svn: 297195
2017-03-07 20:28:43 +00:00
Taewook Oh 06b1af5bf1 Use filename in linemarker when compiling preprocessed source (Revised)
Summary:
This is a revised version of D28796. Included test is changed to
resolve the target compatibility issue reported (rL293032).

Reviewers: inglorion, dblaikie, echristo, aprantl, probinson

Reviewed By: inglorion

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 297194
2017-03-07 20:20:23 +00:00
Konstantin Zhuravlyov f895b2019b llvm-objdump: handle line numbers and source options for amdgpu objects
Differential Revision: https://reviews.llvm.org/D30679

llvm-svn: 297193
2017-03-07 20:17:11 +00:00
Konstantin Zhuravlyov 4203ea320e Fix C2712 build error on Windows
Move the __try/__except block outside of the set_thread_name function to avoid a conflict with object unwinding due to the use of the llvm::Storage.

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

llvm-svn: 297192
2017-03-07 20:09:46 +00:00
Rui Ueyama e0341db179 Do not pass archive files containing bitcode files to the MSVC Linker.
If /msvclto is specified, we compile bitcode files and pass it to the
MSVC linker, stripping all bitcode files. We haven't stripped archive
files, because I was thinking that the MSVC linker wouldn't touch files
in archive files. When we pass an object file to link.exe, all symbols
have been resolved already, so link.exe shoulnd't need any of the files
in archives.

It turns out that even though link.exe doesn't need to do that, it
seems to try to read each file in all archives. And if there's a non-
COFF file in an archive, it exists with an error message. So we need
to remove archives from the command line too.

llvm-svn: 297191
2017-03-07 19:45:53 +00:00
Joel Jones 2852088126 [AArch64] Vulcan is now ThunderXT99
Broadcom Vulcan is now Cavium ThunderX2T99.

LLVM Bugzilla: http://bugs.llvm.org/show_bug.cgi?id=32113

Minor fixes for the alignments of loops and functions for
ThunderX T81/T83/T88 (better performance).

Patch was tested with SpecCPU2006.

Patch by Stefan Teleman

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

llvm-svn: 297190
2017-03-07 19:42:40 +00:00
Sanjay Patel 3a8ec02743 fix test to not check optimized IR; NFCI
This test broke with an LLVM instcombine patch (r297166).
I changed the RUN line to only run -mem2reg (to save time checking this large chunk of tests)
and updated the checks using the script attached to D17999:
https://reviews.llvm.org/D17999

The goal is to make this test immune to optimizer changes. If there's something in these
tests that was checking for an IR optimization, that should be tested in LLVM, not Clang.

llvm-svn: 297189
2017-03-07 19:24:54 +00:00
Daniel Sanders 8ebec37d26 Revert r297177: Change LLT constructor string into an LLT-based object ...
More module problems. This time it only showed up in the stage 2 compile of
clang-x86_64-linux-selfhost-modules-2 but not the stage 1 compile.

Somehow, this change causes the build to need Attributes.gen before it's been
generated.

llvm-svn: 297188
2017-03-07 19:21:23 +00:00
Daniel Marjamaki cf715bd330 [analyzer] Fix crashes in CastToStruct checker for undefined structs
This crash was reported in https://bugs.llvm.org//show_bug.cgi?id=31173

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

llvm-svn: 297187
2017-03-07 19:20:48 +00:00
Xin Tong ac2b5767af [JumpThread] Simplify CmpInst-as-Condition branch-folding a bit.
Summary: Simplify CmpInst-as-Condition branch-folding a bit.

Reviewers: sanjoy, efriedma

Reviewed By: efriedma

Subscribers: llvm-commits

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

llvm-svn: 297186
2017-03-07 18:59:09 +00:00
Pirama Arumuga Nainar 70a3671222 [cmake] Include openmp with add_llvm_external_project
Summary:
Include projects/openmp into the build using add_llvm_external_project
instead of add_subdirectory.  This creates an option
LLVM_TOOL_OPENMP_BUILD that selects whether this project gets included
in an in-tree build.

Reviewers: beanz, AndreyChurbanov, jlpeyton

Subscribers: srhines, openmp-commits, llvm-commits, mgorny

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

llvm-svn: 297185
2017-03-07 18:54:17 +00:00
Bill Seurer fe53fdb873 [PowerPC] mark xray test as unsupported on powerpcle in testsuite
Temporarily mark the test as unsupported so the powerpc le buildbot
testers can get back to work.

There was a brief discussion of this on the mailing list for r296998.

llvm-svn: 297184
2017-03-07 18:52:54 +00:00
Chris Bieneman b3ca711ab3 [ObjectYAML] Add support for DWARF5 Unit header
In DWARF5 the Unit header added a new field, UnitType, and swapped the order of the address size and abbreviation offset fields.

llvm-svn: 297183
2017-03-07 18:50:58 +00:00
Daniel Berlin 44296ea4db Add unit tests for changes to SmallPtrSet and PointerLikeTypeTraits
llvm-svn: 297182
2017-03-07 18:47:52 +00:00
Daniel Berlin 44b876e259 Add PointerLikeTypeTraits for const things, as long as there is one for the non-const version. Clang and other users have a number of types they use as pointers, and this avoids having to define both const and non-const versions of PointerLikeTraits.
llvm-svn: 297181
2017-03-07 18:47:50 +00:00
Daniel Berlin 48522c9e13 Make SmallPtrSet count and find able to take const PtrType's
Summary:
For our set/map types, count/find normally take const references.
This works well for non-pointer types, but can suck for pointer
types.

DenseSet<int *> foo;
const int *b = nullptr;
foo.count(b) does not work

but the equivalent reference version does work
(patch to fix DenseSet/DenseMap coming up)
For SmallPtrSet, you have no such option.

The following will not work right now:
SmallPtrSet<int *> foo;
const int *b = nullptr;
foo.count(b);

This makes const correctness hard in some cases.
Example:
SmallPtrSet<Instruction *> InstructionsToErase;

You can't make this SmallPtrSet<const Instruction *> because then you
can't erase the instruction.  If I want to see if something is in the
set, I may only have a const Instruction *.  Given that count and find
are non-mutating, this should just work.

The places in our code base that do this resort to const_cast :(.

This patch makes count and find able to be used with const Instruction
* in the above SmallPtrSet examples.

This is a bit annoying because of where C++ applies the const, so we
have to remove the pointer type from the passed-in-type and rebuild it
with const.

Reviewers: dblaikie

Subscribers: llvm-commits

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

llvm-svn: 297180
2017-03-07 18:47:48 +00:00
Matthew Simpson c86b2134c7 [LV] Consider users that are memory accesses in uniforms expansion step
When expanding the set of uniform instructions beyond the seed instructions
(e.g., consecutive pointers), we mark a new instruction uniform if all its
loop-varying users are uniform. We should also allow users that are consecutive
or interleaved memory accesses. This fixes cases where we have an instruction
that is used as the pointer operand of a consecutive access but also used by a
non-memory instruction that later becomes uniform as part of the expansion.

llvm-svn: 297179
2017-03-07 18:47:30 +00:00
Sanjoy Das c08a79fbf2 [X86] Add option to specify preferable loop alignment
Summary:
Loop alignment can cause a significant change of
the perfromance for short loops.
To be able to evaluate the impact of loop alignment this change
introduces the new option x86-experimental-pref-loop-alignment.
The alignment will be 2^Value bytes, the default value is 4.

Patch by Serguei Katkov!

Reviewers: craig.topper

Reviewed By: craig.topper

Subscribers: sanjoy, llvm-commits

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

llvm-svn: 297178
2017-03-07 18:47:22 +00:00
Daniel Sanders 8612326a08 [globalisel] Change LLT constructor string into an LLT-based object that knows how to generate it.
Summary:
This will allow future patches to inspect the details of the LLT. The implementation is now split between
the Support and CodeGen libraries to allow TableGen to use this class without introducing layering concerns.

Thanks to Ahmed Bougacha for finding a reasonable way to avoid the layering issue and providing the version of this patch without that problem.

Reviewers: t.p.northover, qcolombet, rovka, aditya_nandakumar, ab, javed.absar

Subscribers: arsenm, nhaehnle, mgorny, dberris, llvm-commits, kristof.beyls

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

llvm-svn: 297177
2017-03-07 18:32:25 +00:00
Adrian Prantl d4ac2a2b43 Further reduce testcase
llvm-svn: 297176
2017-03-07 18:26:36 +00:00
Ed Schouten 124472ce6f Tidy up the way we include EHHeaderParser.hpp.
Other source files in the source tree tend to include this header file
unconditionally. It also parses perfectly fine on ARM EHABI systems.

llvm-svn: 297175
2017-03-07 18:21:51 +00:00
Ed Schouten 3e29e7415e Improve readability and correctness of the OS specific libunwind bits.
All of the access to __exidx_*, dl_iterate_phdr(), etc. is specific to
the findUnwindSections() function. Right now all of the includes and
declarations related to them are scattered throughout the source file.
For example, for <link.h>, we have a full list of operating systems
guarding the #include, even though the code that uses dl_iterate_phdr()
miraculously doesn't use the same list.

Change the code so that findUnwindSections() is preceded by a block of
#ifdefs that share the same structure as the function itself. First
comes all of the macOS specific bits, followed by bare-metal ARM,
followed by ELF EHABI + DWARF.

This actually allows us to build a copy of libunwind without any
specific ifdefs for NetBSD, CloudABI, etc. It likely also unbreaks the
build of libunwind on FreeBSD/armv6, though I can't confirm.

Reviewed by:	compnerd
Differential Revision:	https://reviews.llvm.org/D30696

llvm-svn: 297174
2017-03-07 18:15:52 +00:00
Teresa Johnson a404d1436e Fix test and add missing return for llvm-lto2 error case
Summary:
This test was missing the target triple.
Once I fixed that, the case with the invalid character error stopped
returning 1 from llvm-lto2 and the test reported a failure. Fixed by
adding the missing return from llvm-lto2. Apparently we were failing
when we eventually tried to get the target.

Reviewers: pcc

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 297173
2017-03-07 18:15:13 +00:00
Volkan Keles 20d3c4200d [GlobalISel] Translate floating-point negation
Reviewers: qcolombet, javed.absar, aditya_nandakumar, dsanders, t.p.northover, ab

Reviewed By: qcolombet

Subscribers: dberris, rovka, llvm-commits, kristof.beyls

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

llvm-svn: 297171
2017-03-07 18:03:28 +00:00