1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
Commit Graph

63442 Commits

Author SHA1 Message Date
Alexey Samsonov
e77ca70e7a Tentative fix for global-buffer-overflow caused by r188426. Found by AddressSanitizer
llvm-svn: 188448
2013-08-15 07:11:34 +00:00
Craig Topper
a24309fc7f Use MVT instead of EVT in X86ISelDAGToDAG since all the types should be legal.
llvm-svn: 188446
2013-08-15 05:57:07 +00:00
Craig Topper
bd95e5b85f Use MVT in place of EVT in more X86 operation lowering functions.
llvm-svn: 188445
2013-08-15 05:33:45 +00:00
Craig Topper
8da1ee0773 Replace getValueType().getSimpleVT() with getSimpleValueType().
llvm-svn: 188442
2013-08-15 02:44:19 +00:00
Craig Topper
2653227b8f Replace getValueType().getSimpleVT() with getSimpleValueType(). Also remove one weird cast from MVT->EVT just to call getSimpleVT().
llvm-svn: 188441
2013-08-15 02:33:50 +00:00
Mark Lacey
681f92310a Auto-compute live intervals on demand.
When new virtual registers are created during splitting/spilling, defer
creation of the live interval until we need to use the live interval.

Along with the recent commits to notify LiveRangeEdit when new virtual
registers are created, this makes it possible for functions like
TargetInstrInfo::loadRegFromStackSlot() and
TargetInstrInfo::storeRegToStackSlot() to create multiple virtual
registers as part of the process of generating loads/stores for
different register classes, and then have the live intervals for those
new registers computed when they are needed.

llvm-svn: 188437
2013-08-14 23:50:16 +00:00
Mark Lacey
97c418e9a9 Notify LiveRangeEdit of new virtual registers.
Add a delegate class to MachineRegisterInfo with a single virtual
function, MRI_NoteNewVirtualRegister(). Update LiveRangeEdit to inherit
from this delegate class and override the definition of the callback
with an implementation that tracks the newly created virtual registers.

llvm-svn: 188435
2013-08-14 23:50:09 +00:00
Mark Lacey
6097c89b5a Track new virtual registers by register number.
Track new virtual registers by register number, rather than by the live
interval created for them. This is the first step in separating the
creation of new virtual registers and new live intervals.  Eventually
live intervals will be created and populated on demand after the virtual
registers have been created and used in instructions.

llvm-svn: 188434
2013-08-14 23:50:04 +00:00
Tom Stellard
0f3c885b1a R600/SI: Improve legalization of vector operations
This should fix hangs in the OpenCL piglit tests.

llvm-svn: 188431
2013-08-14 23:25:00 +00:00
Tom Stellard
20e208af7d R600/SI: Replace v1i32 type with i32 in imageload and sample intrinsics
llvm-svn: 188430
2013-08-14 23:24:53 +00:00
Tom Stellard
d7b0828247 R600/SI: Convert v16i8 resource descriptors to i128
Now that compute support is better on SI, we can't continue using v16i8
for descriptors since this is also a legal type in OpenCL.

This patch fixes numerous hangs with the piglit OpenCL test and since
we now use a target specific DAG node for LOAD_CONSTANT with the
correct MemOperandFlags, this should also fix:

https://bugs.freedesktop.org/show_bug.cgi?id=66805

llvm-svn: 188429
2013-08-14 23:24:45 +00:00
Tom Stellard
649e8ff0ee R600/SI: Lower BUILD_VECTOR to REG_SEQUENCE v2
Using REG_SEQUENCE for BUILD_VECTOR rather than a series of INSERT_SUBREG
instructions should make it easier for the register allocator to coalasce
unnecessary copies.

v2:
  - Use an SGPR register class if all the operands of BUILD_VECTOR are
    SGPRs.

llvm-svn: 188427
2013-08-14 23:24:32 +00:00
Tom Stellard
37ce97cebc R600/SI: Choose the correct MOV instruction for copying immediates
The instruction selector will now try to infer the destination register
so it can decided whether to use V_MOV_B32 or S_MOV_B32 when copying
immediates.

llvm-svn: 188426
2013-08-14 23:24:24 +00:00
Tom Stellard
599374cf06 R600/SI: Assign a register class to the $vaddr operand for MIMG instructions
The previous code declared the operand as unknown:$vaddr, which made
it possible for scalar registers to be used instead of vector registers.

llvm-svn: 188425
2013-08-14 23:24:17 +00:00
David Blaikie
d801507700 DebugInfo: Prefer references over pointers, pass by const reference for a type that will grow in the future
llvm-svn: 188422
2013-08-14 22:23:05 +00:00
Tom Stellard
6287532c80 R600/SI: Handle MSAA texture targets
Patch by: Marek Olšák

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
llvm-svn: 188421
2013-08-14 22:22:14 +00:00
Tom Stellard
5d16e4f78e R600/SI: Allow conversion between v32i8 and v8i32
Patch by: Marek Olšák

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
llvm-svn: 188420
2013-08-14 22:22:09 +00:00
Tom Stellard
9ea351d77c R600/SI: Fix an obvious typo
Patch by: Marek Olšák

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
llvm-svn: 188419
2013-08-14 22:22:03 +00:00
Tom Stellard
9e2fd5271f R600/SI: Add pattern for fp_to_uint
This fixes the F2U opcode for the Mesa driver.

Patch by: Marek Olšák

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
llvm-svn: 188418
2013-08-14 22:21:57 +00:00
Mark Lacey
c3ab3bb4bc Fix small typo: s/succ/Succ/
llvm-svn: 188415
2013-08-14 22:11:42 +00:00
Peter Collingbourne
8968732c46 DataFlowSanitizer: Instrumentation for memset.
Differential Revision: http://llvm-reviews.chandlerc.com/D1395

llvm-svn: 188412
2013-08-14 20:51:38 +00:00
Hal Finkel
a89d228510 Actually fix PPC64 64-bit GPR inline asm constraint matching
This is a follow-up to r187693, correcting that code to request the correct
register class. The previous version, with the wrong register class, was not
really correcting the constraints, but rather was removing them. Coincidentally,
this fixed the failing test case in r187693, but obviously created other
problems.

llvm-svn: 188407
2013-08-14 20:05:04 +00:00
Peter Collingbourne
905e1efbe5 DataFlowSanitizer: greylist is now ABI list.
This replaces the old incomplete greylist functionality with an ABI
list, which can provide more detailed information about the ABI and
semantics of specific functions.  The pass treats every function in
the "uninstrumented" category in the ABI list file as conforming to
the "native" (i.e. unsanitized) ABI.  Unless the ABI list contains
additional categories for those functions, a call to one of those
functions will produce a warning message, as the labelling behaviour
of the function is unknown.  The other supported categories are
"functional", "discard" and "custom".

- "discard" -- This function does not write to (user-accessible) memory,
  and its return value is unlabelled.
- "functional" -- This function does not write to (user-accessible)
  memory, and the label of its return value is the union of the label of
  its arguments.
- "custom" -- Instead of calling the function, a custom wrapper __dfsw_F
  is called, where F is the name of the function.  This function may wrap
  the original function or provide its own implementation.

Differential Revision: http://llvm-reviews.chandlerc.com/D1345

llvm-svn: 188402
2013-08-14 18:54:12 +00:00
Reid Kleckner
fbab94162c Use the MSVC __cpuid intrinsic instead of inline asm
This works around PR16830 in LLVM when self-hosting clang on Windows.

llvm-svn: 188397
2013-08-14 18:21:51 +00:00
Jakob Stoklund Olesen
18768bf820 Remove unnecessary parameter to RenumberValues.
Patch by Matthias Braun!

llvm-svn: 188393
2013-08-14 17:28:52 +00:00
Jakob Stoklund Olesen
30b3d9b0e1 Improve misleading comment.
Patch by Matthias Braun!

llvm-svn: 188391
2013-08-14 17:28:46 +00:00
Jakob Stoklund Olesen
28d8a03220 Remove declaration of nonexistant function.
Patch by Matthias Braun!

