Commit Graph

184102 Commits

Author SHA1 Message Date
Eric Christopher 896044822e Reset the target options and optimization level as the first
thing we do inside selection dag. This code needs to be
migrated to queries on the function rather than global
data, but this organizes things before we start grabbing
the subtarget.

llvm-svn: 219271
2014-10-08 01:58:01 +00:00
Eric Christopher 8d07f44560 Have the selection dag grab TargetLowering off of the subtarget
inside init rather than have it passed in as an argument.

llvm-svn: 219270
2014-10-08 01:57:58 +00:00
Shawn Best 1ded74a8c4 Minor comment change to test out svn access
llvm-svn: 219269
2014-10-08 01:50:37 +00:00
Nick Kledzik 14b5d208cb [mach-o] Support fat archives
mach-o supports "fat" files which are a header/table-of-contents followed by a
concatenation of mach-o files (or archives of mach-o files) built for
different architectures.  Previously, the support for fat files was in the
MachOReader, but that only supported fat .o files and dylibs (not archives).

The fix is to put the fat handing into MachOFileNode.  That way any input file
kind (including archives) can be fat.  MachOFileNode selects the sub-range
of the fat file that matches the arch being linked and creates a MemoryBuffer
for just that subrange.

llvm-svn: 219268
2014-10-08 01:48:10 +00:00
Rui Ueyama f20143825c [PECOFF] Move a function out of a class
I'm going to use this function both for the import table and the
delay-import table.

llvm-svn: 219267
2014-10-08 01:48:08 +00:00
Reid Kleckner 026e874a97 Fix test case in no asserts build
llvm-svn: 219266
2014-10-08 01:13:51 +00:00
Reid Kleckner 453e056467 Fix IRGen for referencing a static local before emitting its decl
Summary:
Previously CodeGen assumed that static locals were emitted before they
could be accessed, which is true for automatic storage duration locals.
However, it is possible to have CodeGen emit a nested function that uses
a static local before emitting the function that defines the static
local, breaking that assumption.

Fix it by creating the static local upon access and ensuring that the
deferred function body gets emitted. We may not be able to emit the
initializer properly from outside the function body, so don't try.

Fixes PR18020.  See also previous attempts to fix static locals in
PR6769 and PR7101.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 219265
2014-10-08 01:07:54 +00:00
Hans Wennborg 1256198bbc Revert r219175 - [InstCombine] re-commit r218721 icmp-select-icmp optimization
This seems to have caused PR21199.

llvm-svn: 219264
2014-10-08 01:05:57 +00:00
Jim Ingham 8b91d0cd01 Fix stepping over the inserted breakpoint trap when the NEXT instruction
also contains a breakpoint.

<rdar://problem/18519712>

llvm-svn: 219263
2014-10-08 01:03:54 +00:00
Eric Christopher d9636c1dcf Have SelectionDAG's subtarget TargetSelectionDAGInfo be set
during init rather than construction time.

llvm-svn: 219262
2014-10-08 00:32:59 +00:00
Alexey Samsonov 4b4d64bce4 [DebugInfo] Pass DWARFSection down to DWARFUnit constructor (NFC).
Keep the actual section contents and the relocation map together.

llvm-svn: 219261
2014-10-08 00:24:41 +00:00
Nick Kledzik 7c3f6ac57e [Support] Add MemoryBuffer::getFileSlice()
mach-o supports "fat" files which are a header/table-of-contents followed by a
concatenation of mach-o files built for different architectures. Currently, 
MemoryBuffer has no easy way to map a subrange (slice) of a file which lld
will need to select a mach-o slice of a fat file. The new function provides 
an easy way to map a slice of a file into a MemoryBuffer. Test case included.

llvm-svn: 219260
2014-10-08 00:22:18 +00:00
Alexey Samsonov 8cd4c9d947 [DebugInfo] Pass DWARFSection into DWARFUnitSection constructor (NFC).
llvm-svn: 219259
2014-10-08 00:07:53 +00:00
Rafael Espindola fcfbcc6d10 Avoid code duplication by calling setAliasAttributes in EmitAliasDefinition.
llvm-svn: 219258
2014-10-08 00:00:09 +00:00
Robin Morisset 880580b88f [X86] Fix a bug with fetch_add(INT32_MIN)
Summary:
Fix pr21099

