Commit Graph

121828 Commits

Author SHA1 Message Date
Richard Smith
a6f58ad82d [modules] Move ConvertUTF.h to a separate submodule that doesn't require C++.
The former setup once resulted in us ignoring the module for C compilations,
but Clang now errors on this if the header is included from C code (which it is).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247377 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 03:14:00 +00:00
Cong Hou
385beeb706 Fixed a bug that BranchProbability is not defined in BlockFrequency.cpp. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247376 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 02:47:30 +00:00
Duncan P. N. Exon Smith
812e1e45de AsmWriter: Avoid O(N^2) processing of metadata
Fix embarrassing bugs I introduced to the `SlotTracker` in or around
r235785.  I had us iterating through every instruction in a function
(and hitting a map in the LLVMContext) for every basic block in the
function.

While there, completely avoid the call to
`SlotTracker::processFunctionMetadata()` from
`SlotTracker::processFunction()` if we've speculatively done this
already in `SlotTracker::processModule()` by checking
`ShouldInitializeAllMetadata` (this wasn't an algorithmic problem, but
it's touching the same line of code).

Fixes PR24699.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247372 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 01:34:59 +00:00
Mehdi Amini
5db3146110 Revert "[InstCombineCalls] Use isKnownNonNullAt() to check nullness of passing arguments at callsite"
This reverts commit r247356.

Breaks test/Transforms/InstCombine/pr8547.ll with:

Wrong types for attribute: byval inalloca nest noalias nocapture nonnull readnone readonly sret dereferenceable(1) dereferenceable_or_null(1)
  %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 nonnull %conv2) #0
LLVM ERROR: Broken function found, compilation aborted!

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247371 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 01:33:48 +00:00
Kostya Serebryany
8a15ef599e [libFuzzer] perform fewer crossover operations compared to plain mutations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247364 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 00:20:58 +00:00
Reid Kleckner
fbf486927f Add .exe check to Execute to fix clang-modernize tests broken in r247358
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247361 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 23:59:45 +00:00
Richard Smith
4f840727e9 [modules] Add another .def file to our list of textual headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247359 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 23:30:27 +00:00
Reid Kleckner
f84a11c301 ScanDirForExecutable on Windows fails to find executables with the "exe" extension in name
When the driver tries to locate a program by its name, e.g. a linker, it
scans the paths provided by the toolchain using the ScanDirForExecutable
function. If the lookup fails, the driver uses
llvm::sys::findProgramByName. Unlike llvm::sys::findProgramByName,
ScanDirForExecutable is not aware of file extensions. If the program has
the "exe" extension in its name, which is very common on Windows,
ScanDirForExecutable won't find it under the toolchain-provided paths.

This patch changes the Windows version of the "`can_execute`" function
called by ScanDirForExecutable to respect file extensions, similarly to
llvm::sys::findProgramByName.

Patch by Oleg Ranevskyy

Reviewers: rnk

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247358 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 23:28:06 +00:00
Cong Hou
e5457136e7 Pass BranchProbability/BlockMass by value instead of const& as they are small. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247357 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 23:10:42 +00:00
Chen Li
337cd218ef [InstCombineCalls] Use isKnownNonNullAt() to check nullness of passing arguments at callsite
Summary: This patch replaces isKnownNonNull() with isKnownNonNullAt() when checking nullness of passing arguments at callsite. In this way it can handle cases where the argument does not have nonnull attribute but has a dominating null check from the CFG.

Reviewers: reames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247356 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 23:04:49 +00:00
Rafael Espindola
0df4288be2 Mark another method const. Sorry for missing this one the first time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247354 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 22:46:38 +00:00
Chen Li
55a7e0fc54 [InstCombineCalls] Use isKnownNonNullAt() to check nullness of gc.relocate return value
Summary: This patch replaces isKnownNonNull() with isKnownNonNullAt() when checking nullness of gc.relocate return value. In this way it can handle cases where the relocated value does not have nonnull attribute but has a dominating null check from the CFG.

Reviewers: reames