llvm-svn: 188390
2013-08-14 17:28:44 +00:00
Jakob Stoklund Olesen
63c72237a7 LiveIntervalUnion is not used in RegAllocBase.
Patch by Matthias Braun!

llvm-svn: 188389
2013-08-14 17:28:42 +00:00
Renato Golin
5068d4579d Let t2LDRBi8 and t2LDRBi12 have same Base Pointer
When determining if two different loads are from the same base address,
this patch allows one load to use a t2LDRi8 address mode and another to
use a t2LDRi12 address mode. The current implementation is very
conservative and this allows the case of differing Thumb2 byte loads to
be considered. Allowing these differing modes instead of forcing the exact
same opcode is useful for situations where one opcodes loads from a base
address+1 and a second opcode loads for a base address-1.

Patch by Daniel Stewart.

llvm-svn: 188385
2013-08-14 16:35:29 +00:00
Alexey Samsonov
235b9a341c Expose CRC-32 implementation from zlib
llvm-svn: 188380
2013-08-14 16:03:29 +00:00
Tim Northover
c40d142f19 Support C99 hexadecimal floating-point literals in assembly
It's useful to be able to write down floating-point numbers without having to
worry about what they'll be rounded to (as C99 discovered), this extends that
ability to the MC assembly parsers.

llvm-svn: 188370
2013-08-14 14:23:31 +00:00
Chandler Carruth
219c3d81d0 Fix a really terrifying but improbable bug in mem2reg. If you have seen
extremely subtle miscompilations (such as a load getting replaced with
the value stored *below* the load within a basic block) related to
promoting an alloca to an SSA value, there is the dim possibility that
you hit this. Please let me know if you won this unfortunate lottery.

The first half of mem2reg's core logic (as it is used both in the
standalone mem2reg pass and in SROA) builds up a mapping from
'Instruction *' to the index of that instruction within its basic block.
This allows quickly establishing which store dominate a particular load
even for large basic blocks. We cache this information throughout the
run of mem2reg over a function in order to amortize the cost of
computing it.

This is not in and of itself a strange pattern in LLVM. However, it
introduces a very important constraint: absolutely no instruction can be
deleted from the program without updating the mapping. Otherwise a newly
allocated instruction might get the same pointer address, and then end
up with a wrong index. Yes, LLVM routinely suffers from a *single
threaded* variant of the ABA problem. Most places in LLVM don't find
avoiding this an imposition because they don't both delete and create
new instructions iteratively, but mem2reg *loves* to do this... All the
time. Fortunately, the mem2reg code was really careful about updating
this cache to handle this eventuallity... except when it comes to the
debug declare intrinsic. Oops. The fix is to invalidate that pointer in
the cache when we delete it, the same as we do when deleting alloca
instructions and other instructions.

I've also caused the same bug in new code while working on a fix to
PR16867, so this seems to be a really unfortunate pattern. Hopefully in
subsequent patches the deletion of dead instructions can be consolidated
sufficiently to make it less likely that we'll see future occurences of
this bug.

Sorry for not having a test case, but I have literally no idea how to
reliably trigger this kind of thing. It may be single-threaded, but it
remains an ABA problem. It would require a really amazing number of
stars to align.

llvm-svn: 188367
2013-08-14 08:56:41 +00:00
Craig Topper
6098714945 Make more helper methods into static functions.
llvm-svn: 188366
2013-08-14 07:53:41 +00:00
Craig Topper
6104601f38 Remove tab characters.
llvm-svn: 188365
2013-08-14 07:35:18 +00:00
Craig Topper
c13ba6b595 Make some helper methods static.
llvm-svn: 188364
2013-08-14 07:34:43 +00:00
Craig Topper
ea9da24130 Use MVT in more lowering code.
llvm-svn: 188363
2013-08-14 07:04:42 +00:00
Craig Topper
6785f01079 Replace EVT with MVT in isVectorShift. Keeps compiler from generating unneeded checks and handling for extended types.
llvm-svn: 188362
2013-08-14 06:21:10 +00:00
Craig Topper
be2cc9fc41 Replace EVT with MVT in many of the shuffle lowering functions. Keeps compiler from generating unneeded checks and handling for extended types.
llvm-svn: 188361
2013-08-14 05:58:39 +00:00
Akira Hatanaka
6a7f10d027 [mips] Fix bug in parsing accumulator registers.
llvm-svn: 188344
2013-08-14 01:15:52 +00:00
Akira Hatanaka
2f7e9a3a07 [mips] Use register operands instead of register classes in DSP instruction
definitions.

llvm-svn: 188343
2013-08-14 01:02:20 +00:00
Akira Hatanaka
3e7c555daa [mips] Rename DSPRegs.
llvm-svn: 188342
2013-08-14 00:53:38 +00:00
Akira Hatanaka
6ac16b554b [mips] Rename HIRegs and LORegs.
llvm-svn: 188341
2013-08-14 00:47:08 +00:00
Matt Arsenault
cb3b478d91 Fix always creating GEP with i32 indices
Use the pointer size if datalayout is available.
Use i64 if it's not, which is consistent with what other
places do when the pointer size is unknown.

The test doesn't really test this in a useful way
since it will be transformed to that later anyway,
but this now tests it for non-zero arrays and when
datalayout isn't available. The cases in
visitGetElementPtrInst should save an extra re-visit to
the newly created GEP since it won't need to cleanup after
itself.

llvm-svn: 188339
2013-08-14 00:24:38 +00:00
Matt Arsenault
6d1daebfff Use type helper functions instead of cast
llvm-svn: 188338
2013-08-14 00:24:34 +00:00
Matt Arsenault
734103e561 Use array initializer, space around operator
llvm-svn: 188337
2013-08-14 00:24:05 +00:00
Akira Hatanaka
ff296075bc [mips] Properly parse registers that appear in inline-asm constraints.
llvm-svn: 188336
2013-08-14 00:21:25 +00:00
Hal Finkel
fd36621506 BBVectorize: Add initial stores to the write set when tracking uses
When computing the use set of a store, we need to add the store to the write
set prior to iterating over later instructions. Otherwise, if there is a later
aliasing load of that store, that load will not be tagged as a use, and bad
things will happen.

trackUsesOfI still adds later dependent stores of an instruction to that
instruction's write set, but it never sees the original instruction, and so
when tracking uses of a store, the store must be added to the write set by the
caller.

Fixes PR16834.

llvm-svn: 188329
2013-08-13 23:34:32 +00:00
Nick Lewycky
eab287a60a Revert r187191, which broke opt -mem2reg on the testcases included in PR16867.
However, opt -O2 doesn't run mem2reg directly so nobody noticed until r188146
when SROA started sending more things directly down the PromoteMemToReg path.

In order to revert r187191, I also revert dependent revisions r187296, r187322
and r188146. Fixes PR16867. Does not add the testcases from that PR, but both
of them should get added for both mem2reg and sroa when this revert gets
unreverted.

llvm-svn: 188327
2013-08-13 22:51:58 +00:00
Jack Carter
15a173ab4f [Mips][msa] Value types for MSA support.
Added v8f16 to ValueTypes.h, ValueTypes.cpp, ValueTypes.td, 
and CodeGenTarget.cpp

Patch by Daniel Sanders

llvm-svn: 188326
2013-08-13 22:34:26 +00:00
Hans Wennborg
581964696d Options: explicit handling of --
Clients of the option parsing library should handle it explicitly
using a KIND_REMAINING_ARGS option.

Clang and lld have been updated in r188316 and r188318, respectively.

Also fix -Wsign-compare warning in the option parsing test.

llvm-svn: 188323
2013-08-13 22:23:05 +00:00
Jim Grosbach
a6bd8c2220 DAG: Combine (and (setne X, 0), (setne X, -1)) -> (setuge (add X, 1), 2)
A common idiom is to use zero and all-ones as sentinal values and to
check for both in a single conditional ("x != 0 && x != (unsigned)-1").
That generates code, for i32, like:
  testl %edi, %edi
  setne %al
  cmpl  $-1, %edi
  setne %cl
  andb  %al, %cl

