Commit Graph

80768 Commits

Author SHA1 Message Date
Chandler Carruth
1c1448984d Simplify the pair optimization. Rather than using complex type traits,
just ensure that the number of bytes in the pair is the sum of the bytes
in each side of the pair. As long as thats true, there are no extra
bytes that might be padding.

Also add a few tests that previously would have slipped through the
checking. The more accurate checking mechanism catches these and ensures
they are handled conservatively correctly.

Thanks to Duncan for prodding me to do this right and more simply.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151891 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 10:56:40 +00:00
Evgeniy Stepanov
d8313be410 ASan: use getTypeAllocSize instead of getTypeStoreSize.
This change replaces getTypeStoreSize with getTypeAllocSize in AddressSanitizer
instrumentation for stack allocations.

One case where old behaviour produced undesired results is an optimization in
InstCombine pass (PromoteCastOfAllocation), which can replace  alloca(T) with
alloca(S), where S has the same AllocSize, but a smaller StoreSize. Another
case is memcpy(long double => long double), where ASan will poison bytes 10-15
of a stack-allocated long double (StoreSize  10, AllocSize 16,
sizeof(long double) = 16).

See http://llvm.org/bugs/show_bug.cgi?id=12047 for more context.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151887 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 10:41:08 +00:00
Chandler Carruth
c3f99182be Add a golden data test that I missed somehow the first time around.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151886 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 10:01:29 +00:00
Chandler Carruth
4fc5bdf16e Fix bad indenting that was left over from cut/paste of the golden values
for 32-bit builds in here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151885 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 10:01:27 +00:00
Chandler Carruth
88c48fae69 Add a header that was technically missing to see if this gets the
offsetof buildbot errors to go away...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151884 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 09:46:02 +00:00
Chandler Carruth
4d628e200f We really want to hash pairs of directly-hashable data as directly
hashable data. This matters when we have pair<T*, U*> as a key, which is
quite common in DenseMap, etc. To that end, we need to detect when this
is safe. The requirements on a generic std::pair<T, U> are:

1) Both T and U must satisfy the existing is_hashable_data trait. Note
   that this includes the requirement that T and U have no internal
   padding bits or other bits not contributing directly to equality.
2) The alignment constraints of std::pair<T, U> do not require padding
   between consecutive objects.
3) The alignment constraints of U and the size of T do not conspire to
   require padding between the first and second elements.

Grow two somewhat magical traits to detect this by forming a pod
structure and inspecting offset artifacts on it. Hopefully this won't
cause any compilers to panic.

Added and adjusted tests now that pairs, even nested pairs, are treated
as just sequences of data.

Thanks to Jeffrey Yasskin for helping me sort through this and reviewing
the somewhat subtle traits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151883 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 09:26:36 +00:00
Chandler Carruth
c7384cfc7a Add support for hashing pairs by delegating to each sub-object. There is
an open question of whether we can do better than this by treating pairs
as boring data containers and directly hashing the two subobjects. This
at least makes the API reasonable.

In order to make this change, I reorganized the header a bit. I lifted
the declarations of the hash_value functions up to the top of the header
with their doxygen comments as these are intended for users to interact
with. They shouldn't have to wade through implementation details. I then
defined them at the very end so that they could be defined in terms of
hash_combine or any other hashing infrastructure.

Added various pair-hashing unittests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151882 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 08:32:29 +00:00
Chad Rosier
74bab7f597 Prevent obscure and incorrect tail-call optimization.
In this instance we are generating the tail-call during legalizeDAG.  The 2nd
floor call can't be a tail call because it clobbers %xmm1, which is defined by
the first floor call.  The first floor call can't be a tail-call because it's
not in the tail position.  The only reasonable way I could think to fix this
in a target-independent manner was to check for glue logic on the copy reg.

rdar://10930395


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151877 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 02:50:46 +00:00
Eric Christopher
b83e2bbfbc Grammar-o in function name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151875 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 02:11:47 +00:00
Eric Christopher
61cafd1449 Grammar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151874 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 01:57:55 +00:00
Eric Christopher
50e266135e If the linkage name doesn't exist we're supposed to emit a reference
to the string table for the function name, not the function name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151873 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 01:57:52 +00:00
Dan Gohman
70e2968866 Fix an iterator invalidation problem. operator[] on a DenseMap
can insert a new element, invalidating iterators. Use find
instead, and handle the case where the key is not found explicitly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151871 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 01:26:46 +00:00
Dan Gohman
22cc4ccc9e Misc micro-optimizations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151869 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 01:13:53 +00:00
Chandler Carruth
4166989f10 Remove the misguided extension here that reserved two special values in
the hash_code. I'm not sure what I was thinking here, the use cases for
special values are in the *keys*, not in the hashes of those keys.

We can always resurrect this if needed, or clients can accomplish the
same goal themselves. This makes the general case somewhat faster (~5
cycles faster on my machine) and smaller with less branching.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151865 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 00:48:38 +00:00
Eric Christopher
7550f7dce6 Revert "Reorder the sections being output to reduce the number of assembler"
The inline table needs to be constructed ahead of time so that it doesn't try to
create new strings while we're emitting everything.