Subscribers: llvm-commits, sanjoy

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247353 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 22:35:41 +00:00
Filipe Cabecinhas
4d0f917f94 Remove gcc warning when comparing an unsigned var for >= 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247352 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 22:34:39 +00:00
Reid Kleckner
3f3f976995 [WinEH] Push and pop EBP for 32-bit funclets
The Win32 EH runtime caller does not preserve EBP, even though it does
preserve the CSRs (EBX, ESI, EDI) for us. The result was that each
finally funclet call would leave the frame pointer off by 12 bytes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247348 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 22:00:02 +00:00
Matt Arsenault
d62d9ca7fa AMDGPU: Simplify debug printing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247345 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 21:51:19 +00:00
Matt Arsenault
3a8d465ddd AMDGPU: Use StringRef value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247344 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 21:51:15 +00:00
James Y Knight
395d7b084b [SPARC] Switch to the Machine Scheduler.
The (mostly-deprecated) SelectionDAG-based ILPListDAGScheduler scheduler
was making poor scheduling decisions, causing high register pressure and
extraneous register spills.

Switching to the newer machine scheduler generates better code -- even
without there being a machine model defined for SPARC yet.

(Actually committing the test changes too, this time, unlike r247315)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247343 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 21:49:06 +00:00
Rafael Espindola
5b18c9f4a3 Mark two methods const.
While at it, optimize getOffset a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247342 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 21:48:36 +00:00
Reid Kleckner
76b827089d Fix SEH state numbering algorithm to handle cleanupendpads
WinEHPrepare's new coloring algorithm really expects to see
cleanupendpads now, so Clang will start emitting them soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247341 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 21:46:36 +00:00
Matthew Simpson
19991cc69a [LV] Relax Small Size Reduction Type Requirement
This patch enables small size reductions in which the source types are smaller
than the reduction type (e.g., computing an i16 sum from the values in an i8
array). The previous behavior was to only allow small size reductions if the
source types and reduction type were the same. The change accounts for the fact
that the existing sign- and zero-extend instructions in these cases should
still be included in the cost model.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247337 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 21:12:57 +00:00
Lang Hames
b56b4c0b45 [RuntimeDyld] Support non-zero addends for the MachO X86_64 SUBTRACTOR reloc.
This functionality was accidentally left out of r247119.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247336 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 21:05:58 +00:00
Lang Hames
44decbe37a [RuntimeDyld] Fix a bug in debugging output: all sections should be dumped
before any relocations have been applied, and again after all relocations have
been applied.

Previously each section was dumped before and after relocations targetting it
were applied, but this only shows the impact of relocations that point to other
symbols in the same section.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247335 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 20:44:36 +00:00
Chandler Carruth
c061b2bb6f Add an explicit 'inline' specifier to these static functions. GCC is
warning on them having always_inline attribute for reasons I don't fully
understand -- static functions are just as inlinable as inline
functions in terms of linkage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247334 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 20:34:57 +00:00
Reid Kleckner
3db5c58845 Correct the return type of CreateCleanupEndPad
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247331 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 20:07:25 +00:00
James Y Knight
ec31826840 Revert "[SPARC] Switch to the Machine Scheduler."
This reverts commit r247315.

Accidentally omitted test changes; will resubmit full change shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247328 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 19:42:03 +00:00
David Majnemer
1c018c2ad0 [IR] Conservatively mark 'catchpad' as accessing memory
The exact semantics of 'catchpad' are really in the hands of the
personality routine so we shouldn't assume that they have no side
effects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247322 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 18:50:09 +00:00
Kostya Serebryany
8eaf34eed8 [libFuzzer] refactor the code to allow building libFuzzer on platforms that don't have dfsan and don't support weak functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247321 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 18:48:38 +00:00
Chris Bieneman
24346ed19f [CMake] Add lto subdirectory explicitly.
This is required because ExternalProject_Add requires all targets specified in the DEPENDS argument must exist before calling ExternalProject_Add.

