Commit Graph

190255 Commits

Author SHA1 Message Date
Duncan P. N. Exon Smith a5a0f5766a Utils: Handle remapping distinct MDLocations
Part of PR21433.

llvm-svn: 225921
2015-01-14 01:29:32 +00:00
Jonathan Roelofs 9144235617 Refactor the lit config's linker flag discovery code. NFC
llvm-svn: 225920
2015-01-14 01:29:04 +00:00
Rafael Espindola a9782ecfb0 Handle LD_LIBRARY_PATH not being defined.
Should fix the bots after r225890.

llvm-svn: 225919
2015-01-14 01:28:08 +00:00
Duncan P. N. Exon Smith b84840c04e Utils: Thread distinct-ness through the cloneMD*() functions, NFC
The new logic isn't actually reachable yet, so no functionality change.

llvm-svn: 225918
2015-01-14 01:24:38 +00:00
Duncan P. N. Exon Smith 7c69c1ebda Utils: Extract cloneMDNode(), NFC
llvm-svn: 225917
2015-01-14 01:22:47 +00:00
Duncan P. N. Exon Smith b6515d6a71 Utils: Move cloneMD*() up, NFC
llvm-svn: 225915
2015-01-14 01:21:24 +00:00
Duncan P. N. Exon Smith 47d82981d6 Utils: Add mapping for uniqued MDLocations
Still doesn't handle distinct ones.  Part of PR21433.

llvm-svn: 225914
2015-01-14 01:20:27 +00:00
Tom Stellard ae38f30d7b R600/SI: Define a schedule model
The machine scheduler is still disabled by default.

The schedule model is not complete yet, and could be improved.

llvm-svn: 225913
2015-01-14 01:13:19 +00:00
Duncan P. N. Exon Smith 4766e01250 Utils: Extract cloneMDTuple(), NFC
llvm-svn: 225912
2015-01-14 01:12:14 +00:00
Duncan P. N. Exon Smith fb9d128ab1 Utils: Extract shouldRemapUniquedNode(), NFC
llvm-svn: 225911
2015-01-14 01:08:47 +00:00
JF Bastien 4cb557039d Insert random noops to increase security against ROP attacks (clang)
A pass that adds random noops to X86 binaries to introduce diversity with the goal of increasing security against most return-oriented programming attacks.

Command line options:
  -noop-insertion // Enable noop insertion.
  -noop-insertion-percentage=X // X% of assembly instructions will have a noop prepended (default: 50%, requires -noop-insertion)
  -max-noops-per-instruction=X // Randomly generate X noops per instruction. ie. roll the dice X times with probability set above (default: 1). This doesn't guarantee X noop instructions.

In addition, the following 'quick switch' in clang enables basic diversity using default settings (currently: noop insertion and schedule randomization; it is intended to be extended in the future).
  -fdiversify

This is the clang part of the patch.
llvm part: D3392

http://reviews.llvm.org/D3393
Patch by Stephen Crane (@rinon)

llvm-svn: 225910
2015-01-14 01:07:51 +00:00
Hal Finkel 934361a4b8 Revert "r225811 - Revert "r225808 - [PowerPC] Add StackMap/PatchPoint support""
This re-applies r225808, fixed to avoid problems with SDAG dependencies along
with the preceding fix to ScheduleDAGSDNodes::RegDefIter::InitNodeNumDefs.
These problems caused the original regression tests to assert/segfault on many
(but not all) systems.

Original commit message:

This commit does two things:

 1. Refactors PPCFastISel to use more of the common infrastructure for call
    lowering (this lets us take advantage of this common code for lowering some
    common intrinsics, stackmap/patchpoint among them).

 2. Adds support for stackmap/patchpoint lowering. For the most part, this is
    very similar to the support in the AArch64 target, with the obvious differences
    (different registers, NOP instructions, etc.). The test cases are adapted
    from the AArch64 test cases.

