Commit Graph

124025 Commits

Author SHA1 Message Date
Teresa Johnson
78b70af914 Fix mapping of unmaterialized global values during metadata linking
Summary:
The patch to move metadata linking after global value linking didn't
correctly map unmaterialized global values to null as desired. They
were in fact mapped to the source copy. It largely worked by accident
since most module linker clients destroyed the source module which
caused the source GVs to be replaced by null, but caused a failure with
LTO linking on Windows:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312869.html

The problem is that a null return value from materializeValueFor is
handled by mapping the value to self. This is the desired behavior when
materializeValueFor is passed a non-GlobalValue. The problem is how to
distinguish that case from the case where we really do want to map to
null.

This patch addresses this by passing in a new flag to the value mapper
indicating that unmapped global values should be mapped to null. Other
Value types are handled as before.

Note that the documented behavior of asserting on unmapped values when
the flag RF_IgnoreMissingValues isn't set is currently disabled with
FIXME notes due to bootstrap failures. I modified these disabled asserts
so when they are eventually enabled again it won't assert for the
unmapped values when the new RF_NullMapMissingGlobalValues flag is set.

I also considered using a callback into the value materializer, but a
flag seemed cleaner given that there are already existing flags.
I also considered modifying materializeValueFor to return the input
value when we want to map to source and then treat a null return
to mean map to null. However, there are other value materializer
subclasses that implement materializeValueFor, and they would all need
to be audited and the return values possibly changed, which seemed
error-prone.

Reviewers: dexonsmith, joker.eph

Subscribers: pcc, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253170 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-15 14:50:14 +00:00
James Molloy
fb7bc35602 [GlobalOpt] Demote globals to locals more aggressively
Global to local demotion can speed up programs that use globals a lot. It is particularly useful with LTO, when the entire call graph is known and most functions have been internalized.

For a global to be demoted, it must only be accessed by one function and that function:
  1. Must never recurse directly or indirectly, else the GV would be clobbered.
  2. Must never rely on the value in GV at the start of the function (apart from the initializer).

GlobalOpt can already do this, but it is hamstrung and only ever tries to demote globals inside "main", because C++ gives extra guarantees about how main is called - once and only once.

In LTO mode, we can often prove the first property (if the function is internal by this point, we know enough about the callgraph to determine if it could possibly recurse). FunctionAttrs now infers the "norecurse" attribute for this reason.

The second property can be proven for a subset of functions by proving that all loads from GV are dominated by a store to GV. This is conservative in the name of compile time - this only requires a DominatorTree which is fairly cheap in the grand scheme of things. We could do more fancy stuff with MemoryDependenceAnalysis too to catch more cases but this appears to catch most of the useful ones in my testing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253168 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-15 14:21:37 +00:00
Alex Denisov
fd671c136f [Docs] Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253167 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-15 14:13:24 +00:00
Igor Breger
9b249d9b29 Revert r253160.
It broke layering violation. Reproducible with BUILD_SHARED_LIBS=ON.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253163 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-15 12:19:11 +00:00
Elena Demikhovsky
f79c5ce90b Fixed GEP visitor in the InstCombine pass.
The current implementation of GEP visitor in InstCombine fails with assertion on Vector GEP with mix of scalar and vector types, like this:

getelementptr double, double* %a, <8 x i32> %i
(It fails to create a "sext" from <8 x i32> to <8 x i64>)

I fixed it and added some tests.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253162 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-15 08:19:35 +00:00
Igor Breger
42aedb2949 AVX512: Implemented encoding and intrinsics for VMOVSHDUP/VMOVSLDUP instructions.
Differential Revision: http://reviews.llvm.org/D14322

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253160 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-15 07:23:13 +00:00
Dylan McKay
7e57305376 NFC: Document MSVC getters on Triple
Summary:
Document the differences between the isKnownWindowsMSVC() and isWindowsMSVC() methods on Triple.

Also removed the '\brief' Doxygen annotations - now that 'AUTOBRIEF' is set to on, they are unnecessary.

