platform/upstream/llvm.git
9 years agoRevert "[InstCombineCalls] Use isKnownNonNullAt() to check nullness of passing argume...
Mehdi Amini [Fri, 11 Sep 2015 01:33:48 +0000 (01:33 +0000)]
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>
llvm-svn: 247371

9 years agoAdd a DT_SYMTAB entry in the dynamic section.
Rafael Espindola [Fri, 11 Sep 2015 01:14:39 +0000 (01:14 +0000)]
Add a DT_SYMTAB entry in the dynamic section.

With this a trivial shared binary runs with the glibc dynamic linker:

LD_LIBRARY_PATH=.  /lib64/ld-2.20.so ./t

llvm-svn: 247370

9 years agoModule Debugging: Emit forward declarations for types that are defined in
Adrian Prantl [Fri, 11 Sep 2015 01:03:26 +0000 (01:03 +0000)]
Module Debugging: Emit forward declarations for types that are defined in
clang modules, if -dwarf-ext-refs (DebugTypesExtRefs) is specified.

llvm-svn: 247369

9 years agoCleanup: Let CGDebugInfo::ModuleRefCache use a TrackingMDNode (NFC).
Adrian Prantl [Fri, 11 Sep 2015 01:03:19 +0000 (01:03 +0000)]
Cleanup: Let CGDebugInfo::ModuleRefCache use a TrackingMDNode (NFC).

llvm-svn: 247368

9 years ago[MS ABI] Remove another call to RequireCompleteType
David Majnemer [Fri, 11 Sep 2015 00:53:15 +0000 (00:53 +0000)]
[MS ABI] Remove another call to RequireCompleteType

I cannot come up with a testcase which would rely on this call to
RequireCompleteType, I believe that it is superfluous given the current
state of clang.

llvm-svn: 247367

9 years agoClean up building & linking of Process/elf-core.
Bruce Mitchener [Fri, 11 Sep 2015 00:31:33 +0000 (00:31 +0000)]
Clean up building & linking of Process/elf-core.

Summary:
* cmake/LLDBDependencies.cmake: elf-core is already included
  globally in LLDB_USED_LIBS, so it doesn't need to be re-added
  on individual platforms.

* lib/Makefile: elf-core is linked on each platform, so move it
  to the global list of used libraries.

* source/Plugins/Makefile: elf-core is built on each platform, so
  move it to the global list of things to build.

Reviewers: clayborg, labath

Subscribers: lldb-commits

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

llvm-svn: 247366

9 years agoCreate a dynamic symbol table.
Rafael Espindola [Fri, 11 Sep 2015 00:30:13 +0000 (00:30 +0000)]
Create a dynamic symbol table.

For now it includes every symbol in the regular table. Since we don't
create dynamic relocations yet, we don't have a good way of knowing which
symbols are actually needed.

llvm-svn: 247365

9 years ago[libFuzzer] perform fewer crossover operations compared to plain mutations
Kostya Serebryany [Fri, 11 Sep 2015 00:20:58 +0000 (00:20 +0000)]
[libFuzzer] perform fewer crossover operations compared to plain mutations

llvm-svn: 247364

9 years agoCache the bss output section in the writer, not in the symbol table.
Rafael Espindola [Fri, 11 Sep 2015 00:10:11 +0000 (00:10 +0000)]
Cache the bss output section in the writer, not in the symbol table.

There is soon going to be two symbol tables, but there will still be only one
output bss.

llvm-svn: 247363

9 years ago[Driver] Use UniversalCRT on Windows if available
Reid Kleckner [Fri, 11 Sep 2015 00:09:39 +0000 (00:09 +0000)]
[Driver] Use UniversalCRT on Windows if available

Summary:
With Visual Studio 2015 release, a part of runtime library was extracted
and now comes with Windows Kits. This patch enables clang to use
Universal CRT library if  %INCLUDE or %LIB environment varaibles are not
specified.

See also https://llvm.org/bugs/show_bug.cgi?id=24741

Patch by Igor Kudrin

Reviewers: zturner, hans, rnk

Subscribers: ruiu, cfe-commits

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

llvm-svn: 247362

