1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 12:33:33 +02:00
Commit Graph

105116 Commits

Author SHA1 Message Date
Alexey Samsonov
036373fe61 [ASan] Print exact source location of global variables in error reports.
See https://code.google.com/p/address-sanitizer/issues/detail?id=299 for the
original feature request.

Introduce llvm.asan.globals metadata, which Clang (or any other frontend)
may use to report extra information about global variables to ASan
instrumentation pass in the backend. This metadata replaces
llvm.asan.dynamically_initialized_globals that was used to detect init-order
bugs. llvm.asan.globals contains the following data for each global:
  1) source location (file/line/column info);
  2) whether it is dynamically initialized;
  3) whether it is blacklisted (shouldn't be instrumented).

Source location data is then emitted in the binary and can be picked up
by ASan runtime in case it needs to print error report involving some global.
For example:

  0x... is located 4 bytes to the right of global variable 'C::array' defined in '/path/to/file:17:8' (0x...) of size 40

These source locations are printed even if the binary doesn't have any
debug info.

This is an ABI-breaking change. ASan initialization is renamed to
__asan_init_v4(). Pre-built libraries compiled with older Clang will not work
with the fresh runtime.

llvm-svn: 212188
2014-07-02 16:54:41 +00:00
Chad Rosier
f00a3b6176 Revert "Revert "MachineScheduler: better book-keeping for asserts.""
This reverts commit r212109, which reverted r212088.

However, disable the assert as it's not necessary for correctness.  There are
several corner cases that the assert needed to handle better for in-order
scheduling, but none of them are incorrect scheduler behavior. The assert is
mainly there to collect good unit tests like this and ensure that the
target-independent scheduler is working as expected with the various machine
models.

llvm-svn: 212187
2014-07-02 16:46:08 +00:00
Sylvestre Ledru
1f3e92c871 Also document the 'arc commit' commands in the 'Committing a change' section of the Phabricator doc
llvm-svn: 212184
2014-07-02 15:25:25 +00:00
Benjamin Kramer
972b4f1dd9 X86: When combining shuffles just remove shuffles that are completely redundant.
CombineTo doesn't allow replacing a node with itself so this would crash if the
combined shuffle is the same as the input shuffle.

llvm-svn: 212181
2014-07-02 15:09:44 +00:00
Axel Naumann
ef74b5b7d7 Undefine R2, R4, R6 after use.
llvm-svn: 212179
2014-07-02 14:40:35 +00:00
Elena Demikhovsky
2a53c3fac5 AVX-512: dec/inc instructions are slow on KNL
After Alexey Volkov, I'm adding the same property for KNL, that prefers ADD/SUB instead of INC/DEC.
Added a test.

llvm-svn: 212178
2014-07-02 14:11:05 +00:00
Matt Arsenault
73757b2b4b Move operator[] to DomTreeNodeBase
The comment in base even refers to it, but it was only defined
in the subclass.

llvm-svn: 212169
2014-07-02 06:50:48 +00:00
Matt Arsenault
4dc8768d57 Fix missing const
llvm-svn: 212168
2014-07-02 06:45:26 +00:00
David Majnemer
68ed1a9119 InstCombine: Optimize x/INT_MIN to x==INT_MIN
The result of x/INT_MIN is either 0 or 1, we can just use an icmp
instead.

llvm-svn: 212167
2014-07-02 06:42:13 +00:00
Chandler Carruth
d3bf1762bd [cleanup] Hoist an if-else chain on ISD opcodes (really designed for
switches) into a switch, and sink them into a dispatch function that can
return the result rather than awkward variable setting with breaks.

llvm-svn: 212166
2014-07-02 06:23:34 +00:00
David Majnemer
0418802b47 InstCombine: Add a vector variant test for PR20186
No functional change, just adding more test coverage that was meant to
go in with r212164.

llvm-svn: 212165
2014-07-02 06:14:13 +00:00
David Majnemer
5449bfbb6f InstCombine: Don't turn -(x/INT_MIN) -> x/INT_MIN
It is not safe to negate the smallest signed integer, doing so yields
the same number back.

This fixes PR20186.

llvm-svn: 212164
2014-07-02 06:07:09 +00:00
Owen Anderson
220bba5c5d Add range for-loop iterator adapter for cases in SwitchInst.
Patch by Marcello Maggioni, reviewed by Reid Kleckner.

llvm-svn: 212163
2014-07-02 05:32:13 +00:00
Saleem Abdulrasool
ac95fd68f3 aarch64: support target-specific .req assembler directive
Based on the support for .req on ARM. The aarch64 variant has to keep track if
the alias register was a vector register (v0-31) or a general purpose or
VFP/Advanced SIMD ([bhsdq]0-31) register.

Patch by Janne Grunau!

llvm-svn: 212161
2014-07-02 04:50:23 +00:00
Chandler Carruth
456bcaba88 [cleanup] Remove dead 'break;' statements that I meant to nuke in
r212158 but missed.

Thanks to Craig for spotting the goof!

llvm-svn: 212159
2014-07-02 04:39:34 +00:00
Chandler Carruth
f80e626928 [cleanup] Hoist the promotion dispatch logic into the promote function
so that we can use return to express it more cleanly and avoid so many
nested switch statements.

llvm-svn: 212158
2014-07-02 03:07:15 +00:00
Chandler Carruth
fbcb8e0cd1 [cleanup] Nuke the 'VectorOp' bit of the promote method names.
This doesn't add any information for methods in the VectorLegalizer
class that clearly take SDAG operations to legalize.

llvm-svn: 212157
2014-07-02 03:07:11 +00:00
Chandler Carruth
233ad52d55 [x86] Clean up and modernize the doxygen and API comments for the vector
operation legalization code.

llvm-svn: 212155
2014-07-02 02:16:57 +00:00
Eric Christopher
0a1a2e475f Break out subtarget initialization that dependent variables need into
a separate function and clean up calling convention for helper function.

llvm-svn: 212153
2014-07-02 01:14:43 +00:00
Eric Christopher
b072603a8a Unify these two lines.
llvm-svn: 212152
2014-07-02 01:02:28 +00:00
Eric Christopher
ca67399b59 Move MipsJITInfo to the subtarget rather than the target machine.
llvm-svn: 212151
2014-07-02 00:54:12 +00:00
Eric Christopher
e519bfada2 Remove unnecessary include.
llvm-svn: 212150
2014-07-02 00:54:10 +00:00
Eric Christopher
d6e2fee952 Remove the cached InstrItineraryData on the TargetMachine, it's unnecessary.
llvm-svn: 212149
2014-07-02 00:54:07 +00:00
Reid Kleckner
7067950c24 Remove the recommendation against using std::function
Clang-cl supports MSVC-style RTTI now, and we can even compile
typeid(...) with /GR-.  Just don't instantiate std::function with a
polymorphic type, or bad things will happen.

llvm-svn: 212148
2014-07-02 00:42:07 +00:00
Eric Christopher
db2f596d56 Move the subtarget dependent features from XCoreTargetMachine
down to the subtarget.

llvm-svn: 212147
2014-07-02 00:10:09 +00:00
Eric Christopher
e035cb7329 Make XCoreSelectionDAGInfo take a DataLayout since it only needs
that information.

llvm-svn: 212146
2014-07-02 00:10:05 +00:00
Kevin Enderby
b64b923eba Also run clang-format on llvm-nm.cpp to tidy things up. No functional changes.
llvm-svn: 212143
2014-07-01 22:44:51 +00:00
Kevin Enderby
f6343915af Run clang-format on llvm-size.cpp to tidy things up. No functional changes.
llvm-svn: 212141
2014-07-01 22:26:31 +00:00
Juergen Ributzka
ce04dda8eb [FastISel] Factor out stackmap intrinsic selection code into a dedicated helper method. NFCI.
llvm-svn: 212140
2014-07-01 22:25:49 +00:00
Tim Northover
6522771fe6 X86: remove atomic instructions *after* we've iterated through them.
Otherwise they get freed and the implicit "isa<XYZ>" tests following
turn out badly (at least under sanitizers).

Also corrects the ordering of unordered atomic stores.

llvm-svn: 212136
2014-07-01 22:10:30 +00:00
Juergen Ributzka
241f08ad4e [DAG] Pass the argument list to the CallLoweringInfo via move semantics. NFCI.
The argument list vector is never used after it has been passed to the
CallLoweringInfo and moving it to the CallLoweringInfo is cleaner and
pretty much as cheap as keeping a pointer to it.

llvm-svn: 212135
2014-07-01 22:01:54 +00:00
Tim Northover
f7aeb57c87 X86: delegate expanding atomic libcalls to generic code.
On targets without cmpxchg16b or cmpxchg8b, the borderline atomic
operations were slipping through the gaps.

X86AtomicExpand.cpp was delegating to ISelLowering. Generic
ISelLowering was delegating to X86ISelLowering and X86ISelLowering was
asserting. The correct behaviour is to expand to a libcall, preferably
in generic ISelLowering.

This can be achieved by X86ISelLowering deciding it doesn't want the
faff after all.

llvm-svn: 212134
2014-07-01 21:44:59 +00:00
Reid Kleckner
83d46a1307 Optimize InstCombine stack memory consumption
This patch reduces the stack memory consumption of the InstCombine
function "isOnlyCopiedFromConstantGlobal() ", that in certain conditions
could overflow the stack because of excessive recursiveness.

For example, in a case like this:

%0 = alloca [50025 x i32], align 4
%1 = getelementptr inbounds [50025 x i32]* %0, i64 0, i64 0
store i32 0,                         i32* %1
%2 = getelementptr inbounds          i32* %1, i64 1
store i32 1,                         i32* %2
%3 = getelementptr inbounds          i32* %2, i64 1
store i32 2,                         i32* %3
%4 = getelementptr inbounds          i32* %3, i64 1
store i32 3,                         i32* %4
%5 = getelementptr inbounds          i32* %4, i64 1
store i32 4,                         i32* %5
%6 = getelementptr inbounds          i32* %5, i64 1
store i32 5,                         i32* %6
...

This piece of code crashes llvm when trying to apply instcombine on
desktop. On embedded devices this could happen with a much lower limit
of recursiveness.  Some instructions (getelementptr and bitcasts) make
the function recursively call itself on their uses, which is what makes
the example above consume so much stack (it becomes a recursive
depth-first tree visit with a very big depth).

The patch changes the algorithm to be semantically equivalent, but
iterative instead of recursive and the visiting order to be from a
depth-first visit to a breadth-first visit (visit all the instructions
of the current level before the ones of the next one).

Now if a lot of memory is required a heap allocation is done instead of
the the stack allocation, avoiding the possible crash.

Reviewed By: rnk

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

Patch by Marcello Maggioni!  We don't generally commit large stress test
that look for out of memory conditions, so I didn't request that one be
added to the patch.

llvm-svn: 212133
2014-07-01 21:36:20 +00:00
Alp Toker
62b822cb61 Move remaining LLVM_ENABLE_DUMP conditionals out of the headers
This macro is sometimes defined manually but isn't (and doesn't need to be) in
llvm-config.h so shouldn't appear in the headers, likewise NDEBUG.

