Commit Graph

231 Commits

Author SHA1 Message Date
Duncan P. N. Exon Smith fda02091e6 uselistorder: Remove dead include
Forgot to remove the include in r234970

llvm-svn: 234972
2015-04-15 03:04:45 +00:00
Duncan P. N. Exon Smith bb9cadf4eb uselistorder: -mllvm -preserve-ll-use-list-order => -emit-llvm-uselists
Follow up to r234962, start respecting `-emit-llvm-uselists even for
LLVM assembly.  Note that the driver never passes this flag; this is
just a interface convenience/consistency for those using `-cc1`
directly.  This required LLVM r234969 (and predecessors).

llvm-svn: 234970
2015-04-15 02:45:28 +00:00
Duncan P. N. Exon Smith bb61825cd5 uselistorder: -mllvm -preserve-bc-use-list-order => -emit-llvm-uselists
Stop relying on `cl::opt` to pass along the driver's decision to
preserve use-lists.  Create a new `-cc1` option called
`-emit-llvm-uselists` that does the right thing (when -emit-llvm-bc).
Note that despite its generic name, it *doesn't* do the right thing when
-emit-llvm (LLVM assembly) yet.  I'll hook that up soon.

This doesn't really change the behaviour of the driver.  The default is
still to preserve use-lists for `clang -emit-llvm` and `clang
-save-temps`, and nothing else.  But it stops relying on global state
(and also is a nicer interface for hackers using `clang -cc1`).

llvm-svn: 234962
2015-04-15 01:16:18 +00:00
Duncan P. N. Exon Smith 58927f1aa2 uselistorder: Update for LLVM API change in r234959
Now that `addBitcodeWriterPass()` requires an explicit bit to preserve
use-list order, send it in from `clang`.  It looks like I'll be able to
push this up to the `-cc1` options.

llvm-svn: 234960
2015-04-15 00:36:14 +00:00
Rafael Espindola 2f16bc1095 Use raw_pwrite_stream in clang.
This is a small improvement to -emit-pth and allows llvm to start requiring it.

llvm-svn: 234897
2015-04-14 15:15:49 +00:00
Ahmed Bougacha 256a869d31 [Driver] Properly support -mglobal-merge using explicit options.
Follow-up to r234666.  With this, the -m[no-]global-merge options
have the expected behavior. Previously, -mglobal-merge was ignored,
and there was no way of enabling the optimization.

llvm-svn: 234668
2015-04-11 00:10:44 +00:00
Rafael Espindola 4dedcd7eab Update for LLVM api changes.
llvm-svn: 234536
2015-04-09 21:06:11 +00:00
Duncan P. N. Exon Smith f80840f784 Clang follow-up to LLVM r232772
-verify-di is dead! Long live -verify!

llvm-svn: 232779
2015-03-19 22:43:38 +00:00
Michael Zolotukhin c888dd0cb8 Add fveclib option.
Review: http://reviews.llvm.org/D8097
llvm-svn: 232533
2015-03-17 20:03:11 +00:00
Justin Bogner 4e46237c6d GCOV: Expose the -coverage-exit-block-before-body flag in clang -cc1
This exposes the optional exit block placement logic from r232438 as a
clang -cc1 option. There is a test on the llvm side, but there isn't
really a way to inspect the gcov options from clang to test it here as
well.

llvm-svn: 232439
2015-03-16 23:52:21 +00:00
Reid Kleckner 77b1811fde Try to fix the build after removing DataLayoutPass
llvm-svn: 231278
2015-03-04 19:10:41 +00:00
Rafael Espindola 6b07a1c6ee Add -funique-section-names and -fno-unique-section-names options.
For now -funique-section-names is the default, so no change in default behavior.

The total .o size in a build of llvm and clang goes from 241687775 to 230649031
bytes if -fno-unique-section-names is used.

llvm-svn: 230031
2015-02-20 18:08:57 +00:00
Chandler Carruth 9828e69a3f [PM] Fix #include order here that I forgot to update before changing it.
llvm-svn: 229092
2015-02-13 09:57:03 +00:00
Chandler Carruth 8f4f5090b4 [PM] Move away from the old llvm/PassManager.h header and its using
declarations and just use the legacy namespace qualifier in this file
and the permanent header name.

The old wrapper header is going away to make LLVM's build more modular,
and without updating Clang I can't easily start to add usage of the new
pass manager to Clang. This should make it more clear in the code which
set of types is doing what.

llvm-svn: 229090
2015-02-13 09:47:49 +00:00
Alexey Samsonov a511cdd247 Allow to specify multiple -fsanitize-blacklist= arguments.
Summary:
Allow user to provide multiple blacklists by passing several
-fsanitize-blacklist= options. These options now don't override
default blacklist from Clang resource directory, which is always
applied (which fixes PR22431).

-fno-sanitize-blacklist option now disables all blacklists that
were specified earlier in the command line (including the default
one).

This change depends on http://reviews.llvm.org/D7367.

Test Plan: regression test suite

Reviewers: timurrrr

Subscribers: cfe-commits, kcc, pcc

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

llvm-svn: 228156
2015-02-04 17:40:08 +00:00
Chandler Carruth d294bdb5ad [multiversion] Update Clang for the API change in LLVM r227731.
This moves all of the PassManager <-> Target communication to use the
new pass manager's TargetIRAnalysis even with the old pass manager. See
the LLVM commit for some of why things are moving in this direction, but
the short version is that this will enable us to create per-function
TargetTransformInfo objects that have correct subtarget information for
that function.

llvm-svn: 227732
2015-02-01 12:26:23 +00:00
Chandler Carruth aab5ec078e [PM] Update Clang for the new LLVM API in r227685 for managing the
TargetTransformInfo, and unify the code in a single place.

llvm-svn: 227686
2015-01-31 11:18:46 +00:00
Eric Christopher 611dfed99f Update for LLVM API change.
llvm-svn: 227114
2015-01-26 19:03:30 +00:00
Chandler Carruth 57bb7c7cad [PM] Update Clang to reflect the TLI API change in LLVM r226981.
llvm-svn: 226982
2015-01-24 02:25:21 +00:00
Alexander Kornienko 6ee521c7eb Replace size() calls on containers with empty() calls where appropriate. NFC
http://reviews.llvm.org/D7090

Patch by Gábor Horváth!

llvm-svn: 226914
2015-01-23 15:36:10 +00:00
Chandler Carruth a9711a9aa4 [PM] Track an LLVM API update which separates the TargetLibraryInfo
object from the pass that provides access to it.

We should probably refactor the createTLI code here in Clang in light of
the new structure, but I wanted this patch to be a minimal one that just
patches the behavior back together.

llvm-svn: 226158
2015-01-15 10:42:26 +00:00
Chandler Carruth 418bd1ab30 [PM] Update for LLVM r226078 which moved TargetLibraryInfo to the
Analysis library.

llvm-svn: 226079
2015-01-15 02:16:55 +00:00
JF Bastien c7af264486 Revert "Insert random noops to increase security against ROP attacks (clang)"
This reverts commit:
http://reviews.llvm.org/D3393

llvm-svn: 225947
2015-01-14 05:24:11 +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
Eric Christopher 2b8ef99aa8 Update for move in llvm.
llvm-svn: 225892
2015-01-14 00:50:32 +00:00
Saleem Abdulrasool 76a4b95ad8 Driver: begin threading frontend support for SymbolRewriter
Allow blessed access to the symbol rewriter from the driver. Although the
symbol rewriter could be invoked through tools like opt and llc, it would not
accessible from the frontend. This allows us to read the rewrite map files in
the frontend rather than the backend and enable symbol rewriting for actually
performing the symbol interpositioning.

llvm-svn: 225504
2015-01-09 05:10:20 +00:00
Eric Christopher 526ca20011 Update for llvm front end change and use the TargetOptions struct
for ABI.

llvm-svn: 224493
2014-12-18 02:23:27 +00:00
Justin Bogner 970ac60573 InstrProf: Use LLVM's -instrprof pass for profiling
The logic for lowering profiling counters has been moved to an LLVM
pass. Emit the intrinsics rather than duplicating the whole pass in
clang.

llvm-svn: 223683
2014-12-08 19:04:51 +00:00
Kostya Serebryany 75b4f9e1e6 Introduce -fsanitize-coverage=N flag
Summary:
This change makes the asan-coverge (formerly -mllvm -asan-coverge)
accessible via a clang flag.
Companion patch to LLVM is http://reviews.llvm.org/D6152

Test Plan: regression tests, chromium

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: cfe-commits

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

llvm-svn: 221719
2014-11-11 22:15:07 +00:00
Alexey Samsonov a041610f11 [Sanitizer] Refactor sanitizer options in LangOptions.
Get rid of ugly SanitizerOptions class thrust into LangOptions:
* Make SanitizeAddressFieldPadding a regular language option,
  and rely on default behavior to initialize/reset it.
* Make SanitizerBlacklistFile a regular member LangOptions.
* Introduce the helper class "SanitizerSet" to represent the
  set of enabled sanitizers and make it a member of LangOptions.
  It is exactly the entity we want to cache and modify in CodeGenFunction,
  for instance. We'd also be able to reuse SanitizerSet in
  CodeGenOptions for storing the set of recoverable sanitizers,
  and in the Driver to represent the set of sanitizers
  turned on/off by the commandline flags.

No functionality change.

llvm-svn: 221653
2014-11-11 01:26:14 +00:00
Alexey Samsonov edf99a92c0 Introduce a SanitizerKind enum to LangOptions.
Use the bitmask to store the set of enabled sanitizers instead of a
bitfield. On the negative side, it makes syntax for querying the
set of enabled sanitizers a bit more clunky. On the positive side, we
will be able to use SanitizerKind to eventually implement the
new semantics for -fsanitize-recover= flag, that would allow us
to make some sanitizers recoverable, and some non-recoverable.

No functionality change.

llvm-svn: 221558
2014-11-07 22:29:38 +00:00
Nick Lewycky f04f237e0c Add a new -fmerge-functions -cc1 flag that enables function merging.
llvm-svn: 220543
2014-10-24 00:49:29 +00:00
Alexey Samsonov ae5804f3d7 Move -fsanitize-blacklist to LangOpts from CodeGenOpts. NFC.
After http://reviews.llvm.org/D5687 is submitted, we will need
SanitizerBlacklist before the CodeGen phase, so make it a LangOpt
(as it will actually affect ABI / class layout).

llvm-svn: 219842
2014-10-15 20:22:54 +00:00
Jonathan Roelofs b140a100a0 CFE Knob for: Add a thread-model knob for lowering atomics on baremetal & single threaded systems
http://reviews.llvm.org/D4985

llvm-svn: 219027
2014-10-03 21:57:44 +00:00
Rafael Espindola 4de669f5b3 Update for llvm api change.
llvm-svn: 217547
2014-09-10 21:27:41 +00:00
David Blaikie a97eaa1bc0 Provide a BuryPointer for unique_ptrs.
In theory, it'd be nice if we could move to a case where all buried
pointers were buried via unique_ptr to demonstrate that the program had
finished with the value (that we could really have cleanly deallocated
it) but instead chose to bury it.

I think the main reason that's not possible right now is the various
IntrusiveRefCntPtrs in the Frontend, sharing ownership for a variety of
compiler bits (see the various similar
"CompilerInstance::releaseAndLeak*" functions). I have yet to figure out
their correct ownership semantics - but perhaps, even if the
intrusiveness can be removed, the shared ownership may yet remain and
that would lead to a non-unique burying as is there today. (though we
could model that a little better - by passing in a shared_ptr, etc -
rather than needing the two step that's currently used in those other
releaseAndLeak* functions)

This might be a bit more robust if BuryPointer took the boolean:

BuryPointer(bool, unique_ptr<T>)

and the choice to bury was made internally - that way, even when
DisableFree was not set, the unique_ptr would still be null in the
caller and there'd be no chance of accidentally having a different
codepath where the value is used after burial in !DisableFree, but it
becomes null only in DisableFree, etc...

llvm-svn: 216742
2014-08-29 16:53:14 +00:00
Joerg Sonnenberger a43604ad50 Convert MC command line flag for fatal assembler warnings into a proper
flag.

llvm-svn: 216472
2014-08-26 18:40:25 +00:00
Rafael Espindola b8a71c5e14 Refactor TLI creation. NFC.
llvm-svn: 216198
2014-08-21 17:58:42 +00:00
Eric Christopher 3de0853b47 Update for LLVM API change.
llvm-svn: 214786
2014-08-04 21:33:42 +00:00
Bob Wilson 25363c00e4 Use -enable-global-merge option to match llvm r210639. <rdar://problem/17803206>
llvm revision 210639 renamed the -global-merge backend option to
-enable-global-merge. This change simply updates clang to match that.

Patch by Steven Wu!

llvm-svn: 213993
2014-07-26 00:37:28 +00:00
Alexey Samsonov c94285a1a0 [ASan] Completely remove sanitizer blacklist file from instrumentation pass.
All blacklisting logic is now moved to the frontend (Clang).
If a function (or source file it is in) is blacklisted, it doesn't
get sanitize_address attribute and is therefore not instrumented.
If a global variable (or source file it is in) is blacklisted, it is
reported to be blacklisted by the entry in llvm.asan.globals metadata,
and is not modified by the instrumentation.

The latter may lead to certain false positives - not all the globals
created by Clang are described in llvm.asan.globals metadata (e.g,
RTTI descriptors are not), so we may start reporting errors on them
even if "module" they appear in is blacklisted. We assume it's fine
to take such risk:
  1) errors on these globals are rare and usually indicate wild memory access
  2) we can lazily add descriptors for these globals into llvm.asan.globals
     lazily.

llvm-svn: 212505
2014-07-08 00:50:49 +00:00
Alexey Samsonov e595e1ade0 Remove top-level Clang -fsanitize= flags for optional ASan features.
Init-order and use-after-return modes can currently be enabled
by runtime flags. use-after-scope mode is not really working at the
moment.

The only problem I see is that users won't be able to disable extra
instrumentation for init-order and use-after-scope by a top-level Clang flag.
But this instrumentation was implicitly enabled for quite a while and
we didn't hear from users hurt by it.

llvm-svn: 210924
2014-06-13 17:53:44 +00:00
Alexey Samsonov cfe93d3e54 Remove unused variable
llvm-svn: 210041
2014-06-02 19:45:14 +00:00
Alexey Samsonov 1cf07ea6bb Remove sanitizer blacklist from ASan/TSan/MSan function passes.
Instrumentation passes now use attributes
address_safety/thread_safety/memory_safety which are added by Clang frontend.
Clang parses the blacklist file and adds the attributes accordingly.

Currently blacklist is still used in ASan module pass to disable instrumentation
for certain global variables. We should fix this as well by collecting the
set of globals we're going to instrument in Clang and passing it to ASan
in metadata (as we already do for dynamically-initialized globals and init-order
checking).

This change also removes -tsan-blacklist and -msan-blacklist LLVM commandline
flags in favor of -fsanitize-blacklist= Clang flag.

llvm-svn: 210037
2014-06-02 18:08:08 +00:00
Craig Topper 8a13c4180e [C++11] Use 'nullptr'. CodeGen edition.
llvm-svn: 209272
2014-05-21 05:09:00 +00:00
Eric Christopher 4015e124e3 Update for paired llvm commit with AsmVerbose.
llvm-svn: 209261
2014-05-21 00:00:03 +00:00
Eric Christopher acca0085c1 Update for llvm change to avoid having global flag setting in TargetMachine.
llvm-svn: 209239
2014-05-20 21:25:41 +00:00
Eric Christopher e76eee4638 Missed a ! in the if statement when these were being set and the options
are inverted in clang and llvm.

I'll attempt to get a testcase for this that doesn't involve compiling to .s,
but it's unlikely.

llvm-svn: 209017
2014-05-16 20:46:14 +00:00
Eric Christopher 7e72a0932b Fill in the options in the MCOptions struct directly like the other
options.

llvm-svn: 208834
2014-05-15 01:21:56 +00:00
Saleem Abdulrasool 61449c6b9a CodeGen: fix code model mapping
Large is CodeModel::Model::Large, not CodeModel::Model::Medium.  Thanks to
majnemer for pointing out the typo!  Its unclear how to test the mapped value in
the compiler, the tests already cover the driver side.

llvm-svn: 208335
2014-05-08 16:28:48 +00:00
Saleem Abdulrasool 62849c677c Driver: parse -mcmodel earlier
This addresses an existing FIXME item in the driver.  The code model flag was
parsed in the actual tool rather than in the driver.  This was problematic since
the value may be invalid.  In that case, we would silently treat it as a default
value in non-assert builds, and abort in assert builds.  Add a check in the
driver to validate that the value being passed is valid, and if not provide a
proper error message.

llvm-svn: 208275
2014-05-08 02:28:32 +00:00
Rafael Espindola b5b622a03c Drop non-cfi assembly support from clang.
After this patch clang will ignore -fdwarf2-cfi-asm and -ffno-dwarf2-cfi-asm and
always print assembly that uses cfi directives.

In llvm, MC itself supports cfi since the end of 2010 (support started
in r119972, is reported in the 2.9 release notes).

In binutils the support has been around for much longer. It looks like
support started to be added in May 2003. It is available in 2.15
(31-Aug-2011, 2.14 is from 12-Jun-2003).

llvm-svn: 207602
2014-04-30 02:22:09 +00:00
Duncan P. N. Exon Smith 85e349fd2c BackendUtil: Pass through -mdisable-tail-calls
The frontend option -fno-optimize-sibling-calls resolves to -cc1's
-mdisable-tail-calls, which is passed to the TargetMachine in the
backend.  PassManagerBuilder was adding the -tailcallelim pass anyway.

Use a new DisableTailCalls option in PassManagerBuilder to disable tail
calls harder.

Requires the matching commit in LLVM that adds DisableTailCalls.

<rdar://problem/16050591>

llvm-svn: 206543
2014-04-18 01:05:25 +00:00
Duncan P. N. Exon Smith 52eaffee03 verify-di: Call debug info verifier from clang
This is paired with a patch to LLVM that creates a separate pass for
verifying debug info.

<rdar://problem/15500563>

llvm-svn: 206301
2014-04-15 16:27:43 +00:00
Reid Kleckner fb873af67e Update Clang for LLVM split stack API changes in r205997
Patch by Alex Crichton!

llvm-svn: 205998
2014-04-10 22:59:13 +00:00
David Blaikie 7e2fd943ae Support for -Wa,-compress-debug-sections.
Also, while I'm here, support -nocompress-debug-sections too.

llvm-svn: 204959
2014-03-27 20:47:30 +00:00
Eli Bendersky b5cfa8c2f3 Don't recompute inlining threshold - use new overload provided by LLVM
Follow-up on LLVM r203669

llvm-svn: 203673
2014-03-12 16:30:34 +00:00
Ahmed Charles dfca6f97bc [C++11] Replace OwningPtr include with <memory>.
llvm-svn: 203389
2014-03-09 11:36:40 +00:00
Ahmed Charles b89843299a Replace OwningPtr with std::unique_ptr.
This compiles cleanly with lldb/lld/clang-tools-extra/llvm.

llvm-svn: 203279
2014-03-07 20:03:18 +00:00
Ahmed Charles 9a16beb8bc Change OwningPtr::take() to OwningPtr::release().
This is a precursor to moving to std::unique_ptr.

llvm-svn: 203275
2014-03-07 19:33:25 +00:00
Diego Novillo b56be64599 Schedule discriminator pass.
This needs to modify a line table test to account for the new lexical
block created to hold the new discriminator value.

llvm-svn: 202754
2014-03-03 20:06:18 +00:00
Ahmed Charles bf8e283f15 [C++11] Add #include's for OwningPtr.
Allows removing #include's in LLVM while switching to std::unique_ptr.

llvm-svn: 202677
2014-03-03 07:11:21 +00:00
Rafael Espindola 303f8b06f8 Update for llvm api change.
llvm-svn: 202170
2014-02-25 17:30:40 +00:00
Rafael Espindola 33ebd2171e Accept -no-integrated-as in -cc1 and forward it to llvm.
llvm-svn: 201837
2014-02-21 03:14:07 +00:00
Evgeniy Stepanov d04b861e69 [asan] Remove -fsanitize-address-zero-base-shadow command line
flag from clang, and disable zero-base shadow support on all platforms
where it is not the default behavior.

- It is completely unused, as far as we know.
- It is ABI-incompatible with non-zero-base shadow, which means all
objects in a process must be built with the same setting. Failing to
do so results in a segmentation fault at runtime.
- It introduces a backward dependency of compiler-rt on user code,
which is uncommon and complicates testing.

This is the Clang part of a larger change.

llvm-svn: 199372
2014-01-16 10:19:31 +00:00
Chandler Carruth ca88474aba [cleanup] Update the include of Dominators.h to reflect its move to the
IR library in LLVM r199082.

llvm-svn: 199083
2014-01-13 09:26:48 +00:00
Chandler Carruth 1b3304de4d [PM] Update Clang to reflect the new header for the bitcode writer pass
added in LLVM r199078.

llvm-svn: 199079
2014-01-13 07:47:38 +00:00
Chandler Carruth 809403ff3f [PM] Update the creation of an IR printing pass to reflect the API
update in LLVM r199044.

llvm-svn: 199045
2014-01-12 11:31:22 +00:00
Chandler Carruth 0a50c49607 [PM] Update Clang to follow the header rename in LLVM r199041.
llvm-svn: 199042
2014-01-12 11:11:50 +00:00
Chandler Carruth 58c0d69689 Update Clang for the move of headers in r198688.
llvm-svn: 198689
2014-01-07 12:34:48 +00:00
Alp Toker e83b9060cb Verify that clang TargetInfo descriptions match DataLayout strings from LLVM
The backend string is only verified when available as it's possible to run
clang IRGen for targets that haven't been built or don't exist in LLVM.

llvm-svn: 198309
2014-01-02 15:08:04 +00:00
Kostya Serebryany ce2c726e99 Bury leaked pointers in a global array to silence a leak detector in --disable-free mode
Summary:
This is an alternative to http://llvm-reviews.chandlerc.com/D2475
suggested by Chandler.

Reviewers: chandlerc, rnk, dblaikie

CC: cfe-commits, earthdok

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

llvm-svn: 198073
2013-12-27 08:11:08 +00:00
Alp Toker f4e2238119 Move the TargetMachine instance into EmitAssemblyHelper
Cleanup in preparation for enhanced DataLayout checking.

llvm-svn: 197832
2013-12-20 20:26:53 +00:00
Hal Finkel ce0697f475 Add -freroll-loops to enable loop rerolling
This adds -freroll-loops (and -fno-reroll-loops in the usual way) to enable
loop rerolling as part of the optimization pass manager. This transformation
can enable vectorization, reduce code size (or both).

Briefly, loop rerolling can transform a loop like this:

for (int i = 0; i < 3200; i += 5) {
  a[i]     += alpha * b[i];
  a[i + 1] += alpha * b[i + 1];
  a[i + 2] += alpha * b[i + 2];
  a[i + 3] += alpha * b[i + 3];
  a[i + 4] += alpha * b[i + 4];
}

into this:

for (int i = 0; i < 3200; ++i) {
  a[i] += alpha * b[i];
}

Loop rerolling is currently disabled by default at all optimization levels.

llvm-svn: 194967
2013-11-17 16:03:29 +00:00
Diego Novillo 5c29705c13 Add -fprofile-sample-use to Clang's driver.
This adds a new option -fprofile-sample-use=filename to Clang. It
tells the driver to schedule the SampleProfileLoader pass and passes
on the name of the profile file to use.

llvm-svn: 194567
2013-11-13 12:22:39 +00:00
Richard Smith 6b53e224eb Split -fsanitize=bounds to -fsanitize=array-bounds (for the frontend-inserted
check using the ubsan runtime) and -fsanitize=local-bounds (for the middle-end
check which inserts traps).

Remove -fsanitize=local-bounds from -fsanitize=undefined. It does not produce
useful diagnostics and has false positives (PR17635), and is not a good
compromise position between UBSan's checks and ASan's checks.

Map -fbounds-checking to -fsanitize=local-bounds to restore Clang's historical
behavior for that flag.

llvm-svn: 193205
2013-10-22 22:51:04 +00:00
Peter Collingbourne 276be3c57c Add support for -fsanitize-blacklist and default blacklists for DFSan.
Also add some documentation.

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

llvm-svn: 188403
2013-08-14 18:54:18 +00:00
Peter Collingbourne c377275a4a DataFlowSanitizer; Clang 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/D966

llvm-svn: 187925
2013-08-07 22:47:34 +00:00
Bill Wendling d8f4950862 Use function attributes to indicate if we don't want to realign the stack.
llvm-svn: 187617
2013-08-01 21:41:02 +00:00
Bill Wendling a9cc8c0385 Replace the "NoFramePointerElimNonLeaf" target option with a function attribute.
llvm-svn: 187092
2013-07-25 00:32:41 +00:00
Bill Wendling 021c8ded04 Use function attributes to pass along the stack protector buffer size instead of making it a target option.
llvm-svn: 186218
2013-07-12 22:26:07 +00:00
Nick Lewycky d3f3e4f04c Make -vectorize-... proper cc1 flags instead of abusing -backend-option. Fixes
usage of clang as a library.

llvm-svn: 184812
2013-06-25 01:49:44 +00:00
Nick Lewycky 92a6c74bbf Fix a leak of TargetMachine in clang. We'll continue to leak it on purpose if
given -disable-free. (Reviewed by John McCall over IRC.)

llvm-svn: 184595
2013-06-21 21:15:32 +00:00
Meador Inge f081d02586 CodeGen: Don't set 'PMBuilder.DisableSimplifyLibCalls'
The simplify-libcalls pass has been removed from LLVM.  Thus
'PMBuilder.DisableSimplifyLibCalls' does not exist anymore.
The disabling/enabling of library call simplifications is
done through the TargetLibraryInfo which is already wired
up in Clang.

llvm-svn: 184458
2013-06-20 19:47:18 +00:00
Eric Christopher 006208cfad Plumb through the -fsplit-stack option using the existing backend
support.

Caveat: Other than the existing segmented stacks support, no
claims are made of this working.

llvm-svn: 178744
2013-04-04 06:29:47 +00:00
Chad Rosier ecafbe6038 If we're unable to create the TargetMachine, then just quit producing the
backend output; there's no need to report a fatal error.  This reverts r178042.
Part of rdar://13295753 and rdar://13401547

llvm-svn: 178102
2013-03-27 00:14:35 +00:00
Chad Rosier a96b3ae724 Fix a crasher by reporting a fatal error if we're unable to create the target
machine and one is required.
Part of rdar://13295753

llvm-svn: 178042
2013-03-26 18:01:48 +00:00
Nick Lewycky 6f15b290b5 The flag "-coverage-function-names-in-data" is actually backwards -- we do
emit function names in .gcda files by default, and the flag turns that off!
Rename the flag to make it match what it actually does. This keeps the default
format compatible with gcc 4.2.

Also add a test for this flag.

llvm-svn: 177475
2013-03-20 02:14:38 +00:00
Nick Lewycky c02bbb61e1 Make clang emit linkage names in debug info for subprograms when coverage info
is enabled. Also add a new -test-coverage cc1 flag which makes testing coverage
possible and add our first clang-side coverage test.

llvm-svn: 177470
2013-03-20 01:38:16 +00:00
Nick Lewycky c8bf8249ce Update GCOVProfiling pass creation for API change in r177002. No functionality change.
llvm-svn: 177004
2013-03-14 05:14:01 +00:00
Nick Lewycky 9164513e4f Fix build with clang, this was supposed to be part of r176617.
llvm-svn: 176619
2013-03-07 08:42:27 +00:00
Nick Lewycky a0076cdbb2 Update clang for LLVM API change. No functionality change.
llvm-svn: 176174
2013-02-27 06:22:58 +00:00
Evgeniy Stepanov 102846714a [msan] Run more optimizations after MemorySanitizer pass.
MSan instrumentation is driven by the original code. We take every
incoming instruction and emit another instruction (or ten) next to
it, operating on the shadow values (but sometimes on the real values,
too). Two programs in one, essentially. There can be any kinds of
redundancies in the second one, so we just run whatever is normally
run at -O2, and then exclude some passes that do not help much with
benchmarks.

llvm-svn: 174049
2013-01-31 09:53:29 +00:00
Michael Gottesman 90cae77322 Since ObjCARC has been refactored into its own library with its own declaration header, we need to include the declaration header alongside Scalar.h in BackendUtil.
llvm-svn: 173648
2013-01-28 01:36:00 +00:00
Alexey Samsonov 29524a9871 Add top-level Clang flag -f(no-)sanitize-address-zero-base-shadow that makes AddressSanitizer use bottom of the address space for the shadow memory. On Linux it can be used with -fPIE/-pie to improve performance.
llvm-svn: 172974
2013-01-20 13:12:12 +00:00
Will Dietz f54319c891 [ubsan] Add support for -fsanitize-blacklist
llvm-svn: 172808
2013-01-18 11:30:38 +00:00
Chandler Carruth ed0f133bc7 Switch to asking the target machine to add any relevant analysis passses
rather than doing it ourselves. This reflects the API changes in r171681.

llvm-svn: 171683
2013-01-07 01:38:01 +00:00
Chandler Carruth ff8cd6e238 Companion patch to r171621 which changed the interface for creating TTI
passes to a create-pass function instead of a direct constructor call.

llvm-svn: 171622
2013-01-05 11:45:12 +00:00
Chandler Carruth ffd5551bc7 Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate to
reflect the migration in r171366.

Re-sort the #include lines to reflect the new paths.

llvm-svn: 171369
2013-01-02 11:45:17 +00:00
Chandler Carruth 44eb4f66f4 Re-sort #include lines using the llvm/utils/sort_includes.py script.
Removes a duplicate #include as well as cleaning up some sort order
regressions since I last ran the script over Clang.

llvm-svn: 171364
2013-01-02 10:28:36 +00:00