With this transform, we generate the simpler:
  incl  %edi
  cmpl  $1, %edi
  seta  %al

Similar improvements for other integer sizes and on other platforms. In
general, combining the two setcc instructions into one is better.

rdar://14689217

llvm-svn: 188315
2013-08-13 21:30:58 +00:00
Hans Wennborg
714e82ffc5 Options: Add new option kind that consumes remaining arguments
This adds KIND_REMAINING_ARGS, a class of options that consume
all remaining arguments on the command line.

This will be used to support /link in clang-cl, which is used
to forward all remaining arguments to the linker.

It also allows us to remove the hard-coded handling of "--",
allowing clients (clang and lld) to implement that functionality
themselves with this new option class.

Differential Revision: http://llvm-reviews.chandlerc.com/D1387

llvm-svn: 188314
2013-08-13 21:09:50 +00:00
Jack Carter
da7e928e92 [Mips][msa] Added initial MSA support.
* msa SubtargetFeature
* registers
* ld.[bhwd], and st.[bhwd] instructions

Does not correctly prohibit use of both 32-bit FPU registers and MSA together.

Patch by Daniel Sanders

llvm-svn: 188313
2013-08-13 20:54:07 +00:00
Jack Carter
cb8856c2c6 [Mips] Support for unaligned load/store microMips instructions
This includes instructions lwl, lwr, swl and swr.

Patch by Zoran Jovnovic

llvm-svn: 188312
2013-08-13 20:19:16 +00:00
Michael Gottesman
30dcd21864 Update makeLibCall to return both the call and the chain associated with the libcall instead of just the call. This allows us to specify libcalls that return void.
LowerCallTo returns a pair with the return value of the call as the first
element and the chain associated with the return value as the second element. If
we lower a call that has a void return value, LowerCallTo returns an SDValue
with a NULL SDNode and the chain for the call. Thus makeLibCall by just
returning the first value makes it impossible for you to set up the chain so
that the call is not eliminated as dead code.

I also updated all references to makeLibCall to reflect the new return type.

llvm-svn: 188300
2013-08-13 17:54:56 +00:00
Carlo Kok
1b6e9cea0f Output DW_AT_stmt_list dwarf debug info as DW_FORM_sec_offset instead of DW_FORM_data4 as it is a section offset (fixes the coff/dwarf debug info statement locations)
llvm-svn: 188297
2013-08-13 17:46:57 +00:00
Carlo Kok
d10cf40934 For COFF only: dwarf debug info output a label reference as a section relative item only when it's one of dw_from strp, sec_offset, ref_addr or op_call_ref instead of going by size.
llvm-svn: 188296
2013-08-13 17:45:53 +00:00
Dmitry Vyukov
fe91b1efa2 dfsan: fix lint warnings
llvm-svn: 188293
2013-08-13 16:52:41 +00:00
Joey Gouly
c5221430a1 ARMv8: SWP and SWPB are obsoleted on ARMv8.
llvm-svn: 188288
2013-08-13 16:40:47 +00:00
Arnold Schwaighofer
dfaac373ee Also remove logic in LateVectorize
llvm-svn: 188285
2013-08-13 16:12:04 +00:00
Arnold Schwaighofer
406976609b Remove logic that decides whether to vectorize or not depending on O-levels
I have moved this logic into clang and opt.

llvm-svn: 188281
2013-08-13 15:51:25 +00:00
Evgeniy Stepanov
0caff76271 Fix compiler warnings.
../lib/Target/X86/X86ISelLowering.cpp:9715:7: error: unused variable 'OpVT' [-Werror,-Wunused-variable]
  EVT OpVT = Op0.getValueType();
      ^
../lib/Target/X86/X86ISelLowering.cpp:9763:14: error: unused variable 'NumElems' [-Werror,-Wunused-variable]
    unsigned NumElems = VT.getVectorNumElements();

llvm-svn: 188269
2013-08-13 14:04:20 +00:00
Mihai Popa
f30d3c418d Fix signed overflow in when computing encodings for ADR instructions
llvm-svn: 188268
2013-08-13 14:02:13 +00:00
Elena Demikhovsky
42b33ee116 AVX-512: Added CMP and BLEND instructions.
Lowering for SETCC.

llvm-svn: 188265
2013-08-13 13:24:07 +00:00
Vladimir Medic
c797d9a921 This patch introduces changes to MipsAsmParser register parsing routines. The code now follows more deterministic path and makes the code more efficient and easier to maintain.
llvm-svn: 188264
2013-08-13 13:07:09 +00:00
Benjamin Kramer
3078fbe0e8 GCC warns about removing const with a c-style cast.
llvm-svn: 188259
2013-08-13 09:57:55 +00:00
Evgeniy Stepanov
7a9f4fb383 Pass DIEHash::collectAttributes output argument by-pointer instead of by-value.
Before this, collectAttributes() was operating on a local object.

llvm-svn: 188254
2013-08-13 07:57:01 +00:00
David Majnemer
eca1e24e80 [-cxx-abi microsoft] Stick zero initialized symbols into the .bss section for COFF
Summary:
We need to do two things:

- Initialize BSSSection in MCObjectFileInfo::InitCOFFMCObjectFileInfo
- Teach TargetLoweringObjectFileCOFF::SelectSectionForGlobal what to do
  with it

This fixes PR16861.

Reviewers: rnk

Reviewed By: rnk

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1361

llvm-svn: 188244
2013-08-13 01:23:53 +00:00
Eric Christopher
aae98d918e Add the start of DIE hashing for DWARF4 type units and split dwarf
CUs.

Currently only hashes the name of CUs and the names of any children,
but it's an obvious first step to show the framework. The testcase
should continue to be correct, however, as it's an empty TU.

llvm-svn: 188243
2013-08-13 01:21:55 +00:00
Nick Lewycky
ce26d6b8d0 Fix an oversight in isPotentiallyReachable where we wouldn't do any CFG-walking
to find loops if the From and To instructions were in the same block.

Refactor the code a little now that we need to fill to start the CFG-walking
algorithm with more than one starting basic block sometimes.

Special thanks to Andrew Trick for catching an error in my understanding of
natural loops in code review.

llvm-svn: 188236
2013-08-13 00:03:47 +00:00
Eric Christopher
302cbd1330 Reflow comment.
llvm-svn: 188233
2013-08-12 23:59:24 +00:00
Eric Christopher
d5768dc3b1 Remove empty constructor.
llvm-svn: 188232
2013-08-12 23:59:18 +00:00
Matt Arsenault
1d8ad32d3e Slightly simplify code with helper functions
e.g. Use Ty->getPointerElementType()
instead of cast<PointerType>(Ty)->getElementType()

llvm-svn: 188223
2013-08-12 23:15:58 +00:00
Matt Arsenault
c153cf6470 Add some braces, and spaces around operators
llvm-svn: 188219
2013-08-12 22:56:15 +00:00
Kevin Enderby
41399cecad Fix a crash with X86 Mach-O and a subtraction expression where both symbols are
undefined and produce an error message instead as this is a non-relocatable
expression with X86 Mach-O.

rdar://8920876

llvm-svn: 188218
2013-08-12 22:45:44 +00:00
Peter Collingbourne
723e9b89ec Reapply r188119 now that the bug it exposed is fixed.
llvm-svn: 188217
2013-08-12 22:38:43 +00:00
Peter Collingbourne
10cbe4a9bb DataFlowSanitizer: fix a use-after-free. Spotted by libgmalloc.
llvm-svn: 188216
2013-08-12 22:38:39 +00:00
Tom Stellard
9f798c877d R600: Set scheduling preference to Sched::Source
R600 doesn't need to do any scheduling on the SelectionDAG now that it
has a very good MachineScheduler.  Also, using the VLIW SelectionDAG
scheduler was having a major impact on compile times. For example with
the phatk kernel here are the LLVM IR to machine code compile times:

With Sched::VLIW

Total Compile Time:                  1.4890 Seconds (User + System)
SelectionDAG Instruction Scheduling: 1.1670 Seconds (User + System)