Instead switch them over to LLVM_DUMP_METHOD on the definitions.

llvm-svn: 212130
2014-07-01 21:19:13 +00:00
David Blaikie
f1747799d3 DebugInfo: Keep track of subprograms who's arguments have been promoted.
Matching behavior with DeadArgumentElimination (and leveraging some
now-common infrastructure), keep track of the function from debug info
metadata if arguments are promoted.

This may produce interesting debug info - since the arguments may be
missing or of different types... but at least backtraces, inlining, etc,
will be correct.

llvm-svn: 212128
2014-07-01 21:13:37 +00:00
Eric Christopher
d403bea5ee Move the subtarget dependent features from SystemZTargetMachine
down to the subtarget. Add an initialization routine to assist.

llvm-svn: 212124
2014-07-01 20:19:02 +00:00
Eric Christopher
d0042e96b4 Remove the use and initialization of the target machine and subtarget
from SystemZFrameLowering.

llvm-svn: 212123
2014-07-01 20:18:59 +00:00
David Blaikie
f4df27716a DebugInfo: Provide a utility for building a mapping from llvm::Function*s to llvm::DISubprograms
Update DeadArgumentElimintation to use this, with the intent of reusing
the functionality for ArgumentPromotion as well.

llvm-svn: 212122
2014-07-01 20:05:26 +00:00
Tim Northover
2d5af48fc1 AArch64: fix comment typo
llvm-svn: 212120
2014-07-01 19:47:09 +00:00
Tim Northover
60e9ada729 X86: expand atomics in IR instead of as MachineInstrs.
The logic for expanding atomics that aren't natively supported in
terms of cmpxchg loops is much simpler to express at the IR level. It
also allows the normal optimisations and CodeGen improvements to help
out with atomics, instead of using a limited set of possible
instructions..