This reverts commit a8ff9bccb399183cdd5f1c3cec2bda763664b4b0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151864 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 00:30:24 +00:00
Evan Cheng
fc501a3ec9 Neuter the optimization I implemented with r107852 and r108258 which turn some
floating point equality comparisons into integer ones with -ffast-math. The
issue is the optimization causes +0.0 != -0.0.

Now the optimization is only done when one side is known to be 0.0. The other
side's sign bit is masked off for the comparison.

rdar://10964603


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151861 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 23:27:13 +00:00
Chandler Carruth
5a491ca98e Re-disable the debug output. The comment is there explaining why we want
to keep this around -- updating golden tests is annoying otherwise.

Thanks to Benjamin for pointing this omission out on IRC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151860 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 23:20:45 +00:00
Chandler Carruth
abe24cf037 Switch FoldingSet over to the new hashing infrastructure. We might want
to do more invasive refactoring here to get FoldingSet to use size_t or
even hash_code directly, but for now this is a good first step to remove
Yet Another Hashing Algorithm from LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151859 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 23:18:44 +00:00
Chandler Carruth
9731294171 Provide the 32-bit variant of the golden tests. Not sure how I forgot to
do this initially, sorry.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151857 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 23:06:19 +00:00
Jakob Stoklund Olesen
b24b820bd7 Handle regmasks in Thumb1RegisterInfo::saveScavengerRegister().
This function could have r12 live across a function call when compiling
thumb1 code.

The test case for this is not included because it is very long. It must
provoke emergency spilling near a function call. The behavior is
provoked by MultiSource/Applications/JM/lencod, and it triggers an
assertion in the scavenger.

<rdar://problem/10963642>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151855 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:57:32 +00:00
Eric Christopher
12313a56ec Reorder the sections being output to reduce the number of assembler
fixups that are being used to determine section offsets. Reduces
the total number of fixups by 50% for a non-trivial testcase.

Part of rdar://10413936

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151852 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:50:31 +00:00
Jim Grosbach
e751c0069a ARM use the right opcode for FP<->Integer move in fast-isel.
rdar://10965031

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151850 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:47:09 +00:00
Michael J. Spencer
647c0ce48c Minimal changes for LLVM to compile under VS11.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151849 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:42:52 +00:00
Akira Hatanaka
b2930b92d3 Changes for migrating to using register mask operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151847 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:27:29 +00:00
David Meyer
97f7787bfb [Object]
Add ObjectFile::getLoadName() for retrieving the soname/installname of a shared object.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151845 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:19:54 +00:00
Kevin Enderby
b0578512c7 Change ARMInstPrinter::printPredicateOperand() so it will not abort if it
runs into the undefined 15 condition code value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151844 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:13:02 +00:00
Akira Hatanaka
dfa27aea12 Fix bugs which were introduced when support for base+index floating point loads
and stores was added.

- SelectAddr should return false if Parent is an unaligned f32 load or store.
- Only aligned load and store nodes should be matched to select reg+imm
  floating point instructions.
- MIPS does not have support for f64 unaligned load or store instructions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151843 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:12:30 +00:00
Benjamin Kramer
97e910ecff BumpPtrAllocator: Make sure threshold cannot be initialized with a value smaller than the slab size.
This replaces r151834 with a simpler fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151842 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:10:16 +00:00
Chandler Carruth
b4d023503b Fix two warnings in this code that I missed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151839 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 21:45:51 +00:00
Argyrios Kyrtzidis
680458275f If BumpPtrAllocator is requested to allocate a size that exceeds the slab size,
increase the slab size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151834 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 20:36:32 +00:00
Preston Gurd
fa2ab3e4ab Trivial change to make the test use Use –mcpu=generic,
so that the test will not fail when run on an Intel Atom
processor, due to the Atom scheduler producing an instruction sequence that is
different from that which is normally expected.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151832 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 19:57:20 +00:00
Argyrios Kyrtzidis
925c3f0871 Move include/llvm/ADT/SaveAndRestore.h -> include/llvm/Support/SaveAndRestore.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151828 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 19:45:47 +00:00
Chandler Carruth
53930f6d08 Add the source file with trivial definitions in it that was missing from
r151822, sorry sorry. =[

We need 'git svn nothave' or some such...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151824 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 18:58:59 +00:00
Chandler Carruth
0b66c6fca2 Rewrite LLVM's generalized support library for hashing to follow the API
of the proposed standard hashing interfaces (N3333), and to use
a modified and tuned version of the CityHash algorithm.

Some of the highlights of this change:
 -- Significantly higher quality hashing algorithm with very well
    distributed results, and extremely few collisions. Should be close to
    a checksum for up to 64-bit keys. Very little clustering or clumping of
    hash codes, to better distribute load on probed hash tables.
 -- Built-in support for reserved values.
 -- Simplified API that composes cleanly with other C++ idioms and APIs.
 -- Better scaling performance as keys grow. This is the fastest
    algorithm I've found and measured for moderately sized keys (such as
    show up in some of the uniquing and folding use cases)
 -- Support for enabling per-execution seeds to prevent table ordering
    or other artifacts of hashing algorithms to impact the output of
    LLVM. The seeding would make each run different and highlight these
    problems during bootstrap.