With Sched::Source

Total Compile Time:                  0.3330 Seconds (User + System)
SelectionDAG Instruction Scheduling: 0.0070 Seconds (User + System)

The code ouput was identical with both schedulers.  This may not be true
for all programs, but it gives me confidence that there won't be much
reduction, if any, in code quality by using Sched::Source.

llvm-svn: 188215
2013-08-12 22:33:21 +00:00
Michael Gottesman
4b904f1880 Fixed SelectionDAGBuilder.h C++ filetype declaration to use the canonical C++ instead of c++.
llvm-svn: 188203
2013-08-12 21:02:02 +00:00
Michael Gottesman
8ba1e36e9c Fixed another place in CodeGen where we had a typo in our editor C++ filetype declaration.
llvm-svn: 188202
2013-08-12 20:52:06 +00:00
Michael Gottesman
6b88b6e12b [branchfolding] Fix typo in C++ editor declaration.
llvm-svn: 188201
2013-08-12 20:49:27 +00:00
Eric Christopher
6df5d15a24 Move the addition of the dwo_id as late as possible after everything
has been finalized except for sizes and offsets. Update test accordingly.

llvm-svn: 188199
2013-08-12 20:27:48 +00:00
Bill Wendling
f37b5b1f31 Move stack protector names to the same place.
llvm-svn: 188198
2013-08-12 20:09:37 +00:00
Michael Gottesman
defd024179 [stackprotector] Add in the stackprotector libcall.
We support this libcall on all platforms except for OpenBSD (See
lib/Codegen/StackProtector.cpp).

llvm-svn: 188193
2013-08-12 18:45:38 +00:00
Nadav Rotem
bc08e7ce84 Fix PR16797 - Support PHINodes with multiple inputs from the same basic block.
Do not generate new vector values for the same entries because we know that the incoming values
from the same block must be identical.

llvm-svn: 188185
2013-08-12 17:46:44 +00:00
Tareq A. Siraj
135d71f85d Fixes a bug when iterating on paths
This fixes the incorrect implementation of iterating on file/directory
paths.

Differential Review: http://llvm-reviews.chandlerc.com/D1277

llvm-svn: 188183
2013-08-12 17:10:49 +00:00
Vladimir Medic
34aca92bce This patch implements ei and di instructions for mips. Test cases are added.
llvm-svn: 188176
2013-08-12 13:07:23 +00:00
Alexey Samsonov
d27599b42b Remove unused SpecialCaseList constructors
llvm-svn: 188171
2013-08-12 11:50:44 +00:00
Alexey Samsonov
cdc0f339aa Add SpecialCaseList::createOrDie() factory and use it in sanitizer passes
llvm-svn: 188169
2013-08-12 11:46:09 +00:00
Chandler Carruth
ecf7881af3 Remove all checking for the various terminfo headers (term.h and
curses.h). Finding these headers is next to impossible. For example, on
Debian systems libtinfo-dev provides the terminfo reading library we
want, but *not* term.h. For the header, you have to use libncurses-dev.
And libncursesw-dev provides a *different* term.h in a different
location!

These headers aren't worth it. We want two functions the signatures of
which are clearly spec'ed in sys-v and other documentation. Just declare
them ourselves and call them. This should fix some debian builders and
provide better support for "minimal" debian systems that do want color
autodetection.

llvm-svn: 188165
2013-08-12 10:40:11 +00:00
Richard Sandiford
4980a32ba3 [SystemZ] Use CLC and IPM to implement memcmp
For now this is restricted to fixed-length comparisons with a length
in the range [1, 256], as for memcpy() and MVC.

llvm-svn: 188163
2013-08-12 10:28:10 +00:00
Richard Sandiford
b10e77493f [SystemZ] Add a definition of the CLC instruction
llvm-svn: 188162
2013-08-12 10:17:33 +00:00
Richard Sandiford
aed77a47b8 [SystemZ] Add a definition of the IPM instruction
llvm-svn: 188161
2013-08-12 10:05:58 +00:00
Chandler Carruth
1ee1f67312 Target a minimal terminfo library rather than necessarily a full curses
library for color support detection. This still will use a curses
library if that is all we have available on the system. This change
tries to use a smaller subset of the curses library, specifically the
subset that is on some systems split off into a separate library. For
example, if you install ncurses configured --with-tinfo, a 'libtinfo' is
install that provides just the terminfo querying functionality. That
library is now used instead of curses when it is available.

This happens to fix a build error on systems with that library because
when we tried to link ncurses into the binary, we didn't pull tinfo in
as well. =]

It should also provide an easy path for supporting the NetBSD
libterminfo library, but as I don't have access to a NetBSD system I'm
leaving adding that support to those folks.

llvm-svn: 188160
2013-08-12 09:49:17 +00:00
Tim Northover
2497b9b9ba Allow compatible extension attributes for tail calls
If the tail-callee and caller give the same bits via the same signext/zeroext
attribute then a tail-call should be allowed, since the extension has already
been done by the callee.

llvm-svn: 188159
2013-08-12 09:45:46 +00:00
Benjamin Kramer
01f2d8daf8 Remove global construction. const char* is sufficient here.
No functionality change.

llvm-svn: 188158
2013-08-12 09:37:29 +00:00
Alexey Samsonov
d27061d7e7 Introduce factory methods for SpecialCaseList
Summary:
Doing work in constructors is bad: this change suggests to
call SpecialCaseList::create(Path, Error) instead of
"new SpecialCaseList(Path)". Currently the latter may crash with
report_fatal_error, which is undesirable - sometimes we want to report
the error to user gracefully - for example, if he provides an incorrect
file as an argument of Clang's -fsanitize-blacklist flag.

Reviewers: pcc

Reviewed By: pcc

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1327

llvm-svn: 188156
2013-08-12 07:49:36 +00:00
Richard Sandiford
c01b885f5d Fix big-endian handling of integer-to-vector bitcasts in InstCombine
These functions used to assume that the lsb of an integer corresponds
to vector element 0, whereas for big-endian it's the other way around:
the msb is in the first element and the lsb is in the last element.

Fixes MultiSource/Benchmarks/mediabench/gsm/toast for z.

llvm-svn: 188155
2013-08-12 07:26:09 +00:00
Reed Kotler
31da848d63 Don't generate floating point stubs for mips16 code if the function
is actually an instrinsic that will not occur in libc. This list here
is not exhaustive but fixes the one places in test-suite where this occurs.
I have filed a bug against myself to research the full list and add them
to the array of such cases. In the future, actual stub generation will occur
in a later phase and we won't need this code because we will know at that time
during the compilation that in fact no helper function was even needed.

llvm-svn: 188149
2013-08-11 21:30:27 +00:00
Elena Demikhovsky
afcde02b68 AVX-512: Added more tests for BROADCAST
llvm-svn: 188148
2013-08-11 12:29:16 +00:00
Elena Demikhovsky
66a9e4f863 AVX-512: Added VPERM* instructons and MOV* zmm-to-zmm instructions.
Added a test for shuffles using VPERM.

llvm-svn: 188147
2013-08-11 07:55:09 +00:00
Chandler Carruth
24ce5e9526 Re-instate r187323 which fast-tracks promotable allocas as soon as the
SROA-based analysis has enough information. This should work now that
both mem2reg *and* the SSAUpdater-based AllocaPromoter have been updated
to be able to promote the types of allocas that the SROA analysis
detects.

I've included tests for the AllocaPromoter that were only possible to
write once we fast-tracked promotable allocas without rewriting them.
This includes a test both for r187347 and r188145.

Original commit log for r187323:
"""
Now that mem2reg understands how to cope with a slightly wider set of uses of
an alloca, we can pre-compute promotability while analyzing an alloca for
splitting in SROA. That lets us short-circuit the common case of a bunch of
trivially promotable allocas. This cuts 20% to 30% off the run time of SROA for
typical frontend-generated IR sequneces I'm seeing. It gets the new SROA to
within 20% of ScalarRepl for such code. My current benchmark for these numbers
is PR15412, but it fits the general pattern of IR emitted by Clang so it should
be widely applicable.
"""