The pseudocode of what we were doing (spread through two functions) was:
if (operand.doesNotFitIn32Bits())
  Opc.initializeWithFoo();
if (operand < 0)
  operand = -operand;
if (operand.doesFitIn8Bits())
  Opc.initializeWithBar();
else if (operand.doesFitIn32Bits())
  Opc.initializeWithBlah();
doStuff(Opc);

So for operand == INT32_MIN, Opc was never initialized because the operand changes
from fitting in 32 bits to not fitting, causing the various bugs/error messages
noted by pr21099.

This patch adds an extra test at the beginning for this case, and an
llvm_unreachable to have better error message if the operand ends up
not fitting in 32-bits at the end.

Test Plan: new test + make check

Reviewers: jfb

Subscribers: llvm-commits

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

llvm-svn: 219257
2014-10-07 23:53:57 +00:00
Tom Stellard 845bb3c2fd R600/SI: Refactor VOP3 instruction defs
llvm-svn: 219256
2014-10-07 23:51:41 +00:00
Tom Stellard 0aec5877b6 R600/SI: Refactor VOPC instruction defs
llvm-svn: 219255
2014-10-07 23:51:39 +00:00
Tom Stellard bec5a249b3 R600/SI: Refactor VOP2 instruction defs
llvm-svn: 219254
2014-10-07 23:51:38 +00:00
Tom Stellard 94d2e99ceb R600/SI: Refactor VOP1 instruction defs
llvm-svn: 219253
2014-10-07 23:51:34 +00:00
Alexey Samsonov 28bfd89a39 [DebugInfo] Turn DWARFContext::Section into DWARFSection (NFC).
It would be more convenient to pass DWARFSection into DWARFUnitSection
constructor, instead of passing its components (Data and RelocAddrMap)
as a separate arguments.

llvm-svn: 219252
2014-10-07 23:45:11 +00:00
Jason Molenda ac18ea7abb Update TestInlinedBreakpoints to reflect the fact that
the default search method is "always" as of r218405.

For the purposes of this test, set it back to "headers"
to confirm that the file+line breakpoint doesn't work,
then verify that it does work with "always".  Leave it
in "always" setting.
<rdar://problem/18564244> 

llvm-svn: 219251
2014-10-07 23:37:28 +00:00
Kaelyn Takata 1353fe8bde Add return value and negative checks to MapVector::erase from r219240.
llvm-svn: 219250
2014-10-07 23:11:49 +00:00
David Blaikie c6c6c7b177 DebugInfo+DFSan: Ensure that debug info references to llvm::Functions remain pointing to the underlying function when wrappers are created
This is somewhat the inverse of how similar bugs in DAE and ArgPromo
manifested and were addressed. In those passes, individual call sites
were visited explicitly, and then the old function was deleted. This
left the debug info with a null llvm::Function* that needed to be
updated to point to the new function.

In the case of DFSan, it RAUWs the old function with the wrapper, which
includes debug info. So now the debug info refers to the wrapper, which
doesn't actually have any instructions with debug info in it, so it is
ignored entirely - resulting in a DW_TAG_subprogram with no high/low pc,
etc. Instead, fix up the debug info to refer to the original function
after the RAUW messed it up.

Reviewed/discussed with Peter Collingbourne on the llvm-dev mailing
list.

llvm-svn: 219249
2014-10-07 22:59:46 +00:00
Enrico Granata 95c39ce2f3 Change this test case so that it no longer fails in the face of Bug 21190. The failure and the bug are entirely unrelated, and it's trivial to write a repro case for that bug anyway, so no need to use this complicated test case
llvm-svn: 219248
2014-10-07 22:57:57 +00:00
Jason Molenda a410679ed6 When we detect a stack unwind loop, before we abort
the backtrace, try falling back to the architecture default
unwind plan and see if we can backtrace a little further.
<rdar://problem/18556719> 

