Commit Graph

121954 Commits

Author SHA1 Message Date
Sanjay Patel
4d5d1dcf1d typo; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247454 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 19:29:18 +00:00
Akira Hatanaka
8e2b613ef0 Use function attribute "stackrealign" to decide whether stack
realignment should be forced.

With this commit, we can now force stack realignment when doing LTO and
do so on a per-function basis. Also, add a new cl::opt option
"stackrealign" to CommandFlags.h which is used to force stack
realignment via llc's command line.

Out-of-tree projects currently using -force-align-stack to force stack
realignment should make changes to attach the attribute to the functions
in the IR.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247450 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 18:54:38 +00:00
Chris Bieneman
d917fe01ab [CMake] [Darwin] Need to set lto_library on CMAKE_MODULE_LINKER_FLAGS as well
This is a follow-on to r247308.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247443 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 18:39:19 +00:00
David Majnemer
4c53124330 [X86] Make sure startproc/endproc are paired
We used different conditions to determine if we should emit startproc vs
endproc.  Use the same condition to ensure that they will always be
paired.

This fixes PR24374.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247435 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 17:34:34 +00:00
Reid Kleckner
8ae5f645e7 [IR] Print the label operands of a catchpad like an invoke
The rest of the EH pads are fine, since they have at most one label and
take fewer operands for the personality.

Old catchpad vs. new:
  %5 = catchpad [i8* bitcast (i32 ()* @"\01?filt$0@0@main@@" to i8*)] to label %__except.ret.10 unwind label %catchendblock.9
-----
  %5 = catchpad [i8* bitcast (i32 ()* @"\01?filt$0@0@main@@" to i8*)]
          to label %__except.ret.10 unwind label %catchendblock.9

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247433 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 17:27:52 +00:00
Ahmed Bougacha
74869be273 [CodeGen] Refactor TLI/AtomicExpand interface to make LLSC explicit.
We used to have this magic "hasLoadLinkedStoreConditional()" callback,
which really meant two things:
- expand cmpxchg (to ll/sc).
- expand atomic loads using ll/sc (rather than cmpxchg).

Remove it, and, instead, introduce explicit callbacks:
- bool shouldExpandAtomicCmpXchgInIR(inst)
- AtomicExpansionKind shouldExpandAtomicLoadInIR(inst)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247429 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 17:08:28 +00:00
Ahmed Bougacha
f3d2de3832 [CodeGen] Rename AtomicRMWExpansionKind to AtomicExpansionKind.
This lets us generalize its usage to the other atomic instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247428 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 17:08:17 +00:00
NAKAMURA Takumi
dee68c80b9 [PR24785] Appease MSC18 to tweak optimizations.
This brings a warning.

  cl : Command line warning D9035: option 'Og-' has been deprecated and will be removed in a future release