llvm-svn: 188146
2013-08-11 02:17:11 +00:00
Chandler Carruth
bc4fdfb024 Finish fixing the SSAUpdater-based AllocaPromoter strategy in SROA to cope with
the more general set of patterns that are now handled by mem2reg and that we
can detect quickly while doing SROA's initial analysis. Notably, this allows it
to promote through no-op bitcast and GEP sequences. A core part of the
SSAUpdater approach is the ability to test whether a particular instruction is
part of the set being promoted. Testing this becomes significantly more complex
in the world where the operand to every load and store isn't the alloca itself.
I ended up using the approach of walking up the def-chain until we find the
alloca. I benchmarked this against keeping a set of pointer operands and
keeping a set of the loads and stores we care about, and this one seemed faster
although the difference was very small.

No test case yet because currently the rewriting always "fixes" the inputs to
not require this. The next patch which re-enables early promotion of easy cases
in SROA will include a test case that specifically exercises this aspect of the
alloca promoter.

llvm-svn: 188145
2013-08-11 01:56:15 +00:00
Chandler Carruth
5b16f00b28 Reformat some bits of AllocaPromoter and simplify the name and type of
our visiting datastructures in the AllocaPromoter/SSAUpdater path of
SROA. Also shift the order if clears around to be more consistent.

No functionality changed here, this is just a cleanup.

llvm-svn: 188144
2013-08-11 01:03:18 +00:00
Reed Kotler
9508f238aa Incorrect JAL instruction attributes caused the optimizer to make a wrong
instruction move. Just affects static relocation. -static works fine now
with mips16 for the most part.

llvm-svn: 188143
2013-08-10 22:18:22 +00:00
Arnold Schwaighofer
3525aff8f6 Revert r188119 "Kill some duplicated code for removing unreachable BBs."
It is breaking builbots with libgmalloc enabled on Mac OS X.

$ cd llvm ; mkdir release ; cd release
$ ../configure --enable-optimized —prefix=$PWD/install
$ make
$ make check
$ Release+Asserts/bin/llvm-lit -v --param use_gmalloc=1 --param \
  gmalloc_path=/usr/lib/libgmalloc.dylib \
  ../test/Instrumentation/DataFlowSanitizer/args-unreachable-bb.ll

llvm-svn: 188142
2013-08-10 20:16:06 +00:00
Venkatraman Govindaraju
e3f96235ce [Sparc] Enable xword directive in sparcv9.
llvm-svn: 188141
2013-08-10 20:13:20 +00:00
Matt Arsenault
3ec4a75542 Teach ValueTracking about address spaces
llvm-svn: 188140
2013-08-10 17:34:08 +00:00
Niels Ole Salscheider
c023cc4f85 R600/SI: FMA is faster than fmul and fadd for f64
llvm-svn: 188136
2013-08-10 10:38:54 +00:00
Niels Ole Salscheider
fc24d0a6e6 R600/SI: Add FMA pattern
llvm-svn: 188135
2013-08-10 10:38:47 +00:00
Rafael Espindola
e297e56431 Check for $PWD in llvm::sys::current_path.
Some users (clang, libTooling) require this. After this patch we can remove
the calls to getenv("PWD") from clang.

llvm-svn: 188125
2013-08-10 00:50:57 +00:00
Michael Gottesman
f005430fa0 [objc-arc] Track if we encountered an additive overflow while computing {TopDown,BottomUp}PathCounts and do nothing if it occurred.
I fixed the aforementioned problems that came up on some of the linux boxes.
Major thanks to Nick Lewycky for his help debugging!

rdar://14590914

llvm-svn: 188122
2013-08-09 23:22:27 +00:00
Peter Collingbourne
0b56f9dd44 Kill some duplicated code for removing unreachable BBs.
This moves removeUnreachableBlocksFromFn from SimplifyCFGPass.cpp
to Utils/Local.cpp and uses it to replace the implementation of
llvm::removeUnreachableBlocks, which appears to do a strict subset
of what removeUnreachableBlocksFromFn does.

Differential Revision: http://llvm-reviews.chandlerc.com/D1334

llvm-svn: 188119
2013-08-09 22:47:24 +00:00
Peter Collingbourne
df8eabc1f8 DataFlowSanitizer: Remove unreachable BBs so IR continues to verify
under the args ABI.

Differential Revision: http://llvm-reviews.chandlerc.com/D1316

llvm-svn: 188113
2013-08-09 21:42:53 +00:00
Reed Kotler
d4cb39c73a Add another intrinsic that LLVM gives an incorrect prototype to.
I need to go through all the runtime routine list and see if there
are any more I need to add for mips16 floating point. Prototypes must
be correct or else I don't know to add a helper function call.

llvm-svn: 188106
2013-08-09 21:33:41 +00:00
Michael Gottesman
9aac3bd709 [stackprotector] Simplify SP Pass so that we emit different fail basic blocks for each fail condition.
This patch decouples the stack protector pass so that we can support stack
protector implementations that do not use the IR level generated stack protector
fail basic block.

No codesize increase is caused by this change since the MI level tail merge pass
properly merges together the fail condition blocks (see the updated test).

llvm-svn: 188105
2013-08-09 21:26:18 +00:00
Jakub Staszak
d7c1eac478 Mark obviously const methods. Also use reference for parameters when possible.
llvm-svn: 188103
2013-08-09 20:53:48 +00:00
Benjamin Kramer
169eb89854 Add a overload to CostTable which allows it to infer the size of the table.
Use it to avoid repeating ourselves too often. Also store MVT::SimpleValueType
in the TTI tables so they can be statically initialized, MVT's constructors
create bloated initialization code otherwise.

llvm-svn: 188095
2013-08-09 19:33:32 +00:00
David Blaikie
00aaad68b6 DebugInfo: provide the ability to add members to a class after it has been constructed
This is necessary to allow Clang to only emit implicit members when
there is code generated for them, rather than whenever they are ODR
used.

llvm-svn: 188082
2013-08-09 17:17:12 +00:00
Benjamin Kramer
a492b19327 Make helper static and fix formatting.
llvm-svn: 188074
2013-08-09 14:44:41 +00:00
Mihai Popa
5aabbdc839 This fixes the Thumb2 CPS assembly syntax.
In Thumb1, only one variant is supported: CPS{effect} {flags}

Thumb2 supports three:
CPS{effect}.W {flags}
CPS{effect} {flags} {mode}
CPS {mode}

Canonically, .W should be used only when ambiguity is present between encodings of different width.
The wide suffix is still accepted for the latter two forms via aliases.

llvm-svn: 188071
2013-08-09 13:52:32 +00:00
Mihai Popa
b9642a712a Fix assembling of Thumb2 branch instructions.
The long encoding for Thumb2 unconditional branches is broken.
Additionally, there is no range checking for target operands; as such 
for instructions originating in assembly code, only short Thumb encodings
are generated, regardless of the bitsize needed for the offset.

Adding range checking is non trivial due to the representation of Thumb
branch instructions. There is no true difference between conditional and
unconditional branches in terms of operands and syntax - even unconditional
branches have a predicate which is expected to match that of the IT block
they are in. Yet, the encodings and the permitted size of the offset differ.

Due to this, for any mnemonic there are really 4 encodings to choose for.

The problem cannot be handled in the parser alone or by manipulating td files.
Because the parser builds first a set of match candidates and then checks them
one by one, whatever tablegen-only solution might be found will ultimately be
dependent of the parser's evaluation order. What's worse is that due to the fact
that all branches have the same syntax and the same kinds of operands, that 
order is governed by the lexicographical ordering of the names of operand 
classes...

To circumvent all this, any necessary disambiguation is added to the instruction
validation pass.