llvm-svn: 219247
2014-10-07 22:55:13 +00:00
Rui Ueyama 8951520c23 [PECOFF] Remove yet another use of _is64
No functionality change intended.

llvm-svn: 219246
2014-10-07 22:20:21 +00:00
Enrico Granata 29551955a9 The type category enable * was implemented assuming a previous disable * had happened. While that will most likely be true in practice, the consequences of this not being the case will be a crash. I fix the crash by doing two things: 1) don't let already-enabled categories be enabled anyway; 2) if a category were disabled but with a bogus last-enabled position - highly highly unlikely - just put it in the first empty slot. I am not so sure 2) is bulletproof perfect, but I also don't think 2) will practically ever happen
llvm-svn: 219245
2014-10-07 22:15:27 +00:00
Lang Hames 2959356958 [Bugpoint] Close error log in ProcessFailure. Bugpoint had been failing to close
this, and in some circumstances (e.g. reducing particularly large test-cases)
this was causing bugpoint to be killed for hitting open file-handle limits.

No test case: I was only able to trigger this with test cases taking upwards of
10 mins to run.

llvm-svn: 219244
2014-10-07 21:47:23 +00:00
Marshall Clow a2a481e0e3 Fix for PR 19616: 'tuple_cat of nested tuples fails in noexcept specification'. Thanks to Louis Dionne for the fix.
llvm-svn: 219243
2014-10-07 21:42:12 +00:00
Matt Arsenault 1f0227a452 R600: Remove dead code
llvm-svn: 219242
2014-10-07 21:29:56 +00:00
Duncan P. N. Exon Smith c46cfcbbc6 LoopUnroll: Create sub-loops in LoopInfo
`LoopUnrollPass` says that it preserves `LoopInfo` -- make it so.  In
particular, tell `LoopInfo` about copies of inner loops when unrolling
the outer loop.

Conservatively, also tell `ScalarEvolution` to forget about the original
versions of these loops, since their inputs may have changed.

Fixes PR20987.

llvm-svn: 219241
2014-10-07 21:19:00 +00:00
Kaelyn Takata 6ad1eb4b02 Add size_t MapVector::erase(KeyT) similar to the one in std::map.
llvm-svn: 219240
2014-10-07 21:15:51 +00:00
Duncan P. N. Exon Smith 9b4d37e8f5 LoopUnroll: Only check for ScalarEvolution analysis once, NFC
A follow-up commit will add use to a tight loop.  We might as well just
find it once anyway.

llvm-svn: 219239
2014-10-07 21:12:44 +00:00
Tom Stellard 2b8baaa546 R600: Remove some redundant initializations from AMDGPUMCAsmInfo
llvm-svn: 219238
2014-10-07 21:09:25 +00:00
Tom Stellard 022802ab37 R600: Use MCAsmInfoELF as AMDGPUMCAsmInfo base class
The main reason for this is that the MCAsmInfo class,
which we were previously using as the base class, sets
PrivateGlobalPrefix to "L", which causes all global
functions that start with L to be treated as local symbols.

MCAsmInfoELF sets PrivateGlobalPrefix to ".L", which is what
we want, and it is probably a good idea to use this as the
base class anyway, since we are emitting ELF binaries.

llvm-svn: 219237
2014-10-07 21:09:23 +00:00
Tom Stellard 20fa0be97f R600/SI: Remove assertion in SIInstrInfo::areLoadsFromSameBasePtr()
Added a FIXME coment instead, we need to handle the case where the
two DS instructions being compared have different numbers of operands.

llvm-svn: 219236
2014-10-07 21:09:20 +00:00
Rafael Espindola 506c684d55 Don't check for null after calling COFFObjectFile::toSec.
It can only return null if passed a corrupted reference with a null Ref.p.
Checking for null is then an issue for asserts to check for internal
consistency, not control flow to check for invalid input.

I didn't add an assert(sec != nullptr) because toSec itself has a far more
complete assert.

