Commit Graph

2053 Commits

Author SHA1 Message Date
Daniel Sanders
0bee4edf8c Revert the revert 253497 and 253539 - These commits aren't the cause of the clang-cmake-mips failures.
Sorry for the noise.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253662 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 13:13:53 +00:00
Daniel Sanders
0a3cc8fdf5 Revert 253497 and 253539 to try to fix clang-cmake-mips buildbot.
It caused link errors of the form:
InstrProfiling.c:(.text.__llvm_profile_instrument_target+0x1c0): undefined reference to `__sync_fetch_and_add_8'

We had a network outage at the time of the commit so the first build to show a
problem is http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/10827



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253656 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 10:07:11 +00:00
Nathan Slingerland
0171b5136f [Support] Disable SaturatingMultiply() unit test while investigating
Ubsan detected undefined behavior in the MathExtras SaturatingMultiply test.

This change disables the test while it is being investigated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253539 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 05:20:17 +00:00
Nathan Slingerland
156d5ee497 [llvm-profdata] Add SaturatingAdd/SaturatingMultiply Helper Functions (2nd try)
Summary:
This change adds MathExtras helper functions for handling unsigned, saturating addition and multiplication. It also updates the instrumentation and sample profile merge implementations to use them.

Reviewers: dnovillo, bogner, davidxl

Subscribers: davidxl, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253497 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 20:40:41 +00:00
Nathan Slingerland
d4cf58476e Revert "[llvm-profdata] Add SaturatingAdd/SaturatingMultiply Helper Functions"
Not ready for merge.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253415 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 00:55:15 +00:00
Nathan Slingerland
4918b66f84 [llvm-profdata] Add SaturatingAdd/SaturatingMultiply Helper Functions
Summary:
This change adds MathExtras helper functions for handling unsigned, saturating addition and multiplication. It also updates the instrumentation and sample profile merge implementations to use them.

No functional changes.

Reviewers: dnovillo, bogner, davidxl

Subscribers: davidxl, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253412 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 00:52:43 +00:00
Rafael Espindola
9f7d480d96 Remove excess white space
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253408 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 00:31:34 +00:00
David Blaikie
358918e8dd Fix -Wunused-function in a non-Win32 build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253373 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-17 20:38:54 +00:00
David Blaikie
034f865664 StringRef-ify some Option APIs
Patch by Eugene Kosov!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253360 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-17 19:00:52 +00:00
Pawel Bylica
790e8d91ff [Support] Tweak path::system_temp_directory() on Windows.
Summary:
This patch changes the behavior of path::system_temp_directory() on Windows to be closer to GetTempPath Windows API call. Enforces path separator to be the native one, makes path absolute, etc. GetTempPath is not used directly because of limitations/implementation bugs on Windows 7.

Windows specific unit tests are added. Most of them runs in separated process with modified environment variables.

This change fixes FileSystemTest.CreateDir unittest that had been failing when run from Unix-like shell on Windows (Unix-like path separator (/) used in env variables).

Reviewers: chapuni, rafael, aaron.ballman

Subscribers: rafael, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253345 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-17 16:54:32 +00:00
Rafael Espindola
96902bf6e3 Add MemoryBufferRef(MemoryBuffer&) constructor.
patch by Jonathan Anderson!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253311 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-17 05:11:44 +00:00
Stephen Canon
0136ee950c Add isInteger() to APFloat.
Useful utility function; this wasn't too hard to do before, but also wasn't
obviously discoverable.  Make it explicit.  Reviewed offline by Michael
Gottesman.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253254 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-16 21:52:48 +00:00
Artyom Skrobov
4c351fd4e8 Handle ARMv6KZ naming
Summary:
* ARMv6KZ is the "canonical" name, given in the ARMARM
* ARMv6Z is an "official abbreviation" for it, mentioned in the ARMARM
* ARMv6ZK is a popular misspelling, which we should support as an alias.

The patch corrects the handling of the names.

Functional changes:
* ARMv6Z no longer treated as an architecture in its own right
* ARMv6ZK renamed to ARMv6KZ, accepting ARMv6ZK as an alias
* arm1176jz-s and arm1176jzf-s recognized as ARMv6ZK, instead of ARMv6K
* default ARMv6K CPU changed to arm1176j-s

Reviewers: rengolin, logan, compnerd

Subscribers: aemerson, llvm-commits, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253206 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-16 14:05:32 +00:00
Duncan P. N. Exon Smith
6426aea54e ADT: Avoid relying on UB in ilist_node::getNextNode()
Re-implement `ilist_node::getNextNode()` and `getPrevNode()` without
relying on the sentinel having a "next" pointer.  Instead, get access to
the owning list and compare against the `begin()` and `end()` iterators.

This only works when the node *can* get access to the owning list.  The
new support is in `ilist_node_with_parent<>`, and any class `Ty`
inheriting from `ilist_node<NodeTy>` that wants `getNextNode()` and/or
`getPrevNode()` should inherit from
`ilist_node_with_parent<NodeTy, ParentTy>` instead.  The requirements:

  - `NodeTy` must have a `getParent()` function that returns the parent.
  - `ParentTy` must have a `getSublistAccess()` static that, given a(n
    ignored) `NodeTy*` (to determine which list), returns a member field
    pointer to the appropriate `ilist<>`.

This isn't the cleanest way to get access to the owning list, but it
leverages the API already used in the IR hierarchy (see, e.g.,
`Instruction::getSublistAccess()`).

If anyone feels like ripping out the calls to `getNextNode()` and
`getPrevNode()` and replacing with direct iterator logic, they can also
remove the access function, etc., but as an incremental step, I'm
maintaining the API where it's currently used in tree.

If these requirements are *not* met, call sites with access to the ilist
can call `iplist<NodeTy>::getNextNode(NodeTy*)` directly, as in
ilistTest.cpp.

Why rewrite this?

The old code was broken, calling `getNext()` on a sentinel that possibly
didn't have a "next" pointer at all!  The new code avoids that
particular flavour of UB (see the commit message for r252538 for more
details about the "lucky" memory layout that made this function so
interesting).

There's still some UB here: the end iterator gets downcast to `NodeTy*`,
even when it's a sentinel (which is typically
`ilist_half_node<NodeTy*>`).  I'll tackle that in follow-up commits.
See this llvm-dev thread for more details:
http://lists.llvm.org/pipermail/llvm-dev/2015-October/091115.html

What's the danger?

There might be some code that relies on `getNextNode()` or
`getPrevNode()` *never* returning `nullptr` -- i.e., that relies on them
being broken when the sentinel is an `ilist_half_node<NodeTy>`.  I tried
to root out those cases with the audits I did leading up to r252380, but
it's possible I missed one or two.  I hope not.

(If (1) you have out-of-tree code, (2) you've reverted r252380
temporarily, and (3) you get some weird crashes with this commit, then I
recommend un-reverting r252380 and auditing the compile errors looking
for "strange" implicit conversions.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252694 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 02:26:42 +00:00
Xinliang David Li
bcd8e0aae7 [PGO] Make indexed value profile data more compact
- Make indexed value profile data more compact by peeling out 
  the per-site value count field into its own smaller sized array.
- Introduced formal data structure definitions to specify value 
  profile data layout in indexed format. Previously the layout 
  of the data is only assumed in the client code (scattered in 
  three different places : size computation, EmitData, and ReadData
- The new data structure  serves as a central place for layout documentation.
- Add interfaces to force BE output for value profile data (testing purpose)
- Add byte swap unit tests

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252563 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-10 00:24:45 +00:00
Mike Aizatsky
da4cf2cda9 Windows-specific test for sys::path::remove_dots.
Differential Revision: http://reviews.llvm.org/D14503

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252504 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-09 19:36:53 +00:00
Mike Aizatsky
8cda80ad24 Moving FileManager::removeDotPaths to llvm::sys::path::remove_dots
Differential Revision: http://reviews.llvm.org/D14393

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252499 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-09 18:56:31 +00:00
Pawel Bylica
6bd362c2d9 Revert r252366: [Support] Use GetTempDir to get the temporary dir path on Windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252367 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-06 23:44:23 +00:00
Pawel Bylica
dae382206c [Support] Use GetTempDir to get the temporary dir path on Windows.
Summary:
In general GetTempDir follows the same logic as the replaced code: checks env variables TMP, TEMP, USERPROFILE in order. However, it also perform other checks like making separators native (\), making the path absolute, etc.

This change fixes FileSystemTest.CreateDir unittest that had been failing when run from Unix-like shell on Windows (Unix-like path separator (/) used in env variables).

Reviewers: chapuni, rafael, aaron.ballman

Subscribers: rafael, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252366 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-06 23:21:49 +00:00
Peter Collingbourne
5f220beefc DI: Reverse direction of subprogram -> function edge.
Previously, subprograms contained a metadata reference to the function they
described. Because most clients need to get or set a subprogram for a given
function rather than the other way around, this created unneeded inefficiency.

For example, many passes needed to call the function llvm::makeSubprogramMap()
to build a mapping from functions to subprograms, and the IR linker needed to
fix up function references in a way that caused quadratic complexity in the IR
linking phase of LTO.

This change reverses the direction of the edge by storing the subprogram as
function-level metadata and removing DISubprogram's function field.

Since this is an IR change, a bitcode upgrade has been provided.

Fixes PR23367. An upgrade script for textual IR for out-of-tree clients is
attached to the PR.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252219 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-05 22:03:56 +00:00
Eugene Zelenko
4e036ff575 Fix some Clang-tidy modernize warnings, other minor fixes.
Fixed warnings are: modernize-use-override, modernize-use-nullptr and modernize-redundant-void-arg.

Differential revision: http://reviews.llvm.org/D14312


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252087 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04 22:32:32 +00:00
David Blaikie
6d6131b03b Orc: Streamline some lambda usage in a unit test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252070 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04 19:43:24 +00:00
Aaron Ballman
1cfa35bef6 Silence an extra semicolon warning; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252046 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04 14:40:54 +00:00
Pawel Bylica
7561231bee Fix unit tests on Windows: handle env vars with non-ASCII chars.
Summary: On Windows we have to take UTF16 encoded env vars and convert them to UTF8. This patch fixes CopyEnvironment helper function used by process unit tests.

Reviewers: yaron.keren

Subscribers: yaron.keren, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252039 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04 08:25:20 +00:00
Rafael Espindola
25d7145b34 Revert "Revert "[Orc] Directly emit machine code for the x86 resolver block and trampolines.""
This reverts commit r251937.

The test was updated to the new API, bring the API back.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251944 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-03 16:40:37 +00:00
Rafael Espindola
1b023a319e Revert "[Orc] Directly emit machine code for the x86 resolver block and trampolines."
This reverts commit r251933.

It broke the build of examples/Kaleidoscope/Orc/fully_lazy/toy.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251937 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-03 16:25:20 +00:00
Lang Hames
73cd3516cc [Orc] Directly emit machine code for the x86 resolver block and trampolines.
Bypassing LLVM for this has a number of benefits:

1) Laziness support becomes asm-syntax agnostic (previously lazy jitting didn't
   work on Windows as the resolver block was in Darwin asm).

2) For cross-process JITs, it allows resolver blocks and trampolines to be
   emitted directly in the target process, reducing cross process traffic.

3) It should be marginally faster.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251933 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-03 16:10:18 +00:00
Pawel Bylica
8bd55b5451 [Support] Extend sys::path with user_cache_directory function.
Summary:
The new function sys::path::user_cache_directory tries to discover
a directory suitable for cache storage for current system user.

On Windows and Darwin it returns a path to system-specific user cache directory.

On Linux it follows XDG Base Directory Specification, what is:
- use non-empty $XDG_CACHE_HOME env var,
- use $HOME/.cache.

Reviewers: chapuni, aaron.ballman, rafael

Subscribers: rafael, aaron.ballman, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251784 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-02 09:49:17 +00:00
Xinliang David Li
61c7e68339 [PGO] Value profiling (index format) code cleanup and testing
1. Added a set of public interfaces in InstrProfRecord
    class to access (read/write) value profile data.
 2. Changed IndexedProfile reader and writer code to 
    use the newly defined interfaces and hide implementation
    details.
 3. Added a couple of unittests for value profiling:
   - Test new interfaces to get and set value profile data
   - Test value profile data merging with various scenarios.

 No functional change is expected. The new interfaces will also
 make it possible to change on-disk format of value prof data
 to be more compact (to be submitted). 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251771 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-02 05:08:23 +00:00
Michael Gottesman
23a49a637b Add a unittest for SmallDenseMap that tests assigning a SmallDenseMap when it is not small.
This complements CopyConstructorNotSmallTest. If we are testing the copy
constructor in such a way, we should also probably test assignment in the same
way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251736 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-31 05:23:53 +00:00
Lang Hames
df3ef600c0 [Orc] Expose the compile callback API through the C bindings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251683 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-30 03:20:21 +00:00
Lang Hames
154d0643db [Orc] Teach IndirectStubsManager to manage an expandable pool of stubs, rather
than a pre-allocated slab of stubs. Also add a convenience method for creating a
single stub, rather than a whole block a time.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251658 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-29 22:04:22 +00:00
Lang Hames
d979d81a43 [Orc] Rename IndirectStubsManagerBase method 'init' to 'createStubs'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251641 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-29 18:36:27 +00:00
NAKAMURA Takumi
185dc9db03 OrcJITTests: Update libdeps corresponding to r251604.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251619 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-29 06:40:04 +00:00
Lang Hames
941b62a140 [Orc] Add missing file for r251604.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251605 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-29 03:53:42 +00:00
Lang Hames
22bbdbd767 [Orc] Add support for RuntimeDyld::setProcessAllSections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251604 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-29 03:52:58 +00:00
Lang Hames
79dc87fc1e [Orc] Require target support for host before running execution unit tests.
Orc unit tests that execute code shouldn't run if the compiler doesn't have
target support for the host machine.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251551 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 20:08:51 +00:00
NAKAMURA Takumi
7c69e3c785 OrcJITTests: Prune unused libdeps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251506 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 09:59:50 +00:00
NAKAMURA Takumi
9f211909bf OrcJITTests: Update libdeps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251504 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 09:37:09 +00:00
Craig Topper
2412f42fae Fix a -Wpessimizing-move warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251495 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 04:54:46 +00:00
Lang Hames
7ab4e8bd48 [Orc] Disable Orc C API unit tests on non-Darwin while I investigate more
builder failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251484 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 03:12:51 +00:00
Lang Hames
f3f591ae00 [Orc] Re-add C bindings for the Orc APIs, with a fix to remove the union that
was causing builder failures.

The bindings were originally added in r251472, and reverted in r251473 due to
the builder failures.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251482 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 02:40:04 +00:00
Lang Hames
4b0975e22a [Orc] Revert the C bindngs commit, r251472, while I debug some builder failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251473 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 01:03:09 +00:00
Lang Hames
5fc6406e39 [Orc] Add experimental C bindings for Orc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251472 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 00:28:26 +00:00
Lang Hames
2d323d4ed2 [Orc] Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251423 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-27 17:45:48 +00:00
Michael Kuperstein
684557ee8c [X86] Make elfiamcu an OS, not an environment.
GNU tools require elfiamcu to take up the entire OS field, so, e.g.
i?86-*-linux-elfiamcu is not considered a legal triple.
Make us compatible.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251390 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-27 07:23:59 +00:00
Michael Kuperstein
c50c6907aa [X86] Add support for elfiamcu triple
This adds support for the i?86-*-elfiamcu triple, which indicates the IAMCU psABI is used.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251222 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-25 08:07:37 +00:00
Rafael Espindola
715bccae4a Add a RAW mode to StringTableBuilder.
In this mode it just tries to tail merge the strings without imposing any other
format constrains. It will not, for example, add a null byte between them.

Also add support for keeping a tentative size and offset if we decide to
not optimize after all.

This will be used shortly in lld for merging SHF_STRINGS sections.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251153 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-23 21:48:05 +00:00
Sanjoy Das
2779d5708c [IR] Add a makeNoWrapRegion method to ConstantRange
Summary: This will be used in a future change to ScalarEvolution.

Reviewers: hfinkel, reames, nlewycky

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250975 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-22 03:12:57 +00:00
Craig Topper
94f8b07c97 [Option] Use an ArrayRef to store the Option Infos in OptTable. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250901 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-21 16:30:42 +00:00