llvm-svn: 188067
2013-08-09 10:38:32 +00:00
Ulrich Weigand
c93ad2d7b0 Add back missing PPC relocation types.
llvm-svn: 188064
2013-08-09 09:42:14 +00:00
Richard Sandiford
a0b6cbf288 [SystemZ] Update README
llvm-svn: 188062
2013-08-09 09:25:57 +00:00
Craig Topper
b556057053 Change asserts at the top of getVectorShuffle to check that LHS and RHS have the same type as the result.
Previously the asserts were only checking that RHS and LHS were the same type and had the same element type as the result. All downstream code for ISD::VECTOR_SHUFFLE requires the types to be the same.

Also removed one unnecessary check of matched element counts that was present in the code.

llvm-svn: 188051
2013-08-09 04:37:24 +00:00
Hal Finkel
2dc47cddf0 Set ISD::FROUND to Expand by default for all types
For most libm ISD nodes, TargetLoweringBase::initActions sets the default
scalar-type action to Expand, and leaves the vector-type action default as
Legal. This is not appropriate for the new ISD::FROUND node (which no backend
but PowerPC handles explicitly).

Fixes PR16842.

llvm-svn: 188048
2013-08-09 04:13:44 +00:00
Saleem Abdulrasool
7fcd7a910a [CodeGen] prevent abnormal on invalid attributes
Currently, when an invalid attribute is encountered on processing a .s file,
clang will abort due to llvm_unreachable.  Invalid user input should not cause
an abnormal termination of the compiler.  Change the interface to return a
boolean to indicate the failure as a first step towards improving hanlding of
malformed user input to clang.

Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
llvm-svn: 188047
2013-08-09 01:52:03 +00:00
Lang Hames
1c531fdf7f Optimistically ignore scattered relocations in MachO in RuntimeDyld. This
un-breaks simple use cases while I work on more general support.

<rdar://problem/14487667>

llvm-svn: 188044
2013-08-09 00:57:01 +00:00
Michael J. Spencer
ad7660cd39 Add missing PPC64 relocation types.
llvm-svn: 188031
2013-08-08 23:58:18 +00:00
Eric Christopher
e0514008de Update the CMake build files.
llvm-svn: 188030
2013-08-08 23:51:31 +00:00
Eric Christopher
81863ce2b7 Move hash computation code into a separate class and file.
No functional change intended.

llvm-svn: 188028
2013-08-08 23:45:55 +00:00
Jack Carter
69e05b321a Mips ELF: MicroMips direct object Little endian support.
Test included.

Patch by Zoran Jovanovich

llvm-svn: 188024
2013-08-08 23:30:40 +00:00
Michael J. Spencer
8cdf1cca41 [Object] Split the ELF interface into 3 parts.
* ELFTypes.h contains template magic for defining types based on endianess, size, and alignment.
* ELFFile.h defines the ELFFile class which provides low level ELF specific access.
* ELFObjectFile.h contains ELFObjectFile which uses ELFFile to implement the ObjectFile interface.

llvm-svn: 188022
2013-08-08 22:27:13 +00:00
Akira Hatanaka
c05b5c3dae [mips] Rename accumulator register classes and FP register operands.
llvm-svn: 188020
2013-08-08 21:54:26 +00:00
Akira Hatanaka
41ad5610bf [mips] Mark pseudo instructions as code-gen only.
llvm-svn: 188017
2013-08-08 21:44:39 +00:00
Akira Hatanaka
4f90298c6e [mips] Delete register class HWRegs64.
No functionality change.

llvm-svn: 188016
2013-08-08 21:37:32 +00:00
David Fang
3e8c045f48 cast fix to appease buildbot
llvm-svn: 188014
2013-08-08 21:29:30 +00:00
Arnold Schwaighofer
ddea7f3974 Revert "Reapply r185872 now that the address sanitizer has been changed to support this."
This reverts commit r187939. It broke an O0 build of a spec benchmark.

llvm-svn: 188012
2013-08-08 21:04:16 +00:00
David Fang
772a101ff0 initial draft of PPCMachObjectWriter.cpp
this records relocation entries in the mach-o object file
for PIC code generation.
tested on powerpc-darwin8, validated against darwin otool -rvV

llvm-svn: 188004
2013-08-08 20:14:40 +00:00
Alexey Samsonov
1021d4d06d Fix off-by-one error in Regex::isValid
llvm-svn: 187992
2013-08-08 17:32:45 +00:00
Niels Ole Salscheider
20c4077bf5 R600/SI: Implement fp32<->fp64 conversions
llvm-svn: 187988
2013-08-08 16:06:15 +00:00
Niels Ole Salscheider
74ee40da2a R600/SI: Implement sint<->fp64 conversions
llvm-svn: 187987
2013-08-08 16:06:08 +00:00
Jakub Staszak
cb5ff9e1e0 Use pop_back() instead of pop_back_val() when the returned value is not used.
llvm-svn: 187986
2013-08-08 15:48:46 +00:00
Silviu Baranga
0291b43e25 Remove the now redundant FeatureFP16 from the Cortex-A15 feature list. It was made redundant when FeatureVFP4 was added which implies FP16.
llvm-svn: 187985
2013-08-08 15:47:33 +00:00
Jakub Staszak
7d775148c4 Fix the comment.
llvm-svn: 187984
2013-08-08 15:19:25 +00:00
Mihai Popa
cda7008bd4 The name "tCDP" isn't used anywhere else in the source code, so renaming it for consistency doesn't cause any problems.
This is the only Thumb2 instruction defined with "t" prefix; all other Thumb2 instructions have "t2" prefix (e.g. "t2CDP2" which is defined immediately afterwards).

Patch by Artyom Skrobov.

llvm-svn: 187973
2013-08-08 10:20:41 +00:00
Evgeniy Stepanov
eb8342b22f Disable inlining between sanitized and non-sanitized functions.
Inlining between functions with different values of sanitize_* attributes
leads to over- or under-sanitizing, which is always bad.

llvm-svn: 187967
2013-08-08 08:22:39 +00:00
Eric Christopher
49a1db3fce For DW_TAG_template_type_parameter the actual passed in type could
be void and therefore not have a type entry. Only add the type if
it is non-void and provide a testcase.

llvm-svn: 187966
2013-08-08 08:09:43 +00:00
Craig Topper
093dffb1a8 Remove AllUndef check from one of the loops in getVectorShuffle. It was already handled by the 'AllLHS && AllRHS' check after the previous loop.
llvm-svn: 187965
2013-08-08 08:03:12 +00:00
Eric Christopher
19fba84128 The conversion to bool is fine here, no need to check isType.
llvm-svn: 187964
2013-08-08 07:40:42 +00:00
Eric Christopher
e6639b8535 Make sure that if we're going to attempt to add a type to a DIE that
the type exists.

Fix up cases where we weren't checking for optional types and add
an assert to addType to make sure we catch this in the future.

Fix up a testcase that was using the tag for DW_TAG_array_type
when it meant DW_TAG_enumeration_type.

llvm-svn: 187963
2013-08-08 07:40:37 +00:00
Eric Christopher
4725619d96 Change variable name and reflow formatting.
llvm-svn: 187962
2013-08-08 07:40:31 +00:00
Craig Topper
8a5e83ba97 Optimize mask generation for one of the DAG combiner shufflevector cases.
llvm-svn: 187961
2013-08-08 07:38:55 +00:00
Hal Finkel
e76170ce53 PPC: Map frin to round() not nearbyint() and rint()
Making use of the recently-added ISD::FROUND, which allows for custom lowering
of round(), the PPC backend will now map frin to round(). Previously, we had
been using frin to lower nearbyint() (and rint() via some custom lowering to
handle the extra fenv flags requirements), but only in fast-math mode because
frin does not tie-to-even. Several users had complained about this behavior,
and this new mapping of frin to round is certainly more appropriate (and does
not require fast-math mode).

In effect, this reverts r178362 (and part of r178337, replacing the nearbyint
mapping with the round mapping).

llvm-svn: 187960
2013-08-08 04:31:34 +00:00
David Majnemer
e90cbda29f Revert "coff also doesn't have a ReadOnlySection yet, (!)"
This reverts commit r77814.

We were sticking global constants in the .data section instead of in the
.rdata section when emitting for COFF.