Subscribers: jfb, tberghammer, danalbert, srhines, dschuff

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253159 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-15 05:43:11 +00:00
Teresa Johnson
778af35f66 Use a different block id for block of metadata kind records
Summary:
There are currently two blocks with the METADATA_BLOCK id at module
scope. The first has the module-level metadata values (consisting of
some combination of METADATA_* record codes except for METADATA_KIND).
The second consists only of METADATA_KIND records. The latter is used
only in the METADATA_ATTACHMENT block within function blocks (for
metadata attached to instructions).

For ThinLTO we want to delay the parsing of module level metadata
until all functions have been imported from that module (there is some
bookkeeping used to suture it up when we read it during a post-pass).
However, we do need the METADATA_KIND records when parsing the function
body during importing, since those kinds are used as described above.

To simplify identification and parsing of just the block containing
the metadata kinds, use a different block id (METADATA_KIND_BLOCK_ID).
Support older bitcode without the new block id as well.

Reviewers: dexonsmith, joker.eph

Subscribers: davidxl, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253154 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-15 02:00:09 +00:00
Dan Gohman
1fbb445098 [WebAssembly] Minor code simplification. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253150 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 23:28:15 +00:00
Dan Gohman
df0392d2b2 [WebAssembly] Make indentation consistent with the other testcases. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253149 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 23:17:07 +00:00
Dan Gohman
ccb28273c8 [WebAssembly] Support signext, zeroext, and several other function attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253148 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 23:15:41 +00:00
Dan Gohman
6d9e0cc0e7 [WebAssembly] Change int_wasm_memory_size from IntrNoMem to IntrReadMem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253147 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 23:02:31 +00:00
Simon Pilgrim
2cfd2548d0 [X86][SSE] Fixed arch/triple and regenerated results.
Tidyup before diffs from new patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253144 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 20:42:01 +00:00
Davide Italiano
51ad607ad8 [llvm-ar] Use failIfError/fail helpers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253141 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 19:00:33 +00:00
Davide Italiano
8baf5a3c92 [llvm-ar] Use fail() helper to reduce duplication.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253139 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 18:33:47 +00:00
Davide Italiano
40f8af081b [llvm-ar] Simplify the code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253138 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 18:25:18 +00:00
Simon Pilgrim
61dca0338f [X86][SSE] Added extra vector truncation tests
Baseline comparison to D14588

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253132 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 15:23:59 +00:00
Akira Hatanaka
55c0268714 Reduce the size of MCRelaxableFragment.
MCRelaxableFragment previously kept a copy of MCSubtargetInfo and
MCInst to enable re-encoding the MCInst later during relaxation. A copy
of MCSubtargetInfo (instead of a reference or pointer) was needed
because the feature bits could be modified by the parser.

This commit replaces the MCSubtargetInfo copy in MCRelaxableFragment
with a constant reference to MCSubtargetInfo. The copies of
MCSubtargetInfo are kept in MCContext, and the target parsers are now
responsible for asking MCContext to provide a copy whenever the feature
bits of MCSubtargetInfo have to be toggled.
 
With this patch, I saw a 4% reduction in peak memory usage when I
compiled verify-uselistorder.lto.bc using llc.

rdar://problem/21736951

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253127 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 06:35:56 +00:00
Michael Zolotukhin
09dcb16d13 Don't recompute LCSSA after loop-unrolling when possible.
Summary:
Currently we always recompute LCSSA for outer loops after unrolling an
inner loop. That leads to compile time problem when we have big loop
nests, and we can solve it by avoiding unnecessary work. For instance,
if w eonly do partial unrolling, we don't break LCSSA, so we don't need
to rebuild it. Also, if all exits from the inner loop are inside the
enclosing loop, then complete unrolling won't break LCSSA either.

I replaced unconditional LCSSA recomputation with conditional recomputation +
unconditional assert and added several tests, which were failing when I
experimented with it.

Soon I plan to follow up with a similar patch for recalculation of dominators
tree.

Reviewers: hfinkel, dexonsmith, bogner, joker.eph, chandlerc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253126 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 05:51:41 +00:00
Akira Hatanaka
ff528b6f03 [MCTargetAsmParser] Move the member varialbes that reference
MCSubtargetInfo in the subclasses into MCTargetAsmParser and define a
member function getSTI.