I have a follow-up patch to clang that enables using the just-built libLTO in bootstrap builds, so we need to be able to add the LTO target as a dependency in clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247316 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 18:22:33 +00:00
James Y Knight
ba662b351c [SPARC] Switch to the Machine Scheduler.
The (mostly-deprecated) SelectionDAG-based ILPListDAGScheduler scheduler
was making poor scheduling decisions, causing high register pressure and
extraneous register spills.

Switching to the newer machine scheduler generates better code -- even
without there being a machine model defined for SPARC yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247315 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 18:20:45 +00:00
Matthew Simpson
cc8cfb9875 [SCEV] Consistently Handle Expressions That Cannot Be Divided
This patch addresses the issue of SCEV division asserting on some
input expressions (e.g., non-affine expressions) and quietly giving
up on others.  When giving up, we set the quotient to be equal to
zero and the remainder to be equal to the numerator. With this
patch, we always quietly give up when we cannot perform the
division.

This patch also adds a test case for DependenceAnalysis that
previously caused an assertion.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247314 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 18:12:47 +00:00
JF Bastien
50c9e6310e [MergeFuncs] Fix callsite attributes in thunk generation
This change correctly sets the attributes on the callsites
generated in thunks. This makes sure things such as sret, sext, etc.
are correctly set, so that the call can be a proper tailcall.

Also, the transfer of attributes in the replaceDirectCallers function
appears to be unnecessary, but until this is confirmed it will remain.

Author: jrkoenig
Reviewers: dschuff, jfb
Subscribers: llvm-commits, nlewycky
Differential revision: http://reviews.llvm.org/D12581

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247313 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 18:08:35 +00:00
David Blaikie
6ff608fb18 Tidy up some alias syntax to make explicit pointer type migration easier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247312 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 18:03:45 +00:00
Jordan Rose
1aa8d7ccfb [CMake] s/LLVM_SOURCE_DIR/LLVM_MAIN_SRC_DIR/
Fix-up for r247305 to use the right variable. There's another use of
LLVM_SOURCE_DIR in this file that is probably also questionable, but it's
for Windows so I'm going to leave it alone.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247311 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 17:55:02 +00:00
Philip Reames
5d8f37f825 [SimplifyCFG] Use known bits to eliminate dead switch defaults
This is a follow up to http://reviews.llvm.org/D11995 implementing the suggestion by Hans.

If we know some of the bits of the value being switched on, we know that the maximum number of unique cases covers the unknown bits. This allows to eliminate switch defaults for large integers (i32) when most bits in the value are known.

Note that I had to make the transform contingent on not having any dead cases. This is conservatively correct with the old code, but required for the new code since we might have a dead case which varies one of the known bits. Counting that towards our number of covering cases would be bad.  If we do have dead cases, we'll eliminate them first, then revisit the possibly dead default.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247309 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 17:44:47 +00:00
Chris Bieneman
4b5f4e5618 [CMake] Add DARWIN_LTO_LIBRARY option to allow overriding -lto_library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247308 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 17:28:51 +00:00
Chris Bieneman
a37234f8c4 [CMake] Allow LLVM_TOOLCHAIN_TOOLS to be overridden
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247306 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 17:23:32 +00:00
Jordan Rose
a72d302556 [CMake] Fix Xcode build with LLVM_ENABLE_OBJLIB.
This amends chapuni's r246156 to handle an Xcode quirk, one even called out
in the CMake documentation:

    Some native build systems may not like targets that have only object files,
    so consider adding at least one real source file to any target that
    references $<TARGET_OBJECTS:objlib>.