We should resolve PR11951 to remove this tweak.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247427 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 17:08:02 +00:00
Kostya Serebryany
18320e5c91 [libFuzzer] mention more trophies
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247425 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 16:34:14 +00:00
Daniel Sanders
5ab98c2cdf [mips] Add missing disassembler tests for MIPS64-MIPS64R5.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247422 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 16:24:11 +00:00
Daniel Sanders
79f755355c [mips] Add missing MIPS32 - MIPS32R5 disassembler tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247420 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 15:28:19 +00:00
Daniel Sanders
b43119d746 [mips] Attempt to fix llvm-s390x-linux1
It doesn't seem to like the '|&' in the test command.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247418 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 14:57:54 +00:00
Daniel Sanders
8aa6e22f95 [mips] Add missing MIPS-IV disassembler tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247417 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 14:54:58 +00:00
Daniel Sanders
335f5c313b [mips] Add missing MIPS-III disassembler tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247416 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 14:48:46 +00:00
Arnaud A. de Grandmaison
7f81eabc26 Tweak 2 x86 gold tests so they can run on non-x86 platforms
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247415 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 14:45:34 +00:00
Daniel Sanders
5694c5fdb1 [mips] Add missing MIPS-II disassembler tests.
These tests were found by llvm-mc-fuzzer (see http://reviews.llvm.org/D12723)
and were verified by checking the disassembler output is accepted by GAS.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247414 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 14:34:41 +00:00
Yaron Keren
05d48de4fe Add #include llvm-config.h to Locale.cpp which depends on LLVM_ON_WIN32.
Source code was assuming that llvm-config.h would be included somehow but
up to r247253 that added #include "llvm/Support/Compiler.h" to StringRef.h
the config file was not actually included. The inclusion of llvm-config.h
caused a change of behaviour in tools/clang/test/Frontend/source-col-map.c:
previously it would output the original UTF-8 but now it outputs <U+03B1>.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247409 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 13:22:47 +00:00
Daniel Sanders
f9c4a2d3bf Re-commit r247405: [mips] Add missing MIPS-I disassembler tests.
These tests were found by llvm-mc-fuzzer (see http://reviews.llvm.org/D12723)
and verified by checking the disassembler output is accepted by GAS.

The problematic tests from the previous commit have been moved to
valid-xfail.txt for now.

Also, give invalid instructions some coverage. invalid-xfail.txt contains
instructions that should be invalid but successfully disassemble.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247407 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 12:59:03 +00:00
Daniel Sanders
0207031d90 Revert r247405: [mips] Add missing MIPS-I disassembler tests.
A small number of the added tests have operands that change on each round trip.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247406 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 12:42:38 +00:00
Daniel Sanders
2d14cb6f7a [mips] Add missing MIPS-I disassembler tests.
These tests were found by llvm-mc-fuzzer (see http://reviews.llvm.org/D12723)
and verified by checking the disassembler output is accepted by GAS.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247405 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 12:24:06 +00:00
NAKAMURA Takumi
595af7ed85 PPCFrameLowering::emitEpilogue(): Avoid manipulating MBBI on iterator end.
It caused crash in MachineInstr::hasPropertyInBundle() since r247237.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247395 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 08:20:56 +00:00
NAKAMURA Takumi
15125487c5 Fix llvm/test/tools/gold/X86/bad-alias.ll.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247391 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 08:03:17 +00:00
Frederic Riss
5f69f9fb81 [dsymutil] Discard useless location attributes.
When cloning the debug info for a function that hasn't been linked,
strip the DIEs from all location attributes that wouldn't contain any
meaningful information anyway.

This kind of situation can happen when a function got discarded by the
linker, but its debug information is still wanted in the final link
because it was marked as required as some other DIE dependency. The easiest
way to get into that situation is to have using directives. They get
linked unconditionally, but their targets might not always be present.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247386 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 04:17:30 +00:00
Frederic Riss
5571e7771e [dsymutil] Rename some variables NFC.
lldb doesn't like having variables named as an existing type. In order to
ease debugging, rename those variables to avoid that conflict.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247385 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 04:17:25 +00:00
David Blaikie
7f52e5c241 Fix the gold test cases after alias changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247381 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 03:28:37 +00:00
David Blaikie
21f77df7b6 [opaque pointer type] Add textual IR support for explicit type parameter for global aliases
update.py:
import fileinput
import sys
import re

alias_match_prefix = r"(.*(?:=|:|^)\s*(?:external |)(?:(?:private|internal|linkonce|linkonce_odr|weak|weak_odr|common|appending|extern_weak|available_externally) )?(?:default |hidden |protected )?(?:dllimport |dllexport )?(?:unnamed_addr |)(?:thread_local(?:\([a-z]*\))? )?alias"
plain = re.compile(alias_match_prefix + r" (.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|addrspacecast|\[\[[a-zA-Z]|\{\{).*$)")
cast  = re.compile(alias_match_prefix + r") ((?:bitcast|inttoptr|addrspacecast)\s*\(.* to (.*?)(| addrspace\(\d+\) *)\*\)\s*(?:;.*)?$)")
gep   = re.compile(alias_match_prefix + r") ((?:getelementptr)\s*(?:inbounds)?\s*\((?P<type>.*), (?P=type)(?:\s*addrspace\(\d+\)\s*)?\* .*\)\s*(?:;.*)?$)")

def conv(line):
  m = re.match(cast, line)
  if m:
    return m.group(1) + " " + m.group(3) + ", " + m.group(2)
  m = re.match(gep, line)
  if m:
    return m.group(1) + " " + m.group(3) + ", " + m.group(2)
  m = re.match(plain, line)
  if m:
    return m.group(1) + ", " + m.group(2) + m.group(3) + "*" + m.group(4) + "\n"
  return line

for line in sys.stdin:
  sys.stdout.write(conv(line))

apply.sh:
for name in "$@"
do
  python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
  rm -f "$name.tmp"
done

The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247378 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 03:22:04 +00:00
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