This implementation was tested extensively using the SMHasher test
suite, and pased with flying colors, doing better than the original
CityHash algorithm even.

I've included a unittest, although it is somewhat minimal at the moment.
I've also added (or refactored into the proper location) type traits
necessary to implement this, and converted users of GeneralHash over.

My only immediate concerns with this implementation is the performance
of hashing small keys. I've already started working to improve this, and
will continue to do so. Currently, the only algorithms faster produce
lower quality results, but it is likely there is a better compromise
than the current one.

Many thanks to Jeffrey Yasskin who did most of the work on the N3333
paper, pair-programmed some of this code, and reviewed much of it. Many
thanks also go to Geoff Pike Pike and Jyrki Alakuijala, the original
authors of CityHash on which this is heavily based, and Austin Appleby
who created MurmurHash and the SMHasher test suite.

Also thanks to Nadav, Tobias, Howard, Jay, Nick, Ahmed, and Duncan for
all of the review comments! If there are further comments or concerns,
please let me know and I'll jump on 'em.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151822 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 18:55:25 +00:00
Benjamin Kramer
4b1212b4bf Move getSubRegIndex out of generated code into MCRegisterInfo, devirtualize it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151821 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 18:16:35 +00:00
Chad Rosier
b5372769eb Revert r151816 as Jim has the appropriate fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151818 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 17:41:19 +00:00
Chad Rosier
0affe8ae9c Fix testcases from r151807.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151816 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 17:31:30 +00:00
Jim Grosbach
b3acdcc00c Move TargetRegisterInfo::getSubReg() to MCRegisterInfo.
Allows us to de-virtualize the function and provides access to it in
the instruction printer, which is useful for handling composite
physical registers (e.g., ARM register lists).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151815 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 17:30:39 +00:00
Jim Grosbach
194f3fa9ea Revert "Emit the SubRegTable with the smallest possible integer type."
This reverts commit 151760.

We want to move getSubReg() from TargetRegisterInfo into MCRegisterInfo,
but to do that, the type of the lookup table needs to be the same for
all targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151814 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 17:30:35 +00:00
Jim Grosbach
1e33b461b4 Add missing triple for tests.
Make darwin bots happier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151813 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 17:30:32 +00:00
Jia Liu
b373647d47 rplace Alpha with ARM in docs/WritingAnLLVMBackend.html, patch by chenwj
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151811 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 15:14:19 +00:00
James Molloy
391016025a Fix a codegen fault in which log2 or exp2 could be dead-code eliminated even though they could have sideeffects.
Only allow log2/exp2 to be converted to an intrinsic if they are declared "readnone".



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151807 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 14:32:18 +00:00
Benjamin Kramer
ccc8d3ba06 Make TargetRegisterClasses non-virtual by making the only virtual function a function pointer.
This allows us to make TRC non-polymorphic and value-initializable, eliminating a huge static
initializer and a ton of cruft from the generated code.

Shrinks ARMBaseRegisterInfo.o by ~100k.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151806 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 13:37:55 +00:00
NAKAMURA Takumi
54d42a740d llvm/test/CMakeLists.txt: Update dependencies to add llvm-readobj to "check".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151795 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 03:14:13 +00:00
Benjamin Kramer
36a2138cce Emit the "is an intrinsic overloaded" table as a bitfield.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151792 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 02:16:57 +00:00
Akira Hatanaka
e9e520f23e Pass endian information to constructors. Define separate functions to create
objects for big endian and little endian targets.

Patch by Jack Carter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151788 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 01:53:15 +00:00
Jakob Stoklund Olesen
66c994c2db Make InlineSpiller bundle-aware.
Simply treat bundles as instructions. Spill code is inserted between
bundles, never inside a bundle.  Rewrite all operands in a bundle at
once.

Don't attempt and memory operand folding inside bundles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151787 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 01:43:25 +00:00
David Meyer
5c2b4ea73c [Object]
* Add begin_dynamic_table() / end_dynamic_table() private interface to ELFObjectFile.
* Add begin_libraries_needed() / end_libraries_needed() interface to ObjectFile, for grabbing the list of needed libraries for a shared object or dynamic executable.
* Implement this new interface completely for ELF, leave stubs for COFF and MachO.
* Add 'llvm-readobj' tool for dumping ObjectFile information.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151785 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 01:36:50 +00:00
Jakob Stoklund Olesen
741981adf3 Move getBundleStart() into MachineInstrBundle.h.
This allows the function to be inlined, and makes it suitable for use in
getInstructionIndex().

Also provide a const version. C++ is great for touch typing practice.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151782 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 01:26:01 +00:00
Benjamin Kramer
b519a0fe0e Emit the intrinsic modref info as a lookup table instead of a huge switch.
Shrinks BasicAliasAnalysis.o from 106k to 56k on i386.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151781 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 01:18:32 +00:00