This fixes PR16831.

llvm-svn: 187956
2013-08-08 01:50:52 +00:00
Eric Christopher
160c346748 Reflow for loop.
llvm-svn: 187954
2013-08-08 01:41:05 +00:00
Eric Christopher
c16b1aaf3f Be more rigorous about the sizes of forms and attributes.
llvm-svn: 187953
2013-08-08 01:41:00 +00:00
Alexander Kornienko
8030dee9b6 Changed isPrint for U+00AD SOFT HYPHEN to return true.
Summary:
This is consistent with MacOSX implementation, and most terminals
actually display this character (checked on gnome-terminal, lxterminal, lxterm,
Terminal.app, iterm2). Actually, this is in line with the ISO Latin 1 standard
(ISO 8859-1), which defines it differently from the Unicode Standard. More
information here: http://www.cs.tut.fi/~jkorpela/shy.html

Reviewers: gribozavr, jordan_rose

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1310

llvm-svn: 187949
2013-08-08 01:10:50 +00:00
Michael Gottesman
d0acc77647 Revert "[objc-arc] Track if we encountered an additive overflow while computing {TopDown,BottomUp}PathCounts and do nothing if it occured."
This reverts commit r187941.

The commit was passing on my os x box, but it is failing on some non-osx
platforms. I do not have time to look into it now, so I am reverting and will
recommit after I figure this out.

llvm-svn: 187946
2013-08-08 00:41:18 +00:00
Peter Collingbourne
34bf946403 Fix ARM build.
llvm-svn: 187944
2013-08-08 00:15:27 +00:00
Michael Gottesman
a8c38e944e [objc-arc] Track if we encountered an additive overflow while computing {TopDown,BottomUp}PathCounts and do nothing if it occured.
rdar://14590914

llvm-svn: 187941
2013-08-07 23:56:41 +00:00
Michael Gottesman
630805fc43 [objc-arc] Change 4 iterator methods which return const_iterators to be const methods.
llvm-svn: 187940
2013-08-07 23:56:34 +00:00
Bill Wendling
169723f925 Reapply r185872 now that the address sanitizer has been changed to support this.
Original commit message:

Stop emitting weak symbols into the "coal" sections.

The Mach-O linker has been able to support the weak-def bit on any symbol for
quite a while now. The compiler however continued to place these symbols into a
"coal" section, which required the linker to map them back to the base section
name.

Replace the sections like this:

  __TEXT/__textcoal_nt   instead use  __TEXT/__text
  __TEXT/__const_coal    instead use  __TEXT/__const
  __DATA/__datacoal_nt   instead use  __DATA/__data

<rdar://problem/14265330>

llvm-svn: 187939
2013-08-07 23:42:09 +00:00
Hal Finkel
bdc7aa32c1 Add ISD::FROUND for libm round()
All libm floating-point rounding functions, except for round(), had their own
ISD nodes. Recent PowerPC cores have an instruction for round(), and so here I'm
adding ISD::FROUND so that round() can be custom lowered as well.

For the most part, this is straightforward. I've added an intrinsic
and a matching ISD node just like those for nearbyint() and friends. The
SelectionDAG pattern I've named frnd (because ISD::FP_ROUND has already claimed
fround).

This will be used by the PowerPC backend in a follow-up commit.

llvm-svn: 187926
2013-08-07 22:49:12 +00:00
Peter Collingbourne
efa9025062 DataFlowSanitizer; LLVM changes.
DataFlowSanitizer is a generalised dynamic data flow analysis.

Unlike other Sanitizer tools, this tool is not designed to detect a
specific class of bugs on its own.  Instead, it provides a generic
dynamic data flow analysis framework to be used by clients to help
detect application-specific issues within their own code.

Differential Revision: http://llvm-reviews.chandlerc.com/D965

llvm-svn: 187923
2013-08-07 22:47:18 +00:00
Eric Christopher
0cff1be367 Using the integrated assembler we'd fail to change section to the
.tbss section for zerofill thread locals. Make sure we do this
before emitting the zerofills.

Fixes PR15972.

llvm-svn: 187913
2013-08-07 21:13:06 +00:00
Eric Christopher
e1e6b4c0c0 Fix a FIXME, on darwin all virtual sections have a zerofill type.
llvm-svn: 187912
2013-08-07 21:13:01 +00:00
Reid Kleckner
bac8fb7396 On Windows, autolink advapi32 from Path.inc for CryptAcquireContextW
This allows llvm-tblgen to link successfully when compiling with clang.

Both MSBuild and CMake will automatically add advapi32 as part of a set
of other dlls comprising the win32 API to the link line, but CMake
doesn't do that when compiling with clang.  Until someone adds that info
to cmake upstream, this seems like a reasonable work around.

llvm-svn: 187907
2013-08-07 20:19:31 +00:00
Eric Christopher
9b6f209c8c Move assert above first use of variable that we'd be asserting on.
llvm-svn: 187899
2013-08-07 18:51:09 +00:00
Andrew Trick
5cf2601ba8 Confusing comment typo.
llvm-svn: 187895
2013-08-07 17:20:32 +00:00
Elena Demikhovsky
ae2624a373 AVX-512 set: Added BROADCAST instructions
with lowering logic and a test.

llvm-svn: 187884
2013-08-07 12:34:55 +00:00
Richard Sandiford
b6323e0b21 [SystemZ] Optimize floating-point comparisons with zero
This follows the same lines as the integer code.  In the end it seemed
easier to have a second 4-bit mask in TSFlags to specify the compare-like
CC values.  That eats one more TSFlags bit than adding a CCHasUnordered
would have done, but it feels more concise.

llvm-svn: 187883
2013-08-07 11:10:06 +00:00
Richard Sandiford
5960348422 [SystemZ] Add floating-point load-and-test instructions
These instructions can also be used as comparisons with zero.

llvm-svn: 187882
2013-08-07 11:03:34 +00:00
Benjamin Kramer
fbbec483df JumpThreading: Turn a select instruction into branching if it allows to thread one half of the select.
This is a common pattern coming out of simplifycfg generating gross code.

a:                                       ; preds = %entry
  %sel = select i1 %cmp1, double %add, double 0.000000e+00
  br label %b

b:
  %cond5 = phi double [ %sel, %a ], [ %sub, %entry ]
  %cmp6 = fcmp oeq double %cond5, 0.000000e+00
  br i1 %cmp6, label %if.then, label %if.end

becomes

a:
  br i1 %cmp1, label %b, label %if.then

b:
  %cond5 = phi double [ %sub, %entry ], [ %add, %a ]
  %cmp6 = fcmp oeq double %cond5, 0.000000e+00
  br i1 %cmp6, label %if.then, label %if.end

Skipping block b completely if possible.

llvm-svn: 187880
2013-08-07 10:29:38 +00:00
Chandler Carruth
0ac9f05175 Add support for linking against a curses library when available and
using it to detect whether or not a terminal supports colors. This
replaces a particularly egregious hack that merely compared the TERM
environment variable to "dumb". That doesn't really translate to
a reasonable experience for users that have actually ensured their
terminal's capabilities are accurately reflected.

This makes testing a terminal for color support somewhat more expensive,
but it is called very rarely anyways. The important fast path when the
output is being piped somewhere is already in place.

The global lock may seem excessive, but the spec for calling into curses
is *terrible*. The whole library is terrible, and I spent quite a bit of
time looking for a better way of doing this before convincing myself
that this was the fundamentally correct way to behave. The damage of the
curses library is very narrowly confined, and we continue to use raw
escape codes for actually manipulating the colors which is a much sane
system than directly using curses here (IMO).

If this causes trouble for folks, please let me know. I've tested it on
Linux and will watch the bots carefully. I've also worked to account for
the variances of curses interfaces that I could finde documentation for,
but that may not have been sufficient.