9 years agoAdd .exe check to Execute to fix clang-modernize tests broken in r247358
Reid Kleckner [Thu, 10 Sep 2015 23:59:45 +0000 (23:59 +0000)]
Add .exe check to Execute to fix clang-modernize tests broken in r247358

llvm-svn: 247361

9 years agoDocs: Add missing new line before a list.
Michael Zolotukhin [Thu, 10 Sep 2015 23:56:10 +0000 (23:56 +0000)]
Docs: Add missing new line before a list.

llvm-svn: 247360

9 years ago[modules] Add another .def file to our list of textual headers.
Richard Smith [Thu, 10 Sep 2015 23:30:27 +0000 (23:30 +0000)]
[modules] Add another .def file to our list of textual headers.

llvm-svn: 247359

9 years agoScanDirForExecutable on Windows fails to find executables with the "exe" extension...
Reid Kleckner [Thu, 10 Sep 2015 23:28:06 +0000 (23:28 +0000)]
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

llvm-svn: 247358

9 years agoPass BranchProbability/BlockMass by value instead of const& as they are small. NFC.
Cong Hou [Thu, 10 Sep 2015 23:10:42 +0000 (23:10 +0000)]
Pass BranchProbability/BlockMass by value instead of const& as they are small. NFC.

llvm-svn: 247357