One difference of note is that the patchpoint call sequence takes 24 bytes, so
you can't use less than that (on AArch64 you can go down to 16). Also, as noted
in the docs, we take the patchpoint address to be the actual code address
(assuming the call is local in the TOC-sharing sense), which should yield
higher performance than generating the full cross-DSO indirect-call sequence
and is likely just as useful for JITed code (if not, we'll change it).

StackMaps and Patchpoints are still marked as experimental, and so this support
is doubly experimental. So go ahead and experiment!

llvm-svn: 225909
2015-01-14 01:07:51 +00:00
JF Bastien dcdd5ad252 Insert random noops to increase security against ROP attacks (llvm)
A pass that adds random noops to X86 binaries to introduce diversity with the goal of increasing security against most return-oriented programming attacks.

Command line options:
  -noop-insertion // Enable noop insertion.
  -noop-insertion-percentage=X // X% of assembly instructions will have a noop prepended (default: 50%, requires -noop-insertion)
  -max-noops-per-instruction=X // Randomly generate X noops per instruction. ie. roll the dice X times with probability set above (default: 1). This doesn't guarantee X noop instructions.

In addition, the following 'quick switch' in clang enables basic diversity using default settings (currently: noop insertion and schedule randomization; it is intended to be extended in the future).
  -fdiversify

This is the llvm part of the patch.
clang part: D3393

http://reviews.llvm.org/D3392
Patch by Stephen Crane (@rinon)

llvm-svn: 225908
2015-01-14 01:07:26 +00:00
Hal Finkel 665026838b Adjust ScheduleDAGSDNodes::RegDefIter for patchpoints
PATCHPOINT is a strange pseudo-instruction. Depending on how it is used, and
whether or not the AnyReg calling convention is being used, it might or might
not define a value. However, its TableGen definition says that it defines one
value, and so when it doesn't, the code in ScheduleDAGSDNodes::RegDefIter
becomes confused and the code that uses the RegDefIter will try to get the
register class of the MVT::Other type associated with the PATCHPOINT's chain
result (under certain circumstances).

This will be covered by the PPC64 PatchPoint test cases once that support is
re-committed.

llvm-svn: 225907
2015-01-14 01:07:03 +00:00
Duncan P. N. Exon Smith 637e765907 Utils: Simplify code, NFC
llvm-svn: 225906
2015-01-14 01:07:03 +00:00
Duncan P. N. Exon Smith b557989a40 Utils: Extract mapUniquedNode(), NFC
llvm-svn: 225905
2015-01-14 01:06:21 +00:00
Reid Kleckner 0a57f65514 CodeGen support for x86_64 SEH catch handlers in LLVM
This adds handling for ExceptionHandling::MSVC, used by the
x86_64-pc-windows-msvc triple. It assumes that filter functions have
already been outlined in either the frontend or the backend. Filter
functions are used in place of the landingpad catch clause type info
operands. In catch clause order, the first filter to return true will
catch the exception.

The C specific handler table expects the landing pad to be split into
one block per handler, but LLVM IR uses a single landing pad for all
possible unwind actions. This patch papers over the mismatch by
synthesizing single instruction BBs for every catch clause to fill in
the EH selector that the landing pad block expects.

Missing functionality:
- Accessing data in the parent frame from outlined filters
- Cleanups (from __finally) are unsupported, as they will require
  outlining and parent frame access
- Filter clauses are unsupported, as there's no clear analogue in SEH

In other words, this is the minimal set of changes needed to write IR to
catch arbitrary exceptions and resume normal execution.

Reviewers: majnemer

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

llvm-svn: 225904
2015-01-14 01:05:27 +00:00
Duncan P. N. Exon Smith 8725ca8c60 Utils: MDNode => UniquableMDNode, NFC
Although this makes the `cast<>` assert more often, the
`assert(Node->isResolved())` on the following line would assert in all
those cases.  So, no functionality change here.

llvm-svn: 225903
2015-01-14 01:05:17 +00:00
Duncan P. N. Exon Smith 14cc94c1c6 Utils: Separate out mapDistinctNode(), NFC
llvm-svn: 225902
2015-01-14 01:03:05 +00:00
Duncan P. N. Exon Smith 3956a85e6e Utils: Use helper function directly, NFC
llvm-svn: 225901
2015-01-14 01:02:17 +00:00
Adrian Prantl 7813d9c979 Debug Info: Implement DwarfCompileUnit::addComplexAddress() using
DIEDwarfExpression (and get rid of a bunch of redundant code).

NFC

llvm-svn: 225900
2015-01-14 01:01:30 +00:00
Adrian Prantl ad768c3719 Debug Info: Emitting a register in DwarfExpression may fail. Report the
status in a bool and let the users deal with the error.

NFC.

llvm-svn: 225899
2015-01-14 01:01:28 +00:00
Adrian Prantl 658676c3ea Debug Info: Move DIEDwarfExpression into DwarfExpression.h because it
needs to be accessed from both DwarfCompileUnit.cpp and DwarfUnit.cpp.

NFC.

llvm-svn: 225898
2015-01-14 01:01:22 +00:00
Duncan P. N. Exon Smith 077affdbb9 Utils: Extract helper function, NFC
llvm-svn: 225897
2015-01-14 01:01:19 +00:00
Duncan P. N. Exon Smith 34651ee2f6 Utils: Use MDTuple::get() directly, NFC
Working towards supporting `MDLocation` in `MapMetadata()`.

llvm-svn: 225896
2015-01-14 00:59:57 +00:00
Ahmed Bougacha 71d7b18e3d [SimplifyLibCalls] Don't try to simplify indirect calls.
It turns out, all callsites of the simplifier are guarded by a check for
CallInst::getCalledFunction (i.e., to make sure the callee is direct).

This check wasn't done when trying to further optimize a simplified fortified
libcall, introduced by a refactoring in r225640.

Fix that, add a testcase, and document the requirement.

llvm-svn: 225895
2015-01-14 00:55:05 +00:00
Alexey Samsonov 7af6af4225 Update HelpText for -fsanitize= option.
There are too many available sanitizers now - redirect to
user manual instead of listing them all.

llvm-svn: 225894
2015-01-14 00:51:17 +00:00
Eric Christopher 16370678e3 Remove unused predicate.
llvm-svn: 225893
2015-01-14 00:50:33 +00:00
Eric Christopher 2b8ef99aa8 Update for move in llvm.
llvm-svn: 225892
2015-01-14 00:50:32 +00:00
Eric Christopher 6e30cd95cb Migrate ABIName to MCTargetOptions so that it can be shared between
the TargetMachine level and the MC level.

llvm-svn: 225891
2015-01-14 00:50:31 +00:00
Rafael Espindola bc301a8ed4 Don't set LD_PRELOAD to ''. It doesn't work on OpenBSD.
Patch by Brad Smith.

llvm-svn: 225890
2015-01-14 00:39:56 +00:00
Richard Smith 43d3f55072 Look through sugar when determining whether a type is a scoped enumeration
type. Patch by Stephan Bergmann!

llvm-svn: 225889
2015-01-14 00:33:10 +00:00
David Majnemer a3b04cea04 Sema: An extern declaration can't be a redeclaration of a parameter
In the following:
void f(int x) { extern int x; }

The second declaration of 'x' shouldn't be considered a redeclaration of
the parameter.

This is a different approach to r225780.

llvm-svn: 225875
2015-01-14 00:31:13 +00:00
Chandler Carruth 11f5032368 Revert r225854: [PM] Move the LazyCallGraph printing functionality to
a print method.

This was formulated on a bad idea, but sadly I didn't uncover how bad
this was until I got further down the path. I had hoped that we could
provide a low boilerplate way of printing analyses, but it just doesn't
seem like this really fits the needs of the analyses. Not all analyses
really want to do printing, and those that do don't all use the same
interface. Instead, with the new pass manager let's just take advantage
of the fact that creating an explicit printer pass like the LCG has is
pretty low boilerplate already and rely on that for testing.

llvm-svn: 225861
2015-01-14 00:27:45 +00:00
Rui Ueyama cfb2534ef8 Revert "Convert other drivers to use WrapperNode" and subsequent commits.
r225764 broke a basic functionality on Mac OS. This change reverts
r225764, r225766, r225767, r225769, r225814, r225816, r225829, and r225832.

llvm-svn: 225859
2015-01-14 00:21:34 +00:00
Adrian Prantl 8efadbf868 Debug Info: Don't bother emitting DW_AT_frame_base if the function has
no frame register. "Tested" via an assertion triggered by DwarfExpression.

llvm-svn: 225858
2015-01-14 00:15:16 +00:00
Adrian Prantl 1411577ad9 Revert "Debug Info: Bail out of AddMachineRegPiece() if MachineReg is not a"
This reverts commit r225852, it was a bad idea.

MachineReg should always be a physical register. If it isn't this DebugLoc
shouldn't have been created in the first place.

llvm-svn: 225857
2015-01-14 00:15:12 +00:00
David Blaikie f142580dea Sink a parameter into the callee since it's always the same expression in terms of another parameter
llvm-svn: 225856
2015-01-14 00:04:42 +00:00
Chandler Carruth 76890d82c0 [PM] Move the LazyCallGraph printing functionality to a print method.
I'm adding generic analysis printing utility pass support which will
require such a method (or a specialization) so this will let the
existing printing logic satisfy that.

llvm-svn: 225854
2015-01-13 23:53:50 +00:00
Jason Molenda bed7f07080 Save & restore the array of which registers have already been
saved/restored across a mid-function epilogue.  We ignore 
repeated push/pops of a register so once we saw one 'pop %rbp',
we'd ignore it the second time we saw it.
<rdar://problem/19417410>

llvm-svn: 225853
2015-01-13 23:48:53 +00:00
Adrian Prantl e8e0bac270 Debug Info: Bail out of AddMachineRegPiece() if MachineReg is not a
physical register. The call to getMinimalPhysRegClass() later on asserts
on this condition.

llvm-svn: 225852
2015-01-13 23:39:15 +00:00
Adrian Prantl 092d9489ed Debug Info: Move the complex expression handling (=the remainder) of
emitDebugLocValue() into DwarfExpression.

Ought to be NFC, but it actually uncovered a bug in the debug-loc-asan.ll
testcase. The testcase checks that the address of variable "y" is stored
at [RSP+16], which also lines up with the comment.
It also check(ed) that the *value* of "y" is stored in RDI before that,
but that is actually incorrect, since RDI is the very value that is
stored in [RSP+16]. Here's the assembler output:

	movb	2147450880(%rcx), %r8b
	#DEBUG_VALUE: bar:y <- RDI
	cmpb	$0, %r8b
	movq	%rax, 32(%rsp)          # 8-byte Spill
	movq	%rsi, 24(%rsp)          # 8-byte Spill
	movq	%rdi, 16(%rsp)          # 8-byte Spill
.Ltmp3:
	#DEBUG_VALUE: bar:y <- [RSP+16]

Fixed the comment to spell out the correct register and the check to
expect an address rather than a value.

Note that the range that is emitted for the RDI location was and is still
wrong, it claims to begin at the function prologue, but really it should
start where RDI is first assigned.

llvm-svn: 225851
2015-01-13 23:39:11 +00:00
Adam Nemet d23c88db15 [AVX512] Add 16x32 unpck tests as well
Forgot this from r225838.

llvm-svn: 225850
2015-01-13 23:27:55 +00:00
Oleksiy Vyalov d5f8b6a6ca Extend PipePosix with support for named pipes/timeout-based IO and integrate it with GDBRemoteCommunication / lldb-gdbserver.
http://reviews.llvm.org/D6954

llvm-svn: 225849
2015-01-13 23:19:40 +00:00
Adrian Prantl 0a3bfdbd37 cleanup.
llvm-svn: 225848
2015-01-13 23:11:51 +00:00
Adrian Prantl 172ab66a11 Document, cleanup, and clang-format DwarfExpression.h
llvm-svn: 225847
2015-01-13 23:11:07 +00:00
Adrian Prantl 8995f5c92f Debug Info: Turn DIExpression::getFrameRegister() into an isFrameRegister()
function.

NFC.

llvm-svn: 225846
2015-01-13 23:10:43 +00:00
David Blaikie 1ae04916cc DebugInfo: Correct the location of EH cleanup for blocks
This was previously piggybacking on whatever happened to be the last
location set on CGDebugInfo/DIBuilder, which was wrong (it was often the
current location, such as the 'fn()' call site, not the end of the
block). With my improvements to set/unset the location in a scoped
manner (r225000) this went from a bad quality situation, to a crash.
Fixing this goes part-way to unblocking the recommit of r225000.

It's likely that any call to CodeGenFunction::StartFunction without the
CurEHLocation set represents a similar bug or risk of a bug. Perhaps
there are some callers that know they won't generate EH cleanups, but
I'm not sure.

I considered a generic catch-fix in StartFunction (just fallback to the
GlobalDecl's location) but that seemed like it'd mask bugs where the EH
location shouldn't be the same as the decl's location (& indeed by not
using that stop-gap I found this bug). We'll see how long I can hold out
on the generic catch-all. I might eventually be able to add an assertion
in.

llvm-svn: 225845
2015-01-13 23:06:27 +00:00
Tom Stellard fb77f00be8 R600/SI: Add pattern for bitcasting fp immediates to integers
The backend now assumes that all immediates are integers.  This allows
us to simplify immediate handling code, becasue we no longer need to
handle fp and integer immediates differently.

llvm-svn: 225844
2015-01-13 22:59:41 +00:00
Chandler Carruth 703378f156 [PM] Remove the defunt CGSCC-specific debug flag.
Even before I sunk the debug flag into the opt tool this had been made
obsolete by factoring the pass and analysis managers into a single set
of templates that all used the core flag. No functionality changed here.

llvm-svn: 225842
2015-01-13 22:45:13 +00:00