This is done in preparation for making changes to shrink the size of
MCRelaxableFragment. (see http://reviews.llvm.org/D14346).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253124 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 05:20:05 +00:00
Eric Christopher
d1b0795570 Add MMX to the 3dnow enum and propagate changes around. This makes
it somewhat more consistent with how the feature is used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253122 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 03:04:00 +00:00
Quentin Colombet
8d80702537 [ShrinkWrapping] Disable the optimization for functions with sanitize like
attribute.

Even if the target supports shrink-wrapping, the prologue and epilogue
must not move because a crash can happen anywhere and sanitizers need
to be able to unwind from the PC of the crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253116 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 01:55:17 +00:00
David Blaikie
cbf7d4abb0 Remove some unused includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253115 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 01:32:27 +00:00
Sanjoy Das
5c152c3599 [RuntimeDyld] Fix indentation and whitespace; NFC
Whitespace-only change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253105 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-14 00:16:15 +00:00
Justin Bogner
2814318a45 AArch64: Default AArch64Subtarget::ReserveX18 to true on darwin
Darwin reserves x18, so it's never ABI compliant to generate code that
uses it. Set the default value based on the OS part of the triple
rather than forcing front-ends to set the +reserve-x18 target feature
in order to build correct code for Darwin.

This will make r243310 redundant, so I'll revert that shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253102 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 23:05:46 +00:00
Matthias Braun
f724d184fb MachineScheduler: Print initial pressure in debug dump
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253097 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 22:30:31 +00:00
Matthias Braun
17da66b18b MachineScheduler: Improve debug output for "only one node in readyset"
When there is only 1 node left in the ready queue and it is picked call
the reason "ONLY1" instead of "NOCAND".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253096 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 22:30:29 +00:00
Matthias Braun
ca7d645a60 tablegen: Add a simple heuristic to get better names for pressure sets
Differential Revision: http://reviews.llvm.org/D14597

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253095 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 22:30:27 +00:00
Chad Rosier
2588aa9425 [LIR] Add support for creating memcpys from loops with a negative stride.
This allows us to transform the below loop into a memcpy.

void test(unsigned *__restrict__ a, unsigned *__restrict__ b) {
  for (int i = 2047; i >= 0; --i) {
    a[i] = b[i];
  }
}

This is the memcpy version of r251518, which added support for memset with
negative strided loops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253091 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 21:51:02 +00:00
Colin LeMahieu
3b47b1f0e2 [Hexagon] Fixing memory leak during relaxation by allocating MCInst in MCContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253090 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 21:45:50 +00:00
Reid Kleckner
c6477179dd [WinEH] Fix ESP management with 32-bit __CxxFrameHandler3
The C++ EH personality automatically restores ESP from the C++ EH
registration node after a catchret. I mistakenly thought it was like
SEH, which does not restore ESP.

It makes sense for C++ EH to differ from SEH here because SEH does not
use funclets for catches, and does not allow catching inside of finally.
C++ EH may need to unwind through multiple catch funclets and eventually
catchret to some outer funclet. Therefore, the runtime has to keep track
of which ESP to use with catchret, rather than having the compiler
reload it manually.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253084 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 21:27:00 +00:00
Evgeniy Stepanov
e528e5711e [safestack] Rewrite isAllocaSafe using SCEV.
Use ScalarEvolution to calculate memory access bounds.
Handle function calls based on readnone/nocapture attributes.
Handle memory intrinsics with constant size.

This change improves both recall and precision of IsAllocaSafe.
See the new tests (ex. BitCastWide) for the kind of code that was wrongly
classified as safe.

SCEV efficiency seems to be limited by the fact the SafeStack runs late
(in CodeGenPrepare), and many loops are unrolled or otherwise not in LCSSA.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253083 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 21:21:42 +00:00
Akira Hatanaka
6dc74bec88 [Docs] Fix warning "Title underline too short."
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253082 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 21:09:57 +00:00
Dan Gohman
061211b22d [WebAssembly] Rename the Const instructions to be upper-case too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253072 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 20:27:45 +00:00
Diego Novillo
dbe26eba86 SamplePGO - Add dump routines for LineLocation, SampleRecord and FunctionSamples
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253071 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 20:24:28 +00:00
Dan Gohman
3015ca5f45 [WebAssembly] Rename memory intrinsics to be upper-case, following convention. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253070 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 20:19:11 +00:00
Cong Hou
59f2cd8a68 [X86][SSE] Combine UNPCKL with vector_shuffle into UNPCKH to save one instruction for sext from v16i8 to v16i16 and v8i16 to v8i32.
This patch is enabling combining UNPCKL with vector_shuffle that moves the upper
half of a vector into the lower half, into a UNPCKH instruction. For example:

t2: v16i8 = vector_shuffle<8,9,10,11,12,13,14,15,u,u,u,u,u,u,u,u> t1, undef:v16i8
t3: v16i8 = X86ISD::UNPCKL undef:v16i8, t2

will be combined to:

t3: v16i8 = X86ISD::UNPCKH undef:v16i8, t1


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




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253067 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 19:47:43 +00:00
David Blaikie
6c420832f3 dwarfdump: Add support for dumping the table contents of DWP indexes
This is a recommit of 252842 which was reverted in 252859. The issue was
using %s format specifier for a StringRef - used Format's
left_justify(StringRef, int) instead.

It'd be nice to have __attribute__((format(..))) on llvm::format, but
apparently it's only implemented for c-style variadics, not C++ variadic
templates. Perhaps we could fix that & conditionalize the attribute on
such...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253065 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 19:18:49 +00:00
Chad Rosier
64294426ea Add a comment that should have made my last commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253063 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 19:13:40 +00:00
Reid Kleckner
54f4d61d68 Add missing triple to WinEH test case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253062 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 19:11:12 +00:00
Chad Rosier
2f2a7ed5df [LIR] Factor out the code to compute base ptr for negative strided loops.
This will allow for the code to be reused in the memcpy optimization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253061 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 19:11:07 +00:00
Reid Kleckner
04538c959e [WinEH] Make UnwindHelp a fixed stack object allocated after XMM CSRs
Now the offset of UnwindHelp in our EH tables and the offset that we
store to in the prologue agree.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253059 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 19:06:01 +00:00
Colin LeMahieu
6de64e032f [Hexagon] Factoring bundle creation in to a utility function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253056 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 17:42:46 +00:00
Tom Stellard
bcfbdf7afe AMDGPU: Add stony support
Patch by: Alex Deucher

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253053 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 17:06:32 +00:00
Tom Stellard
c552d8f09a ELFYAML: Add support for parsing AMDGPU section attribute flags
Reviewers: silvas

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253052 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 17:06:29 +00:00
Reid Kleckner
84831cda66 [Symbolizer] Don't use PE symbol tables to override PDB symbols
Summary:
PE files are stripped by default, and only contain the names of exported
symbols.

The actual reason that we bother to do this override by default is
actually due to a quirk of the way -gline-tables-only is implemented, so
I phrased the check as "if we are symbolizing from dwarf, do the symtab
override".

This fixes lots of Windows ASan tests that I broke in r250582.

Reviewers: samsonov

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253051 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 17:00:36 +00:00
Sanjay Patel
e3049a74d7 use range-based for loop; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253048 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 16:21:23 +00:00
James Molloy
b5ab3ba365 [ARM] Replace ARMISD::RBIT with ISD::BITREVERSE
ISD::BITREVERSE matches "rbit" completely, so remove ARMISD::RBIT and mark ISD::BITREVERSE as legal, adding a test for lowering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253047 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 16:05:22 +00:00
Artyom Skrobov
b2446842b9 Fixing a typo in docs/CodeGenerator.rst
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253045 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 15:14:04 +00:00
Zlatko Buljan
055b23b90e [mips][microMIPS] Implement SHRA[_R].PH, SHRAV[_R].PH, SHRAV[_R].QB, SHRAV_R.W, SHRA_R.W, SHRL.PH, SHRL.QB, SHRLV.PH and SHRLV.QB instructions
Differential Revision: http://reviews.llvm.org/D14010


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253041 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 13:14:25 +00:00