llvm-svn: 219235
2014-10-07 21:03:22 +00:00
Jim Ingham b7bee50062 This test case was incorrect, it was relying on the fact
that the function we were calling would continue to sleep
for the requested time even if it was interrupted.  That is
not true of std::this_thread::sleep_for, at least not on OS X.

Fix the test case so that if it wakes up early, it goes back
to sleep till the time is actually greater than the end point.

<rdar://problem/18523742>

llvm-svn: 219234
2014-10-07 20:59:00 +00:00
Rafael Espindola a92608657f Optimize COFFObjectFile::sectionContainsSymbol a bit.
There is no need to compute the coff_section of the symbol just to compare the
pointer.

Inspired by the ELF implementation.

llvm-svn: 219233
2014-10-07 20:42:47 +00:00
Zachary Turner 5cbeb850fb Fix compile error on Windows.
llvm-svn: 219232
2014-10-07 20:34:36 +00:00
Ed Maste 89b80fb022 Avoid bashisms and switch to /bin/sh
Bash may not be installed on some systems by default, like FreeBSD.

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

llvm-svn: 219231
2014-10-07 20:23:57 +00:00
Tom Stellard bf9f76fbe0 Implement log1p builtin
llvm-svn: 219230
2014-10-07 20:22:42 +00:00
Saleem Abdulrasool 64d491e488 MC: add support for -aligncomm GNU extension
The GNU linker supports an -aligncomm directive that allows for power-of-2
alignment of common data.  Add support to emit this directive.

llvm-svn: 219229
2014-10-07 19:37:57 +00:00
Saleem Abdulrasool f95786324c llvm-readobj: add support to dump (COFF) directives
PE/COFF has a special section (.drectve) which can be used to pass options to
the linker (similar to LC_LINKER_OPTION).  Add support to llvm-readobj to print
the contents of the section for tests.

llvm-svn: 219228
2014-10-07 19:37:52 +00:00
Ed Maste 1419e9adb5 Run profile tests on FreeBSD
FreeBSD does not have libdl, so set it via lit.cfg instead of the test
input, as with asan.  Also remove it from Darwin test runs - it's not
necessary, but harmless there.

Add FreeBSD to the list of hosts to test.

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

llvm-svn: 219227
2014-10-07 19:24:24 +00:00
Rafael Espindola d2c7fd8207 Remove the IsVolatileSize parameter of getOpenFileSlice.
getOpenFileSlice gets passed the map size, so it makes no sense to say that
the size is volatile. The code will not even compute the size.

llvm-svn: 219226
2014-10-07 19:09:05 +00:00
Fariborz Jahanian 80ebf8da7e Objective-C SDK modernization. When modernizing to
use NS_ENUM/NS_OPTIONS macros, add an import of
Foundation.h (or its module) as necessary.
rdar://18498550

llvm-svn: 219225
2014-10-07 19:01:46 +00:00
Rafael Espindola 0cb3c9bb24 Be consistent about using "const Twine &" for filenames.
On this file we had a mix of
* Twine
* const char *
* StringRef

The two that make sense are
* const Twine & (caller convenience)
* consc char * (that is what will eventually be passed to open.

Given that sys::fs::openFileForRead takes a "const Twine &", I picked that.

llvm-svn: 219224
2014-10-07 18:58:55 +00:00
Marcello Maggioni 963bc87dbd Two case switch to select optimization
This optimization tries to convert switch instructions that are used to select a value with only 2 unique cases + default block
to a select or a couple of selects (depending if the default block is reachable or not).

The typical case this optimization wants to be able to optimize is this one:

Example:
switch (a) {
  case 10:                %0 = icmp eq i32 %a, 10
    return 10;            %1 = select i1 %0, i32 10, i32 4
  case 20:        ---->   %2 = icmp eq i32 %a, 20
    return 2;             %3 = select i1 %2, i32 2, i32 %1
  default:
    return 4;
}

It also sets the base for further optimizations that are planned and being reviewed.

llvm-svn: 219223
2014-10-07 18:16:44 +00:00
Richard Smith 640775b428 PR21180: Lambda closure types are neither aggregates nor literal types.
llvm-svn: 219222
2014-10-07 18:01:33 +00:00