llvm-svn: 187874
2013-08-07 08:47:36 +00:00
Eric Christopher
e4c1a6601b Remove some parens. No functional change.
llvm-svn: 187872
2013-08-07 08:35:10 +00:00
Craig Topper
059c59a568 Simplify code. No functional change intended.
llvm-svn: 187870
2013-08-07 08:16:07 +00:00
Evgeniy Stepanov
c40b186c69 Initialize SIInsertWaits::ExpInstrTypesSeen in the pass constructor.
This value may be used uninitialized in SIInsertWaits::insertWait.
Found with MemorySanitizer.

llvm-svn: 187869
2013-08-07 07:47:41 +00:00
Dmitri Gribenko
b5e0b0c493 YAMLTraits.h: replace DenseMap that used a bad implementation of DenseMapInfo
for StringRef with a StringMap

The bug is that the empty key compares equal to the tombstone key.

Also added an assertion to DenseMap to catch similar bugs in future.

llvm-svn: 187866
2013-08-07 05:51:27 +00:00
Reed Kotler
30cf33a57e Create a pattern for the "trap" instruction.
llvm-svn: 187863
2013-08-07 04:00:26 +00:00
Reid Kleckner
6f129a9240 Fix boolean logic in LockFileManager and test it
This fixes a bug from r187826.

Reviewers: hans

Differential Revision: http://llvm-reviews.chandlerc.com/D1304

llvm-svn: 187846
2013-08-07 01:22:04 +00:00
Reid Kleckner
a642cec078 Avoid using alloca in Windows/Program.inc
One use needs to copy the alloca into a std::string, and the other use
is before calling CreateProcess, which is very heavyweight anyway.

llvm-svn: 187845
2013-08-07 01:21:33 +00:00
Eric Christopher
8aac1919bd Add a way to grab a particular attribute out of a DIE.
Use it when we're looking for a string in particular. Update comments
as well.

llvm-svn: 187844
2013-08-07 01:18:33 +00:00
Eric Christopher
c0368e09cd Move somewhat messy conditional out of line.
No functional change.

llvm-svn: 187843
2013-08-07 01:18:24 +00:00
David Blaikie
28f73e40bf Remove unused functions introduced in r172685 to unbreak the Clang -Werror build
llvm-svn: 187838
2013-08-07 00:25:12 +00:00
Alexander Kornienko
340c08d4fe Implemented llvm::sys::locale::columnWidth and isPrint for the case of generic UTF8-capable terminal.
Summary:
This is a second attempt to get this right. After reading the Unicode
Standard I came up with the code that uses definitions of "printable" and
"column width" more suitable for terminal output (i.e. fixed-width fonts and
special treatment of many control characters).
The implementation here can probably be used for Windows and MacOS if someone
can test it properly.
The patch addresses PR14910.

Reviewers: jordan_rose, gribozavr

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1253

llvm-svn: 187837
2013-08-07 00:07:07 +00:00
Tom Stellard
3dd621a536 R600: Add new file from r187831 to CMakeLists.txt
llvm-svn: 187834
2013-08-06 23:12:34 +00:00
Akira Hatanaka
1290d365ec [mips] Rename register classes CPURegs and CPU64Regs.
llvm-svn: 187832
2013-08-06 23:08:38 +00:00
Tom Stellard
3b9645302a R600/SI: Use VSrc_* register classes as the default classes for types
Since the VSrc_* register classes contain both VGPRs and SGPRs, copies
that used be emitted by isel like this:

SGPR = COPY VGPR

Will now be emitted like this:

VSrC = COPY VGPR

This patch also adds a pass that tries to identify and fix situations where
a VGPR to SGPR copy may occur.  Hopefully, these changes will make it
impossible for the compiler to generate illegal VGPR to SGPR copies.

llvm-svn: 187831
2013-08-06 23:08:28 +00:00
Tom Stellard
eab7c786d4 R600/SI: Add more special cases for opcodes to ensureSRegLimit()
Also factor out the register class lookup to its own function.

llvm-svn: 187830
2013-08-06 23:08:18 +00:00
Justin Holewinski
62bc114bf3 [NVPTX] We dont have any target specific flags yet for generating symbol references, so get rid of the default-only switch statement. Fixes an MSVC warning.
llvm-svn: 187829
2013-08-06 23:06:42 +00:00
Akira Hatanaka
4c91ec2ed9 [mips] Mark instructions defined in Mips64InstrInfo.td that are duplicates of
instructions defined in MipsInstrInfo.td as codegen-only instructions.

llvm-svn: 187828
2013-08-06 23:01:10 +00:00
Bill Wendling
1998a223f6 Change the linkage of these global values to 'internal'.
The globals being generated here were given the 'private' linkage type. However,
this caused them to end up in different sections with the wrong prefix. E.g.,
they would be in the __TEXT,__const section with an 'L' prefix instead of an 'l'
(lowercase ell) prefix.

The problem is that the linker will eat a literal label with 'L'. If a weak
symbol is then placed into the __TEXT,__const section near that literal, then it
cannot distinguish between the literal and the weak symbol.

Part of the problems here was introduced because the address sanitizer converted
some C strings into constant initializers with trailing nuls. (Thus putting them
in the __const section with the wrong prefix.) The others were variables that
the address sanitizer created but simply had the wrong linkage type.

llvm-svn: 187827
2013-08-06 22:52:42 +00:00
Reid Kleckner
59f77601ec Remove some std stream usage from Support and TableGen
LLVM's coding standards recommend raw_ostream and MemoryBuffer for
reading and writing text.

This has the side effect of allowing clang to compile more of Support
and TableGen in the Microsoft C++ ABI.

llvm-svn: 187826
2013-08-06 22:51:21 +00:00
Arnold Schwaighofer
af6776a17b LoopVectorize: Allow vectorization of loops with lifetime markers
Patch by Marc Jessome!

llvm-svn: 187825
2013-08-06 22:37:52 +00:00
Akira Hatanaka
0eff6770f2 [mips] Delete unnecessary InstAliases. Also, clear some of the InstAlias'
EmitAlias flag and have MipsInstPrinter::printAlias print the aliases.

llvm-svn: 187824
2013-08-06 22:35:29 +00:00
Akira Hatanaka
354394e047 [mips] Replace usages of register classes with register operands. Also, remove
unnecessary jalr InstAliases in Mips64InstrInfo.td and add the code to print
jalr InstAliases in MipsInstPrinter::printAlias.

llvm-svn: 187821
2013-08-06 22:20:40 +00:00
Manman Ren
50def296e2 Debug Info Finder|Verifier: handle DbgLoc attached to instructions.
Also remove checking of llvm.dbg.sp since it is not used in generating dwarf.

Current state of Finder:
DebugInfoFinder tries to list all debug info MDNodes used in a module. To
list debug info MDNodes used by an instruction, DebugInfoFinder provides
processDeclare, processValue and processLocation to handle DbgDeclareInst,
DbgValueInst and DbgLoc attached to instructions. processModule will go
through all DICompileUnits in llvm.dbg.cu and list debug info MDNodes
used by the CUs.

TODO:
1> Finder has a list of CUs, SPs, Types, Scopes and global variables. We
need to add a list of variables that are used by DbgDeclareInst and
DbgValueInst.
2> MDString fields should be null or isa<MDString> and MDNode fields should be
null or isa<MDNode>. We currently use empty string or int 0 to represent null.
3> Go though Verify functions and make sure that they check field types.
4> Clean up existing testing cases to remove llvm.dbg.sp and make sure each
testing case has a llvm.dbg.cu.

Re-apply r187609 with fix to pass ocaml binding. vmcore.ml generates a debug
location with scope being metadata !{}, in verifier we treat this as a null
scope.

llvm-svn: 187812
2013-08-06 19:38:43 +00:00
Jakub Staszak
06543ea089 Adjust file to the coding standard.
llvm-svn: 187808
2013-08-06 17:03:42 +00:00
Hal Finkel
71d37e18da Add PPC64 mulli pattern
The PPC backend had been missing a pattern to generate mulli for 64-bit
multiples. We had been generating it only for 32-bit multiplies. Unfortunately,
generating li + mulld unnecessarily increases register pressure.

llvm-svn: 187807
2013-08-06 17:03:03 +00:00