I've limited the scope of this hack to Xcode for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247305 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 17:18:51 +00:00
Adrian Prantl
40b623b147 Debug Info: Allow a DIModule to appear as the scope of other entities.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247304 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 17:13:58 +00:00
Philip Reames
8b25542f3d [docs][PerformanceTips] Add text on allocas and alignment
This summarizes two recent llvm-dev discussions.  Most of the text provided by David Chisnall and Benoit Belley with minor editting by me.  



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247301 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 17:03:10 +00:00
Kostya Serebryany
a8d8dba0a6 [libFuzzer] add two more variants of FuzzerDriver for convenience
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247300 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 16:57:57 +00:00
Joseph Tremoulet
883735e75a [WinEH] Fix single-block cleanup coloring
Summary:
The coloring code in WinEHPrepare queues cleanuprets' successors with the
correct color (the parent one) when it sees their cleanuppad, and so later
when iterating successors knows to skip processing cleanuprets since
they've already been queued.  This latter check was incorrectly under an
'else' condition and so inadvertently was not kicking in for single-block
cleanups.  This change sinks the check out of the 'else' to fix the bug.

Reviewers: majnemer, andrew.w.kaylor, rnk

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247299 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 16:51:25 +00:00
Hans Wennborg
07a3b97f20 Re-commit r247216: "Fix Clang-tidy misc-use-override warnings, other minor fixes"
Except the changes that defined virtual destructors as =default, because that
ran into problems with GCC 4.7 and overriding methods that weren't noexcept.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247298 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 16:49:58 +00:00
Steven Wu
d4c5df76da Fix an undefined behavior introduces in r247234
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247296 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 16:32:28 +00:00
Sanjay Patel
a77744ddb1 80-cols; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247295 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 16:31:19 +00:00
Sanjay Patel
64714eab15 use range-based for loop; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247294 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 16:25:38 +00:00
Sanjay Patel
2a25359408 use range-based for loop; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247293 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 16:15:21 +00:00
Vedant Kumar
fbb2bed0f2 [Bitcode] Add xfail test for PR24755 (uselistorder)
This test stresses verify-uselistorder. PR24755 is caused by our
ignoring uses when they occur in the function personality slot, the
prologue data slot, or the prefix data slot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247292 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 16:02:24 +00:00
Sanjay Patel
3dc6b39629 fix typo; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247287 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 15:14:34 +00:00
Alex Lorenz
eecbba2d64 Fix PR 24724 - The implicit register verifier shouldn't assume certain operand
order.

The implicit register verifier in the MIR parser should only check if the
instruction's default implicit operands are present in the instruction. It
should not check the order in which they occur.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247283 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 14:04:34 +00:00
Rafael Espindola
7ad3ef048d Cleaning up LLVM IR mode for Emacs.
I've made a range of improvements to the Emacs mode for LLVM IR.

Most importantly, it changes llvm-mode to inherit from prog-mode. This
means llvm-mode will be treated as a normal programming mode in Emacs,
so many Emacs features will just work. prog-mode is new to Emacs 24,
so I've added an alias to ensure compatibility with Emacs 23 too.

I've changed the mode definition to use define-derived-mode. This
saves us needing to set up local variables ourselves, and saves us
needing to define llvm-mode-map, llvm-mode-abbrev-table,
llvm-mode-map.

I've removed the keybindings to tab-to-tab-stop, center-line and
center-paragraph. This shouldn't be llvm-mode's responsibility, and
the code didn't actually work anyway (since `(not llvm-mode-map)`
always evaluated to `t`, the keybindings were never executed).

I've simplified the syntax-table definition, it's equivalent (e.g. `"`
is treated as string delimiter by default in Emacs). I've added `.` as
a symbol constituent, so functions like `llvm.memset.p0i8.i32` are
recognised as a single symbol. I've also changed `%` to be a symbol
constituent, so users can move between words or symbols at their
choice, rather than conflating the two.

I've fixed regexp for types, which incorrect used `symbol` instead of
`symbols` as an argument to `regexp-opt`. This was causing incorrect
highlighting on lines like `call void @foovoid`.

I've removed string and comment highlighting from
`llvm-font-lock-keywords`. This is already handled by the
syntax-table.

Finally, I've removed the reference to jasmin. That project is long
abandoned and the link 404s. For reference, I've found an old copy of
the project here:
https://github.com/stevej/emacs/blob/master/vendor/jasmin/jasmin.el

Patch by Wilfred Hughes!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247281 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 13:44:28 +00:00