rdar://problem/13496295

llvm-svn: 212119
2014-07-01 18:53:31 +00:00
Sean Silva
31dbd2c8cd [docs] Fix a mangled sentence.
Fixes PR20169

llvm-svn: 212116
2014-07-01 18:22:32 +00:00
Sean Silva
35569409fe [docs] Remove stray HTML tag.
Fixes PR20167

llvm-svn: 212115
2014-07-01 18:15:00 +00:00
Adam Nemet
da774db14e [X86] AVX512: Allow writemasks with vpcmp
For now I only updated the _alt variants.  The main variants are used by
codegen and that will need a bit more work to trigger.

<rdar://problem/17492620>

llvm-svn: 212114
2014-07-01 18:03:45 +00:00
Adam Nemet
3b6318203d [X86] AVX512: Factor generating the AsmString into avx512_icmp_cc
Adding a writemask variant would require a third asm string to be passed to
the template.  Generate the AsmString in the template instead.

No change in X86.td.expanded.

llvm-svn: 212113
2014-07-01 18:03:43 +00:00
Chad Rosier
92846e46b5 Revert "MachineScheduler: better book-keeping for asserts."
This reverts commit r212088, which is causing a number of spec
failures.  Will provide reduced test cases shortly.
PR20057

llvm-svn: 212109
2014-07-01 17:23:11 +00:00
Kevin Enderby
a6fe7b39f8 Add the -arch flag support to llvm-size like what was done to llvm-nm
to select the slice out of a Mach-O universal file.  This also includes
support for -arch all, selecting the host architecture by default from
a universal file and checking if -arch is used with a standard Mach-O
it matches that architecture.

llvm-svn: 212108
2014-07-01 17:19:10 +00:00
Quentin Colombet
f03a637a3d [PeepholeOptimzer] Fix a typo in a comment.
Spotted by Amara Emerson.

llvm-svn: 212106
2014-07-01 16:23:44 +00:00
Benjamin Kramer
f549b1dab1 Remove unused typedef. GCC warns about this.
llvm-svn: 212105
2014-07-01 15:39:32 +00:00
David Majnemer
bbb6d0ba1d GlobalOpt: Don't swap private for internal linkage
There were transforms whose *intent* was to downgrade the linkage of
external objects to have internal linkage.

However, it fired on things with private linkage as well.

llvm-svn: 212104
2014-07-01 15:26:50 +00:00
David Majnemer
aa656c0b38 GlobalOpt: FileCheck-ize test
No functionality change.

llvm-svn: 212103
2014-07-01 15:26:47 +00:00