9 years ago[InstCombineCalls] Use isKnownNonNullAt() to check nullness of passing arguments...
Chen Li [Thu, 10 Sep 2015 23:04:49 +0000 (23:04 +0000)]
[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

llvm-svn: 247356

9 years agoMake a few details of the string and symbol table private.
Rafael Espindola [Thu, 10 Sep 2015 22:49:06 +0000 (22:49 +0000)]
Make a few details of the string and symbol table private.

This is in preparation to adding a dynamic string table.

llvm-svn: 247355

9 years agoMark another method const. Sorry for missing this one the first time.
Rafael Espindola [Thu, 10 Sep 2015 22:46:38 +0000 (22:46 +0000)]
Mark another method const. Sorry for missing this one the first time.

llvm-svn: 247354

9 years ago[InstCombineCalls] Use isKnownNonNullAt() to check nullness of gc.relocate return...
Chen Li [Thu, 10 Sep 2015 22:35:41 +0000 (22:35 +0000)]
[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

llvm-svn: 247353

9 years agoRemove gcc warning when comparing an unsigned var for >= 0
Filipe Cabecinhas [Thu, 10 Sep 2015 22:34:39 +0000 (22:34 +0000)]
Remove gcc warning when comparing an unsigned var for >= 0

llvm-svn: 247352

9 years agoHandle '-r' option properly
Reid Kleckner [Thu, 10 Sep 2015 22:31:45 +0000 (22:31 +0000)]
Handle '-r' option properly

Summary:
This fixs the bug
https://llvm.org/bugs/show_bug.cgi?id=12587

Patch by Yunlian Jiang

Reviewers: Bigcheese, rnk

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

llvm-svn: 247351

9 years agoSupport noreturn in limited contexts on Objective-C message sends.
John McCall [Thu, 10 Sep 2015 22:27:50 +0000 (22:27 +0000)]
Support noreturn in limited contexts on Objective-C message sends.

rdar://6198039

llvm-svn: 247350

9 years ago[SEH] Use cleanupendpad so that WinEHPrepare gets the coloring right
Reid Kleckner [Thu, 10 Sep 2015 22:11:13 +0000 (22:11 +0000)]
[SEH] Use cleanupendpad so that WinEHPrepare gets the coloring right

Cleanupendpad is a lot like catchendpad, so we can reuse the same
EHScopeStack type.

llvm-svn: 247349

9 years ago[WinEH] Push and pop EBP for 32-bit funclets
Reid Kleckner [Thu, 10 Sep 2015 22:00:02 +0000 (22:00 +0000)]
[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.

llvm-svn: 247348

9 years agoUnbreak building on FreeBSD.
Roman Divacky [Thu, 10 Sep 2015 21:56:16 +0000 (21:56 +0000)]
Unbreak building on FreeBSD.

llvm-svn: 247347

9 years ago[MS ABI] Make member pointers return true for isIncompleteType
David Majnemer [Thu, 10 Sep 2015 21:52:00 +0000 (21:52 +0000)]
[MS ABI] Make member pointers return true for isIncompleteType

The type of a member pointer is incomplete if it has no inheritance
model.  This lets us reuse more general logic already embedded in clang.

llvm-svn: 247346

9 years agoAMDGPU: Simplify debug printing
Matt Arsenault [Thu, 10 Sep 2015 21:51:19 +0000 (21:51 +0000)]
AMDGPU: Simplify debug printing

llvm-svn: 247345

9 years agoAMDGPU: Use StringRef value
Matt Arsenault [Thu, 10 Sep 2015 21:51:15 +0000 (21:51 +0000)]
AMDGPU: Use StringRef value

llvm-svn: 247344

9 years ago[SPARC] Switch to the Machine Scheduler.
James Y Knight [Thu, 10 Sep 2015 21:49:06 +0000 (21:49 +0000)]
[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)

llvm-svn: 247343

9 years agoMark two methods const.
Rafael Espindola [Thu, 10 Sep 2015 21:48:36 +0000 (21:48 +0000)]
Mark two methods const.

While at it, optimize getOffset a bit.

llvm-svn: 247342

9 years agoFix SEH state numbering algorithm to handle cleanupendpads
Reid Kleckner [Thu, 10 Sep 2015 21:46:36 +0000 (21:46 +0000)]
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.

llvm-svn: 247341

9 years ago[OMPT] Fix assertion that arises when waiting for proxy tasks on runtime shutdown
Jonathan Peyton [Thu, 10 Sep 2015 21:33:50 +0000 (21:33 +0000)]
[OMPT] Fix assertion that arises when waiting for proxy tasks on runtime shutdown

This only triggered when built in debug mode with OMPT enabled:
__kmp_wait_template expected the state of the current thread to be either
ompt_state_idle or ompt_state_wait_barrier{,_implicit,_explicit}.

Patch by Jonas Hahnfeld

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

llvm-svn: 247339

9 years agoXFAIL tests that require an additional LLVM patch to work
Tobias Grosser [Thu, 10 Sep 2015 21:32:29 +0000 (21:32 +0000)]
XFAIL tests that require an additional LLVM patch to work

llvm-svn: 247338

9 years ago[LV] Relax Small Size Reduction Type Requirement
Matthew Simpson [Thu, 10 Sep 2015 21:12:57 +0000 (21:12 +0000)]
[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

llvm-svn: 247337

9 years ago[RuntimeDyld] Support non-zero addends for the MachO X86_64 SUBTRACTOR reloc.
Lang Hames [Thu, 10 Sep 2015 21:05:58 +0000 (21:05 +0000)]
[RuntimeDyld] Support non-zero addends for the MachO X86_64 SUBTRACTOR reloc.

This functionality was accidentally left out of r247119.

llvm-svn: 247336

9 years ago[RuntimeDyld] Fix a bug in debugging output: all sections should be dumped
Lang Hames [Thu, 10 Sep 2015 20:44:36 +0000 (20:44 +0000)]
[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.

llvm-svn: 247335

9 years agoAdd an explicit 'inline' specifier to these static functions. GCC is
Chandler Carruth [Thu, 10 Sep 2015 20:34:57 +0000 (20:34 +0000)]
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.

llvm-svn: 247334

9 years agoFix depth field bug and resize() function in hierarchical barrier
Jonathan Peyton [Thu, 10 Sep 2015 20:34:32 +0000 (20:34 +0000)]
Fix depth field bug and resize() function in hierarchical barrier

This is a follow up to the hierarchy cleanup patch.
Added some clarifying comments to hierarchy_info.
Fixed a bug with the depth field not being updated cleanly during a resize.
Fixed resize to first check capacity as determined by maxLevels before actually doing the full resize.

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

llvm-svn: 247333

9 years agoRevert "Generating assumption loads of vptr after ctor call (fixed)"
Piotr Padlewski [Thu, 10 Sep 2015 20:18:30 +0000 (20:18 +0000)]
Revert "Generating assumption loads of vptr after ctor call (fixed)"

It seems that there is small bug, and we can't generate assume loads
when some virtual functions have internal visibiliy
This reverts commit 982bb7d966947812d216489b3c519c9825cacbf2.

llvm-svn: 247332

9 years agoCorrect the return type of CreateCleanupEndPad
Reid Kleckner [Thu, 10 Sep 2015 20:07:25 +0000 (20:07 +0000)]
Correct the return type of CreateCleanupEndPad

llvm-svn: 247331

9 years agoFix a warning when building with gcc.
Rafael Espindola [Thu, 10 Sep 2015 20:02:22 +0000 (20:02 +0000)]
Fix a warning when building with gcc.

It was

/Writer.cpp:119:45: warning: enumeral and non-enumeral type in conditional expression

llvm-svn: 247330

9 years agoA little more cleanup in the build script that creates a list of archive directories...
Greg Clayton [Thu, 10 Sep 2015 19:46:25 +0000 (19:46 +0000)]
A little more cleanup in the build script that creates a list of archive directories to make things more clear.

llvm-svn: 247329

9 years agoRevert "[SPARC] Switch to the Machine Scheduler."
James Y Knight [Thu, 10 Sep 2015 19:42:03 +0000 (19:42 +0000)]
Revert "[SPARC] Switch to the Machine Scheduler."

This reverts commit r247315.

Accidentally omitted test changes; will resubmit full change shortly.

llvm-svn: 247328

9 years agoMove sel-address.mm from test/CodeGenCXX to test/SemaObjCXX, it's not a codegen test.
Nico Weber [Thu, 10 Sep 2015 19:35:31 +0000 (19:35 +0000)]
Move sel-address.mm from test/CodeGenCXX to test/SemaObjCXX, it's not a codegen test.

llvm-svn: 247327

9 years agoCleanup of affinity hierarchy code.
Jonathan Peyton [Thu, 10 Sep 2015 19:22:07 +0000 (19:22 +0000)]
Cleanup of affinity hierarchy code.

Some of this is improvement to code suggested by Hal Finkel. Four changes here:
1.Cleanup of hierarchy code to handle all hierarchy cases whether affinity is available or not
2.Separated this and other classes and common functions out to a header file
3.Added a destructor-like fini function for the hierarchy (and call in __kmp_cleanup)
4.Remove some redundant code that is hopefully no longer needed

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

llvm-svn: 247326

9 years agoCFI: Run the tests only on supported architectures/OSs.
Peter Collingbourne [Thu, 10 Sep 2015 19:18:08 +0000 (19:18 +0000)]
CFI: Run the tests only on supported architectures/OSs.

Specifically, only run the cfi-icall tests on x86/x86_64, and add
an XFAIL for darwin.

llvm-svn: 247325

9 years agoDriver: Support cfi-icall on all OSs when targeting x86/x86_64.
Peter Collingbourne [Thu, 10 Sep 2015 19:18:05 +0000 (19:18 +0000)]
Driver: Support cfi-icall on all OSs when targeting x86/x86_64.

llvm-svn: 247324

9 years agoFix Clang-tidy misc-use-override warnings, other minor fixes.
Rui Ueyama [Thu, 10 Sep 2015 18:51:36 +0000 (18:51 +0000)]
Fix Clang-tidy misc-use-override warnings, other minor fixes.

Patch from Eugene Zelenko!

llvm-svn: 247323

9 years ago[IR] Conservatively mark 'catchpad' as accessing memory
David Majnemer [Thu, 10 Sep 2015 18:50:09 +0000 (18:50 +0000)]
[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.

llvm-svn: 247322

9 years ago[libFuzzer] refactor the code to allow building libFuzzer on platforms that don't...
Kostya Serebryany [Thu, 10 Sep 2015 18:48:38 +0000 (18:48 +0000)]
[libFuzzer] refactor the code to allow building libFuzzer on platforms that don't have dfsan and don't support weak functions

llvm-svn: 247321

9 years agoFix hanging barriers if number of parallel regions exceeds UINT_MAX
Jonathan Peyton [Thu, 10 Sep 2015 18:44:30 +0000 (18:44 +0000)]
Fix hanging barriers if number of parallel regions exceeds UINT_MAX

The fix is to make b_arrived flag 64 bit in both structures - kmp_balign_team_t
and kmp_balign_t. Otherwise when flag in kmp_balign_team_t wrapped over
UINT_MAX the library hangs.

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

llvm-svn: 247320

9 years agoAdd a getDeclContextDescriptor() helper function to CGDebugInfo. (NFC)
Adrian Prantl [Thu, 10 Sep 2015 18:39:45 +0000 (18:39 +0000)]
Add a getDeclContextDescriptor() helper function to CGDebugInfo. (NFC)

llvm-svn: 247319

9 years ago[SEH] Use catchret in the new EH IR like we do for C++
Reid Kleckner [Thu, 10 Sep 2015 18:39:41 +0000 (18:39 +0000)]
[SEH] Use catchret in the new EH IR like we do for C++

Also add tests for SEH with the new IRGen.

llvm-svn: 247318

9 years ago[CUDA] Postprocess bitcode linked in during device-side CUDA compilation.
Artem Belevich [Thu, 10 Sep 2015 18:24:23 +0000 (18:24 +0000)]
[CUDA] Postprocess bitcode linked in during device-side CUDA compilation.

Link in and internalize the symbols we need from supplied bitcode library.

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

llvm-svn: 247317

9 years ago[CMake] Add lto subdirectory explicitly.
Chris Bieneman [Thu, 10 Sep 2015 18:22:33 +0000 (18:22 +0000)]
[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.

llvm-svn: 247316

9 years ago[SPARC] Switch to the Machine Scheduler.
James Y Knight [Thu, 10 Sep 2015 18:20:45 +0000 (18:20 +0000)]
[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.

llvm-svn: 247315

9 years ago[SCEV] Consistently Handle Expressions That Cannot Be Divided
Matthew Simpson [Thu, 10 Sep 2015 18:12:47 +0000 (18:12 +0000)]
[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

llvm-svn: 247314

9 years ago[MergeFuncs] Fix callsite attributes in thunk generation
JF Bastien [Thu, 10 Sep 2015 18:08:35 +0000 (18:08 +0000)]
[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

llvm-svn: 247313

9 years agoTidy up some alias syntax to make explicit pointer type migration easier
David Blaikie [Thu, 10 Sep 2015 18:03:45 +0000 (18:03 +0000)]
Tidy up some alias syntax to make explicit pointer type migration easier

llvm-svn: 247312

9 years ago[CMake] s/LLVM_SOURCE_DIR/LLVM_MAIN_SRC_DIR/
Jordan Rose [Thu, 10 Sep 2015 17:55:02 +0000 (17:55 +0000)]
[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.

llvm-svn: 247311

9 years agoRuntime error check elimination
Johannes Doerfert [Thu, 10 Sep 2015 17:51:27 +0000 (17:51 +0000)]
Runtime error check elimination

  Hoist runtime checks in the loop nest if they guard an "error" like event.
  Such events are recognized as blocks with an unreachable terminator or a call
  to the ubsan function that deals with out of bound accesses. Other "error"
  events can be added easily.

  We will ignore these blocks when we detect/model/optmize and code generate SCoPs
  but we will make sure that they would not have been executed using the assumption
  framework.

llvm-svn: 247310

9 years ago[SimplifyCFG] Use known bits to eliminate dead switch defaults
Philip Reames [Thu, 10 Sep 2015 17:44:47 +0000 (17:44 +0000)]
[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

llvm-svn: 247309

9 years ago[CMake] Add DARWIN_LTO_LIBRARY option to allow overriding -lto_library.
Chris Bieneman [Thu, 10 Sep 2015 17:28:51 +0000 (17:28 +0000)]
[CMake] Add DARWIN_LTO_LIBRARY option to allow overriding -lto_library.

llvm-svn: 247308

9 years ago[CUDA] Allow trivial constructors as initializer for __shared__ variables.
Artem Belevich [Thu, 10 Sep 2015 17:26:58 +0000 (17:26 +0000)]
[CUDA] Allow trivial constructors as initializer for __shared__ variables.

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

llvm-svn: 247307

9 years ago[CMake] Allow LLVM_TOOLCHAIN_TOOLS to be overridden
Chris Bieneman [Thu, 10 Sep 2015 17:23:32 +0000 (17:23 +0000)]
[CMake] Allow LLVM_TOOLCHAIN_TOOLS to be overridden

llvm-svn: 247306

9 years ago[CMake] Fix Xcode build with LLVM_ENABLE_OBJLIB.
Jordan Rose [Thu, 10 Sep 2015 17:18:51 +0000 (17:18 +0000)]
[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.

llvm-svn: 247305

9 years agoDebug Info: Allow a DIModule to appear as the scope of other entities.
Adrian Prantl [Thu, 10 Sep 2015 17:13:58 +0000 (17:13 +0000)]
Debug Info: Allow a DIModule to appear as the scope of other entities.

llvm-svn: 247304

9 years agoDebug Info: Remove an unnecessary debug type visitor.
Adrian Prantl [Thu, 10 Sep 2015 17:13:31 +0000 (17:13 +0000)]
Debug Info: Remove an unnecessary debug type visitor.
Thanks to dblaikie for spotting this.

llvm-svn: 247303

9 years agoRe-commit r247218: "Fix Clang-tidy misc-use-override warnings, other minor fixes"
Hans Wennborg [Thu, 10 Sep 2015 17:07:54 +0000 (17:07 +0000)]
Re-commit r247218: "Fix Clang-tidy misc-use-override warnings, other minor fixes"

This never broke the build; it was the LLVM side, r247216, that caused problems.

llvm-svn: 247302

9 years ago[docs][PerformanceTips] Add text on allocas and alignment
Philip Reames [Thu, 10 Sep 2015 17:03:10 +0000 (17:03 +0000)]
[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.

llvm-svn: 247301

9 years ago[libFuzzer] add two more variants of FuzzerDriver for convenience
Kostya Serebryany [Thu, 10 Sep 2015 16:57:57 +0000 (16:57 +0000)]
[libFuzzer] add two more variants of FuzzerDriver for convenience

llvm-svn: 247300

9 years ago[WinEH] Fix single-block cleanup coloring
Joseph Tremoulet [Thu, 10 Sep 2015 16:51:25 +0000 (16:51 +0000)]
[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

llvm-svn: 247299

9 years agoRe-commit r247216: "Fix Clang-tidy misc-use-override warnings, other minor fixes"
Hans Wennborg [Thu, 10 Sep 2015 16:49:58 +0000 (16:49 +0000)]
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.

llvm-svn: 247298

9 years ago[clang-tidy] Add misc-sizeof-container check to find sizeof() uses on stl
Alexander Kornienko [Thu, 10 Sep 2015 16:37:46 +0000 (16:37 +0000)]
[clang-tidy] Add misc-sizeof-container check to find sizeof() uses on stl
containers.

Summary:
sizeof(some_std_string) is likely to be an error. This check finds this
pattern and suggests using .size() instead.

Reviewers: djasper, klimek, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 247297

9 years agoFix an undefined behavior introduces in r247234
Steven Wu [Thu, 10 Sep 2015 16:32:28 +0000 (16:32 +0000)]
Fix an undefined behavior introduces in r247234

llvm-svn: 247296

9 years ago80-cols; NFC
Sanjay Patel [Thu, 10 Sep 2015 16:31:19 +0000 (16:31 +0000)]
80-cols; NFC

llvm-svn: 247295

9 years agouse range-based for loop; NFCI
Sanjay Patel [Thu, 10 Sep 2015 16:25:38 +0000 (16:25 +0000)]
use range-based for loop; NFCI

llvm-svn: 247294

9 years agouse range-based for loop; NFCI
Sanjay Patel [Thu, 10 Sep 2015 16:15:21 +0000 (16:15 +0000)]
use range-based for loop; NFCI

llvm-svn: 247293

9 years ago[Bitcode] Add xfail test for PR24755 (uselistorder)
Vedant Kumar [Thu, 10 Sep 2015 16:02:24 +0000 (16:02 +0000)]
[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.

llvm-svn: 247292

9 years ago[FIX] Do not assume only one loop can be left at a time
Johannes Doerfert [Thu, 10 Sep 2015 15:53:59 +0000 (15:53 +0000)]
[FIX] Do not assume only one loop can be left at a time

llvm-svn: 247291

9 years agoCreate a PT_LOAD program header for the start of the file.
Rafael Espindola [Thu, 10 Sep 2015 15:41:34 +0000 (15:41 +0000)]
Create a PT_LOAD program header for the start of the file.

With this a trivial dynamic program works with the musl dynamic linker:

LD_LIBRARY_PATH=.  ~/musl/lib/libc.so ./t

llvm-svn: 247290

9 years agoAllow general loops with one latch
Johannes Doerfert [Thu, 10 Sep 2015 15:27:46 +0000 (15:27 +0000)]
Allow general loops with one latch

  As we do not rely on ScalarEvolution any more we do not need to get
  the backedge taken count. Additionally, our domain generation handles
  everything that is affine and has one latch and our ScopDetection will
  over-approximate everything else.

  This change will therefor allow loops with:
    - one latch
    - exiting conditions that are affine

  Additionally, it will not check for structured control flow anymore.
  Hence, loops and conditionals are not necessarily single entry single
  exit regions any more.

Differential Version: http://reviews.llvm.org/D12758

llvm-svn: 247289

9 years agoMerge TempScopInfo into ScopInfo
Michael Kruse [Thu, 10 Sep 2015 15:25:24 +0000 (15:25 +0000)]
Merge TempScopInfo into ScopInfo

The TempScopInfo (-polly-analyze-ir) pass is removed and its work taken
over by ScopInfo (-polly-scops). Several tests depend on
-polly-analyze-ir and use -polly-scops instead which for the moment
prints the output of both passes. This again is not expected by some
other tests, especially those with negative searches, which have been
adapted.

Differential Version: http://reviews.llvm.org/D12694

llvm-svn: 247288

9 years agofix typo; NFC
Sanjay Patel [Thu, 10 Sep 2015 15:14:34 +0000 (15:14 +0000)]
fix typo; NFC

llvm-svn: 247287

9 years agoProperly close documentation /code blocks with /endcode.
Aaron Ballman [Thu, 10 Sep 2015 15:13:22 +0000 (15:13 +0000)]
Properly close documentation /code blocks with /endcode.

llvm-svn: 247286

9 years agoClean-up unit tests
Michael Kruse [Thu, 10 Sep 2015 14:42:09 +0000 (14:42 +0000)]
Clean-up unit tests

Remove redundant flags and duplicate invocations of the same test.

llvm-svn: 247285

9 years agoBuild Plugin/JITLoader/GDB on all platforms.
Bruce Mitchener [Thu, 10 Sep 2015 14:28:49 +0000 (14:28 +0000)]
Build Plugin/JITLoader/GDB on all platforms.

Summary:
We currently link to this on all platforms, so don't need to re-include
it into the LLDB_USED_LIBS. Also don't need to special case building
it for every supported platform.

Reviewers: clayborg, labath

Subscribers: lldb-commits

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

llvm-svn: 247284

9 years agoFix PR 24724 - The implicit register verifier shouldn't assume certain operand
Alex Lorenz [Thu, 10 Sep 2015 14:04:34 +0000 (14:04 +0000)]
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.

llvm-svn: 247283

9 years ago[clang-tidy] add_new_check.py improvements: add doc file, refer it from .h
Alexander Kornienko [Thu, 10 Sep 2015 13:56:39 +0000 (13:56 +0000)]
[clang-tidy] add_new_check.py improvements: add doc file, refer it from .h

+ some console logging and minor cleanups.

llvm-svn: 247282

9 years agoCleaning up LLVM IR mode for Emacs.
Rafael Espindola [Thu, 10 Sep 2015 13:44:28 +0000 (13:44 +0000)]
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!

llvm-svn: 247281

9 years ago[NFC] Remove obsolete arguments
Johannes Doerfert [Thu, 10 Sep 2015 13:12:02 +0000 (13:12 +0000)]
[NFC] Remove obsolete arguments

  Remove some arguments that survived the recent changes but are not
  used any more.

llvm-svn: 247280

9 years agoReplace ScalarEvolution based domain generation
Johannes Doerfert [Thu, 10 Sep 2015 13:00:06 +0000 (13:00 +0000)]
Replace ScalarEvolution based domain generation

This patch replaces the last legacy part of the domain generation, namely the
ScalarEvolution part that was used to obtain loop bounds. We now iterate over
the loops in the region and propagate the back edge condition to the header
blocks. Afterwards we propagate the new information once through the whole
region. In this process we simply ignore unbounded parts of the domain and
thereby assume the absence of infinite loops.

  + This patch already identified a couple of broken unit tests we had for
    years.
  + We allow more loops already and the step to multiple exit and multiple back
    edges is minimal.
  + It allows to model the overflow checks properly as we actually visit
    every block in the SCoP and know where which condition is evaluated.
  - It is currently not compatible with modulo constraints in the
    domain.

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

llvm-svn: 247279

9 years agoDisable support for modulo expressions
Johannes Doerfert [Thu, 10 Sep 2015 12:56:46 +0000 (12:56 +0000)]
Disable support for modulo expressions

  The support for modulo expressions is not comlete and makes the new
  domain generation harder. As the currently broken domain generation
  needs to be replaced, we will first swap in the new, fixed domain
  generation and make it compatible with the modulo expressions later.

llvm-svn: 247278

9 years agoAVX-512: Changed nidx parameter in extractf64/32 intrinsic from i8 to i32 according...
Igor Breger [Thu, 10 Sep 2015 12:55:54 +0000 (12:55 +0000)]
AVX-512: Changed nidx parameter in extractf64/32 intrinsic from i8 to i32 according to the Intel Spec

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

llvm-svn: 247277

9 years agoAVX512: Implemented encoding and intrinsics for
Igor Breger [Thu, 10 Sep 2015 12:54:54 +0000 (12:54 +0000)]
AVX512: Implemented encoding and intrinsics for
  vextracti64x4 ,vextracti64x2, vextracti32x8, vextracti32x4, vextractf64x4, vextractf64x2, vextractf32x8, vextractf32x4
Added tests for intrinsics and encoding.

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

llvm-svn: 247276

9 years agoSilencing C4141 warnings that were introduced en masse because __forceinline cannot...
Aaron Ballman [Thu, 10 Sep 2015 12:53:40 +0000 (12:53 +0000)]
Silencing C4141 warnings that were introduced en masse because __forceinline cannot be combined with inline in MSVC without triggering this diagnostic. This is safe to disable because clang will catch instances of the issue with -Wduplicate-decl-specifier, so we are not losing diagnostic coverage.

llvm-svn: 247275

9 years agoMerge TempScopInfo.{cpp|h} into ScopInfo.{cpp|h}
Michael Kruse [Thu, 10 Sep 2015 12:46:52 +0000 (12:46 +0000)]
Merge TempScopInfo.{cpp|h} into ScopInfo.{cpp|h}

This prepares for a series of patches that merges TempScopInfo into ScopInfo to
reduce Polly's code complexity. Only ScopInfo.{cpp|h} will be left thereafter.
Moving the code of TempScopInfo in one commit makes the mains diffs simpler to
understand.

In detail, merging the following classes is planned:
TempScopInfo into ScopInfo
TempScop into Scop
IRAccess into MemoryAccess

Only moving code, no functional changes intended.

Differential Version: http://reviews.llvm.org/D12693

llvm-svn: 247274

9 years ago[OPENMP] Generate threadprivates as TLS variables by default.
Alexey Bataev [Thu, 10 Sep 2015 12:06:58 +0000 (12:06 +0000)]
[OPENMP] Generate threadprivates as TLS variables by default.
If target supports TLS all threadprivates are generated as TLS. If target does not support TLS, use runtime calls for proper codegen of threadprivate variables.

llvm-svn: 247273

9 years ago[FileCheck] Use range-based for loops. NFC.
Benjamin Kramer [Thu, 10 Sep 2015 11:59:55 +0000 (11:59 +0000)]
[FileCheck] Use range-based for loops. NFC.

llvm-svn: 247272

9 years agoThere is a trunc(lshr (zext A), Cst) optimization in InstCombineCasts that
Jakub Kuderski [Thu, 10 Sep 2015 11:31:20 +0000 (11:31 +0000)]
There is a trunc(lshr (zext A), Cst) optimization in InstCombineCasts that
removes cast by performing the lshr on smaller types. However, currently there
is no trunc(lshr (sext A), Cst) variant.
This patch add such optimization by transforming trunc(lshr (sext A), Cst)
to ashr A, Cst.

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

llvm-svn: 247271