platform/upstream/llvm.git
7 years ago[WebAssembly] Disable folding of GA+reg into load/store constant offsets
Derek Schuff [Wed, 31 Aug 2016 20:27:20 +0000 (20:27 +0000)]
[WebAssembly] Disable folding of GA+reg into load/store constant offsets

Summary:
If the register has a negative value then unsigned overflow will occur;
this case is sometimes even created intentionally by LSR. For now
disable GA+reg folding. Fixes PR29127

Differential Revision: https://reviews.llvm.org/D24053

llvm-svn: 280285

7 years agoLinker script: support VERSION command.
Rui Ueyama [Wed, 31 Aug 2016 20:03:54 +0000 (20:03 +0000)]
Linker script: support VERSION command.

Summary:
VERSION commands define symbol versions. The grammar of the
commnad is as follows

  VERSION { version-script-commands }

where version-script-commands is

  [ name ] { version-definitions }.

Note that we already support version-script-commands because
it is being used for version script command.

This patch is based on George's patch https://reviews.llvm.org/D23609

Reviewers: grimar

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D24089

llvm-svn: 280284

7 years agoRemove unused variables.
Zachary Turner [Wed, 31 Aug 2016 20:03:14 +0000 (20:03 +0000)]
Remove unused variables.

Patch by Taras Tsugrii

llvm-svn: 280283

7 years ago[InstCombine] change insertRangeTest() to use APInt instead of Constant; NFCI
Sanjay Patel [Wed, 31 Aug 2016 19:49:56 +0000 (19:49 +0000)]
[InstCombine] change insertRangeTest() to use APInt instead of Constant; NFCI

This is prep work before changing the callers to also use APInt which will
allow folds for splat vectors. Currently, the callers have ConstantInt
guards in place, so no functional change intended with this commit.

llvm-svn: 280282

7 years agoRevert "Driver: use the canonical static library naming"
Saleem Abdulrasool [Wed, 31 Aug 2016 19:27:07 +0000 (19:27 +0000)]
Revert "Driver: use the canonical static library naming"

This breaks chromium and its unclear if this is actually a modern convention.

This reverts SVN r280169.

llvm-svn: 280281

7 years ago[LoopInfo] Add verification by recomputation.
Michael Zolotukhin [Wed, 31 Aug 2016 19:26:19 +0000 (19:26 +0000)]
[LoopInfo] Add verification by recomputation.

Summary:
Current implementation of LI verifier isn't ideal and fails to detect
some cases when LI is incorrect. For instance, it checks that all
recorded loops are in a correct form, but it has no way to check if
there are no more other (unrecorded in LI) loops in the function. This
patch adds a way to detect such bugs.

Reviewers: chandlerc, sanjoy, hfinkel

Subscribers: llvm-commits, silvas, mzolotukhin

Differential Revision: https://reviews.llvm.org/D23437

llvm-svn: 280280

7 years ago[EarlyCSE] Optionally use MemorySSA. NFC.
Geoff Berry [Wed, 31 Aug 2016 19:24:10 +0000 (19:24 +0000)]
[EarlyCSE] Optionally use MemorySSA. NFC.

Summary:
Use MemorySSA, if requested, to do less conservative memory dependency
checking.

This change doesn't enable the MemorySSA enhanced EarlyCSE in the
default pipelines, so should be NFC.

Reviewers: dberlin, sanjoy, reames, majnemer

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 280279

7 years agoExclude examples, unittests from doc gen
Jason Henline [Wed, 31 Aug 2016 19:02:47 +0000 (19:02 +0000)]
Exclude examples, unittests from doc gen

Public documentation shouldn't be generated for unit test code and code
that is only meant to be used as snippets in other documentation.

llvm-svn: 280278

7 years ago[StreamExecutor] Add Doxygen main page
Jason Henline [Wed, 31 Aug 2016 19:02:44 +0000 (19:02 +0000)]
[StreamExecutor] Add Doxygen main page

Reviewers: jlebar

Subscribers: jprice, parallel_libs-commits

Differential Revision: https://reviews.llvm.org/D24066

llvm-svn: 280277

7 years agoActually check for the diagnostic to be emitted!
Quentin Colombet [Wed, 31 Aug 2016 18:53:32 +0000 (18:53 +0000)]
Actually check for the diagnostic to be emitted!

This makes the test case in r280273 actually useful!

llvm-svn: 280276

7 years ago[Hexagon] Deal with undefs when extending live intervals
Krzysztof Parzyszek [Wed, 31 Aug 2016 18:52:09 +0000 (18:52 +0000)]
[Hexagon] Deal with undefs when extending live intervals

llvm-svn: 280275

7 years agoAMDGPU/SI: Make sure llvm.amdgcn.implicitarg.ptr() is at least 4-byte aligned
Tom Stellard [Wed, 31 Aug 2016 18:46:07 +0000 (18:46 +0000)]
AMDGPU/SI: Make sure llvm.amdgcn.implicitarg.ptr() is at least 4-byte aligned

Summary: This fixes some OpenCV tests that were broken by libclc commit r276443.

Reviewers: arsenm, jvesely

Subscribers: arsenm, wdng, llvm-commits

Differential Revision: https://reviews.llvm.org/D24051

llvm-svn: 280274

7 years ago[TargetPassConfig] Add a hook to tell whether GlobalISel should warm on fallback.
Quentin Colombet [Wed, 31 Aug 2016 18:43:04 +0000 (18:43 +0000)]
[TargetPassConfig] Add a hook to tell whether GlobalISel should warm on fallback.

Thanks to this patch, we know have a way to easly see if GlobalISel
failed.

llvm-svn: 280273

7 years ago[ResetMachineFunction] Emit the diagnostic isel fallback when asked.
Quentin Colombet [Wed, 31 Aug 2016 18:43:01 +0000 (18:43 +0000)]
[ResetMachineFunction] Emit the diagnostic isel fallback when asked.

This pass is now able to report when the function is being reset.

llvm-svn: 280272

7 years ago[DiagnosticInfo] Add a diagnostic class for the fallback of ISel.
Quentin Colombet [Wed, 31 Aug 2016 18:42:55 +0000 (18:42 +0000)]
[DiagnosticInfo] Add a diagnostic class for the fallback of ISel.

This will be used to warm when we fallback in GlobalISel.

llvm-svn: 280271

7 years agoFix indent. NFC.
Chad Rosier [Wed, 31 Aug 2016 18:37:52 +0000 (18:37 +0000)]
Fix indent. NFC.

llvm-svn: 280270

7 years agoFix a typo in a comment.
George Burgess IV [Wed, 31 Aug 2016 18:14:15 +0000 (18:14 +0000)]
Fix a typo in a comment.

llvm-svn: 280269

7 years agoAdd an optional parameter with a list of undefs to extendToIndices
Krzysztof Parzyszek [Wed, 31 Aug 2016 18:02:19 +0000 (18:02 +0000)]
Add an optional parameter with a list of undefs to extendToIndices

llvm-svn: 280268

7 years agoNext set of additional error checks for invalid Mach-O files for bad load commands
Kevin Enderby [Wed, 31 Aug 2016 17:57:46 +0000 (17:57 +0000)]
Next set of additional error checks for invalid Mach-O files for bad load commands
that use the Mach::linkedit_data_command type for the load commands that are
currently used in the MachOObjectFile constructor.

This contains the missing checks for LC_DATA_IN_CODE and
LC_LINKER_OPTIMIZATION_HINT load commands and the fields for the
Mach::linkedit_data_command type.  Checking for other load commands that
use this type will be added later.

Also fixed a couple of places that was using sizeof(MachOObjectFile::LoadCommandInfo)
that should have been using sizeof(MachO::load_command).

llvm-svn: 280267

7 years ago[sanitizer] extend SizeClassMap to take more template parameters, add VeryCompactSize...
Kostya Serebryany [Wed, 31 Aug 2016 17:52:55 +0000 (17:52 +0000)]
[sanitizer] extend SizeClassMap to take more template parameters, add VeryCompactSizeClassMap for testing purposes

llvm-svn: 280266

7 years ago[EarlyCSE] Allow forwarding a non-invariant load into an invariant load.
Geoff Berry [Wed, 31 Aug 2016 17:45:31 +0000 (17:45 +0000)]
[EarlyCSE] Allow forwarding a non-invariant load into an invariant load.

Reviewers: sanjoy

Subscribers: mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D23935

llvm-svn: 280265

7 years agoAlways rely on CFI unwind info for linux vdso
Pavel Labath [Wed, 31 Aug 2016 17:43:49 +0000 (17:43 +0000)]
Always rely on CFI unwind info for linux vdso

Summary:
The vdso is full of hand-written assembly which the instruction emulator has a hard time
understanding. Luckily, the kernel already provides us with correct unwind info for them. So
let's use it.

This fixes (at least) the AssertingInferiorTestCase.test_inferior_asserting_disassemble test on
android N i386.

Reviewers: tberghammer

Subscribers: tberghammer, danalbert, lldb-commits

Differential Revision: https://reviews.llvm.org/D24079

llvm-svn: 280264

7 years ago[SLP] Update the debug based on Michael's suggestion.
Chad Rosier [Wed, 31 Aug 2016 17:41:12 +0000 (17:41 +0000)]
[SLP] Update the debug based on Michael's suggestion.

Passing the types/opcode check still doesn't guarantee we'll actually vectorize.
Therefore, just make it clear we're attempting to vectorize.

llvm-svn: 280263

7 years ago[LangRef] Clarify !invariant.load semantics.
Geoff Berry [Wed, 31 Aug 2016 17:39:21 +0000 (17:39 +0000)]
[LangRef] Clarify !invariant.load semantics.

Based on discussion on llvm-dev.

llvm-svn: 280262

7 years agoFixup TestPyObjSynthProvider.py and enable it again
Pavel Labath [Wed, 31 Aug 2016 17:38:17 +0000 (17:38 +0000)]
Fixup TestPyObjSynthProvider.py and enable it again

Summary:
- copies the new file in the cmake build
- adds an additional import statement
- marks the test as no-debug-info specific, as it seems to be testing a python feature

Reviewers: granata.enrico

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D24074

llvm-svn: 280261

7 years ago[SLP] Sink debug after checking for matching types/opcode.
Chad Rosier [Wed, 31 Aug 2016 17:31:09 +0000 (17:31 +0000)]
[SLP] Sink debug after checking for matching types/opcode.

Differential Revision: https://reviews.llvm.org/D24090

llvm-svn: 280260

7 years agoFix UBSan bot by not passing NULL into memcpy src.
Ivan Krasin [Wed, 31 Aug 2016 17:23:05 +0000 (17:23 +0000)]
Fix UBSan bot by not passing NULL into memcpy src.

Summary:
UBSan complains like the following:
tools/lld/COFF/Writer.cpp:97:15: runtime error: null pointer passed as argument 2, which is declared to never be null

The reason is that the vector could be empty.

Reviewers: rsmith

Subscribers: Eugene.Zelenko, kcc

Differential Revision: https://reviews.llvm.org/D24050

llvm-svn: 280259

7 years ago[lib/LTO] Factor out logic for running passes.
Davide Italiano [Wed, 31 Aug 2016 17:02:44 +0000 (17:02 +0000)]
[lib/LTO] Factor out logic for running passes.

This is in preparation for adding an option
to run a custom pipeline with the new PM. It's
currently used in lld.

llvm-svn: 280258

7 years agos/static inline/static/ for headers I have changed in r279475. NFC.
Tim Shen [Wed, 31 Aug 2016 16:48:13 +0000 (16:48 +0000)]
s/static inline/static/ for headers I have changed in r279475. NFC.

llvm-svn: 280257

7 years ago[LTO] Fix common test to reflect r279911 and move to X86 subdirectory
Teresa Johnson [Wed, 31 Aug 2016 16:15:39 +0000 (16:15 +0000)]
[LTO] Fix common test to reflect r279911 and move to X86 subdirectory

Adjust the test to reflect the changes to common handling in r279911.
This test wasn't running due to an incorrect REQUIRES and thus missed
being modified for r279911 before. It was changed to XFAIL when the
bad REQUIRES was discovered.

Remove the XFAIL and move to a new X86 subdirectory that will properly
disable on non-X86.

llvm-svn: 280256

7 years ago[codeview] Pass through vftable shape information
Reid Kleckner [Wed, 31 Aug 2016 16:11:43 +0000 (16:11 +0000)]
[codeview] Pass through vftable shape information

The shape is really just the number of methods in the vftable, since we
don't support 16 bit far calls. All calls are near. Encode this number
in the size of the artificial __vtbl_ptr_type DIDerivedType that we
generate. For DWARF, this will be a normal pointer, but for codeview
this will be a wide pointer that gets pattern matched into a
VFTableShape record. Insert this type into the element list of all
dynamic classes when emitting CodeView, so that the backend can emit the
shape even if the vptr lives in a primary base class.

Fixes PR28150

llvm-svn: 280255

7 years ago[codeview] Emit vtable shape information
Reid Kleckner [Wed, 31 Aug 2016 15:59:30 +0000 (15:59 +0000)]
[codeview] Emit vtable shape information

The shape of the vtable is passed down as the size of the
__vtbl_ptr_type. This special pointer type appears both as the pointee
type of the vptr type, and by itself in every dynamic class. For classes
with multiple vtables, only the shape of the primary vftable is
included, as the shape of all secondary vftables will be the same as in
the base class.

Fixes PR28150

llvm-svn: 280254

7 years agoAdd more unit tests for StringExtractor hex/endian functions.
Zachary Turner [Wed, 31 Aug 2016 15:50:50 +0000 (15:50 +0000)]
Add more unit tests for StringExtractor hex/endian functions.

There were a few corner cases that weren't tested for dealing with
extraction of an odd number of nibbles.  Add tests for those here.

llvm-svn: 280253

7 years ago[ELF] Linkerscript: define symbols outside SECTIONS
Petr Hosek [Wed, 31 Aug 2016 15:31:17 +0000 (15:31 +0000)]
[ELF] Linkerscript: define symbols outside SECTIONS

Symbol assignments outside of SECTIONS command need to be created
even when SECTIONS command is not used.

Differential Revision: https://reviews.llvm.org/D23751

llvm-svn: 280252

7 years agoWrap LIBCXXABI_USE_LLVM_UNWINDER with defined().
Logan Chien [Wed, 31 Aug 2016 15:16:40 +0000 (15:16 +0000)]
Wrap LIBCXXABI_USE_LLVM_UNWINDER with defined().

This commit fixes -Wundef by replacing:

    #if !LIBCXXABI_USE_LLVM_UNWINDER

with:

    #if !defined(LIBCXXABI_USE_LLVM_UNWINDER)

llvm-svn: 280251

7 years ago[statepoints][experimental] Add support for live-in semantics of values in deopt...
Philip Reames [Wed, 31 Aug 2016 15:12:17 +0000 (15:12 +0000)]
[statepoints][experimental] Add support for live-in semantics of values in deopt bundles

This is a first step towards supporting deopt value lowering and reporting entirely with the register allocator. I hope to build on this in the near future to support live-on-return semantics, but I have a use case which allows me to test and investigate code quality with just the live-in semantics so I've chosen to start there. For those curious, my use cases is our implementation of the "__llvm_deoptimize" function we bind to @llvm.deoptimize. I'm choosing not to hard code that fact in the patch and instead make it configurable via function attributes.

The basic approach here is modelled on what is done for the "Live In" values on stackmaps and patchpoints. (A secondary goal here is to remove one of the last barriers to merging the pseudo instructions.) We start by adding the operands directly to the STATEPOINT SDNode. Once we've lowered to MI, we extend the remat logic used by the register allocator to fold virtual register uses into StackMap::Indirect entries as needed. This does rely on the fact that the register allocator rematerializes. If it didn't along some code path, we could end up with more vregs than physical registers and fail to allocate.

Today, we *only* fold in the register allocator. This can create some weird effects when combined with arguments passed on the stack because we don't fold them appropriately. I have an idea how to fix that, but it needs this patch in place to work on that effectively. (There's some weird interaction with the scheduler as well, more investigation needed.)

My near term plan is to land this patch off-by-default, experiment in my local tree to identify any correctness issues and then start fixing codegen problems one by one as I find them. Once I have the live-in lowering fully working (both correctness and code quality), I'm hoping to move on to the live-on-return semantics. Note: I don't have any *known* miscompiles with this patch enabled, but I'm pretty sure I'll find at least a couple. Thus, the "experimental" tag and the fact it's off by default.

Differential Revision: https://reviews.llvm.org/D24000

llvm-svn: 280250

7 years ago[X86][SSE] Improve awareness of (v)cvtpd2ps implicit zeroing of upper 64-bits of...
Simon Pilgrim [Wed, 31 Aug 2016 15:09:34 +0000 (15:09 +0000)]
[X86][SSE] Improve awareness of (v)cvtpd2ps implicit zeroing of upper 64-bits of xmm result

Associate x86_sse2_cvtpd2ps with X86ISD::VFPROUND to avoid inserting unnecessary zeroing shuffles.

Differential Revision: https://reviews.llvm.org/D23797

llvm-svn: 280249

7 years ago[SLP] Arguments should be camel case, and start with an upper case letter. NFC.
Chad Rosier [Wed, 31 Aug 2016 15:06:58 +0000 (15:06 +0000)]
[SLP] Arguments should be camel case, and start with an upper case letter. NFC.

llvm-svn: 280248

7 years agoChanging a code block to text because Sphinx does not like it on the builder (http...
Aaron Ballman [Wed, 31 Aug 2016 14:37:20 +0000 (14:37 +0000)]
Changing a code block to text because Sphinx does not like it on the builder (lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/12517/steps/docs-llvm-html/logs/stdio)

llvm-svn: 280247

7 years agoClang patch r280064 introduced ways to set the FP exceptions and denormal
Sjoerd Meijer [Wed, 31 Aug 2016 14:17:38 +0000 (14:17 +0000)]
Clang patch r280064 introduced ways to set the FP exceptions and denormal
types. This is the LLVM counterpart and it adds options that map onto FP
exceptions and denormal build attributes allowing better fp math library
selections.

Differential Revision: https://reviews.llvm.org/D24070

llvm-svn: 280246

7 years agoclang-format: Set default WebKit style to use C++11.
Daniel Jasper [Wed, 31 Aug 2016 14:05:56 +0000 (14:05 +0000)]
clang-format: Set default WebKit style to use C++11.

The WebKit style page says to use nullptr, so this should be fine:
https://webkit.org/code-style-guidelines/

This fixes: llvm.org/PR30220

llvm-svn: 280245

7 years agoFixed spill stack objects are mutable
Krzysztof Parzyszek [Wed, 31 Aug 2016 13:52:17 +0000 (13:52 +0000)]
Fixed spill stack objects are mutable

Differential Revision: https://reviews.llvm.org/D24039

llvm-svn: 280244

7 years agoRemove redundant argument. NFC.
Rafael Espindola [Wed, 31 Aug 2016 13:49:23 +0000 (13:49 +0000)]
Remove redundant argument. NFC.

llvm-svn: 280243

7 years agoInternalize common variables.
Rafael Espindola [Wed, 31 Aug 2016 13:42:08 +0000 (13:42 +0000)]
Internalize common variables.

Before this lld was always creating common symbols itself. It worked,
but prevented them from being internalized when possible.

Now it preserves common symbols is the bitcode and they are internalized.

Fixes pr30184.

llvm-svn: 280242

7 years agoFix comments about IndirectBrInst in Instructions.h
Chad Rosier [Wed, 31 Aug 2016 13:39:34 +0000 (13:39 +0000)]
Fix comments about IndirectBrInst in Instructions.h

Patch by yo (Chiang, Yi-Yo) <yo@skymizer.com>.
Differential Revision: https://reviews.llvm.org/D23982

llvm-svn: 280241

7 years ago[clang-format-vim] Support vim linked against py3
Luke Drummond [Wed, 31 Aug 2016 13:36:36 +0000 (13:36 +0000)]
[clang-format-vim] Support vim linked against py3

clang-format.py previously only worked in vim compiled against python2.

This patch adds the necessary syntax changes to make this work with vim
linked against python3, which is now shipped by default for at least Ubuntu16 and Arch.

Differential Revision: https://reviews.llvm.org/D23319

Subscribers: cfe-commits
llvm-svn: 280240

7 years agoRevert "[SimplifyCFG] Improve FoldValueComparisonIntoPredecessors to handle more...
James Molloy [Wed, 31 Aug 2016 13:32:28 +0000 (13:32 +0000)]
Revert "[SimplifyCFG] Improve FoldValueComparisonIntoPredecessors to handle more cases"

This reverts commit r280218. This *also* causes buildbot errors. Sigh. Not a successful day all around!

llvm-svn: 280239

7 years agoChanging a code block to text because Sphinx does not like it on the builder (http...
Aaron Ballman [Wed, 31 Aug 2016 13:29:23 +0000 (13:29 +0000)]
Changing a code block to text because Sphinx does not like it on the builder (lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/12516/steps/docs-llvm-html/logs/stdio)

llvm-svn: 280238

7 years agoDelete unnecessary template.
Rafael Espindola [Wed, 31 Aug 2016 13:28:33 +0000 (13:28 +0000)]
Delete unnecessary template.

llvm-svn: 280237

7 years ago[clang-tidy docs] Add missing option docs.
Haojian Wu [Wed, 31 Aug 2016 13:21:18 +0000 (13:21 +0000)]
[clang-tidy docs] Add missing option docs.

Reviewers: alexfh, Eugene.Zelenko, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

Differential Revision: https://reviews.llvm.org/D23918

llvm-svn: 280236

7 years ago[docs] Fix docs build error.
Haojian Wu [Wed, 31 Aug 2016 13:17:48 +0000 (13:17 +0000)]
[docs] Fix docs build error.

llvm-svn: 280235

7 years agoRevert "[SimplifyCFG] Change the algorithm in SinkThenElseCodeToEnd"
James Molloy [Wed, 31 Aug 2016 13:16:52 +0000 (13:16 +0000)]
Revert "[SimplifyCFG] Change the algorithm in SinkThenElseCodeToEnd"

This reverts commit r280216 - it caused buildbot failures.

llvm-svn: 280234

7 years agoRevert "[SimplifyCFG] Handle tail-sinking of more than 2 incoming branches"
James Molloy [Wed, 31 Aug 2016 13:16:45 +0000 (13:16 +0000)]
Revert "[SimplifyCFG] Handle tail-sinking of more than 2 incoming branches"

This reverts commit r280217. r280216 caused buildbot failures - backing out the entire chain.

llvm-svn: 280233

7 years agoRevert "[SimplifyCFG] Add a workaround to fix PR30188"
James Molloy [Wed, 31 Aug 2016 13:16:36 +0000 (13:16 +0000)]
Revert "[SimplifyCFG] Add a workaround to fix PR30188"

This reverts commit r280219. r280216 caused buildbot failures - backing out the entire chain.

llvm-svn: 280232

7 years agoRevert "[SimplifyCFG] Fix bootstrap failure after r280220"
James Molloy [Wed, 31 Aug 2016 13:16:30 +0000 (13:16 +0000)]
Revert "[SimplifyCFG] Fix bootstrap failure after r280220"

This reverts commit r280228. r280216 caused buildbot failures - backing out the entire sequence.

llvm-svn: 280231

7 years agoUse abstraction in AArch64AsmPrinter::lowerSTACKMAP. NFCI
Diana Picus [Wed, 31 Aug 2016 12:43:49 +0000 (12:43 +0000)]
Use abstraction in AArch64AsmPrinter::lowerSTACKMAP. NFCI

Use functionality from StackMapOpers instead of hardcoding an operand access.

llvm-svn: 280230

7 years agoTypo fixes. NFC
Diana Picus [Wed, 31 Aug 2016 12:43:44 +0000 (12:43 +0000)]
Typo fixes. NFC

llvm-svn: 280229

7 years ago[SimplifyCFG] Fix bootstrap failure after r280220
James Molloy [Wed, 31 Aug 2016 12:33:48 +0000 (12:33 +0000)]
[SimplifyCFG] Fix bootstrap failure after r280220

We check that a sinking candidate is used by only one PHI node during our legality checks. However for instructions that are used by other sinking candidates our heuristic is less conservative. This can result in a candidate actually being illegal when we come to sink it because of how we sunk a predecessor. Do the used-by-only-one-PHI checks again during sinking to ensure we don't crash.

llvm-svn: 280228

7 years agoRevision r280064 adds new options -fdenormal-fp-math and passes through option
Sjoerd Meijer [Wed, 31 Aug 2016 12:31:03 +0000 (12:31 +0000)]
Revision r280064 adds new options -fdenormal-fp-math and passes through option
-ffast-math to CC1, but it included a wrong llvm regression tests which was
removed in r280065.  Although regression test noexceptionsfpmath.c makes sure
-fno-trapping-math ends up as a function attribute, this adds a test that
explicitly checks the driver output for -fno-trapping-math.

llvm-svn: 280227

7 years agoDelete DefinedBitcode.
Rafael Espindola [Wed, 31 Aug 2016 12:30:34 +0000 (12:30 +0000)]
Delete DefinedBitcode.

Given that we almost always want to handle it as DefinedRegular, just
use DefinedRegular.

llvm-svn: 280226

7 years ago[LTO/InputFiles] Merge two ifs into one. NFCI.
Davide Italiano [Wed, 31 Aug 2016 12:27:47 +0000 (12:27 +0000)]
[LTO/InputFiles] Merge two ifs into one. NFCI.

llvm-svn: 280225

7 years ago[LTO] Simplify unnamed_addr handling logic. NFCI.
Davide Italiano [Wed, 31 Aug 2016 12:20:46 +0000 (12:20 +0000)]
[LTO] Simplify unnamed_addr handling logic. NFCI.

llvm-svn: 280224

7 years ago[ELF][MIPS] Support R_MIPS_HIGHER / R_MIPS_HIGHEST relocations calculation
Simon Atanasyan [Wed, 31 Aug 2016 11:47:21 +0000 (11:47 +0000)]
[ELF][MIPS] Support R_MIPS_HIGHER / R_MIPS_HIGHEST relocations calculation

llvm-svn: 280223

7 years ago[ELF][MIPS] Inline function. NFC
Simon Atanasyan [Wed, 31 Aug 2016 11:47:17 +0000 (11:47 +0000)]
[ELF][MIPS] Inline function. NFC

llvm-svn: 280222

7 years agoAMDGPU/SI: Handle aliases in AMDGPUAlwaysInlinePass
Nikolay Haustov [Wed, 31 Aug 2016 11:18:33 +0000 (11:18 +0000)]
AMDGPU/SI: Handle aliases in AMDGPUAlwaysInlinePass

Summary:
Simply replace usage of aliases to functions with aliasee.
This came up when bitcode linking to builtin library and
calls to aliases not being resolved.

Also made minor improvements to existing test.

Reviewers: tstellarAMD, alex-t, vpykhtin

Subscribers: arsenm, wdng, rampitec

Differential Revision: https://reviews.llvm.org/D24023

llvm-svn: 280221

7 years agoAttempt to pacify buildbots after r280217
James Molloy [Wed, 31 Aug 2016 11:01:41 +0000 (11:01 +0000)]
Attempt to pacify buildbots after r280217

These clang tests check diagnostics from the backend by giving it an unvectorizable loop. This loop is now vectorized :/

Make it really unvectorizable by making it unprofitable to ifconvert.

llvm-svn: 280220

7 years ago[SimplifyCFG] Add a workaround to fix PR30188
James Molloy [Wed, 31 Aug 2016 10:46:45 +0000 (10:46 +0000)]
[SimplifyCFG] Add a workaround to fix PR30188

We're sinking stores, which is a good thing, but in the process creating selects for the store address operand, which SROA/Mem2Reg can't look through, which caused serious regressions.

The real fix is in SROA, which I'll be looking into.

llvm-svn: 280219

7 years ago[SimplifyCFG] Improve FoldValueComparisonIntoPredecessors to handle more cases
James Molloy [Wed, 31 Aug 2016 10:46:39 +0000 (10:46 +0000)]
[SimplifyCFG] Improve FoldValueComparisonIntoPredecessors to handle more cases

A very important case is not handled here: multiple arcs to a single block with a PHI. Consider:

    a:
      %1 = icmp %b, 1
      br %1, label %c, label %e
    c:
      %2 = icmp %b, 2
      br %2, label %d, label %e
    d:
      br %e
    e:
      phi [0, %a], [1, %c], [2, %d]

FoldValueComparisonIntoPredecessors will refuse to fold this, as it doesn't know how to deal with two arcs to a common destination with different PHI values. The answer is obvious - just split all conflicting arcs.

llvm-svn: 280218

7 years ago[SimplifyCFG] Handle tail-sinking of more than 2 incoming branches
James Molloy [Wed, 31 Aug 2016 10:46:33 +0000 (10:46 +0000)]
[SimplifyCFG] Handle tail-sinking of more than 2 incoming branches

This was a real restriction in the original version of SinkIfThenCodeToEnd. Now it's been rewritten, the restriction can be lifted.

As part of this, we handle a very common and useful case where one of the incoming branches is actually conditional. Consider:

   if (a)
     x(1);
   else if (b)
     x(2);

This produces the following CFG:

         [if]
        /    \
      [x(1)] [if]
        |     | \
        |     |  \
        |  [x(2)] |
         \    |  /
          [ end ]

[end] has two unconditional predecessor arcs and one conditional. The conditional refers to the implicit empty 'else' arc. This same pattern can also be caused by an empty default block in a switch.

We can't sink the call to x() down to end because no call to x() happens on the third incoming arc (assume that x() has sideeffects for the sake of argument; if something is safe to speculate we could indeed sink nevertheless but this cannot happen in the general case and causes many extra selects).

We are now able to detect this case and split off the unconditional arcs to a common successor:

         [if]
        /    \
      [x(1)] [if]
        |     | \
        |     |  \
        |  [x(2)] |
         \   /    |
     [sink.split] |
           \     /
           [ end ]

Now we can sink the call to x() into %sink.split. This can cause significant code simplification in many testcases.

llvm-svn: 280217

7 years ago[SimplifyCFG] Change the algorithm in SinkThenElseCodeToEnd
James Molloy [Wed, 31 Aug 2016 10:46:23 +0000 (10:46 +0000)]
[SimplifyCFG] Change the algorithm in SinkThenElseCodeToEnd

r279460 rewrote this function to be able to handle more than two incoming edges and took pains to ensure this didn't regress anything.

This time we change the logic for determining if an instruction should be sunk. Previously we used a single pass greedy algorithm - sink instructions until one requires more than one PHI node or we run out of instructions to sink.

This had the problem that sinking instructions that had non-identical but trivially the same operands needed extra logic so we sunk them aggressively. For example:

    %a = load i32* %b          %d = load i32* %b
    %c = gep i32* %a, i32 0    %e = gep i32* %d, i32 1

Sinking %c and %e would naively require two PHI merges as %a != %d. But the loads are obviously equivalent (and maybe can't be hoisted because there is no common predecessor).

This is why we implemented the fairly complex function areValuesTriviallySame(), to look through trivial differences like this. However it's just not clever enough.

Instead, throw areValuesTriviallySame away, use pointer equality to check equivalence of operands and switch to a two-stage algorithm.

In the "scan" stage, we look at every sinkable instruction in isolation from end of block to front. If it's sinkable, we keep track of all operands that required PHI merging.

In the "sink" stage, we iteratively sink the last non-terminator in the source blocks. But when calculating how many PHIs are actually required to be inserted (to work out if we should stop or not) we remove any values that have already been sunk from the set of PHI-merges required, which allows us to be more aggressive.

This turns an algorithm with potentially recursive lookahead (looking through GEPs, casts, loads and any other instruction potentially not CSE'd) to two linear scans.

llvm-svn: 280216

7 years ago[SimplifyCFG] Tail-merge calls with sideeffects
James Molloy [Wed, 31 Aug 2016 10:46:16 +0000 (10:46 +0000)]
[SimplifyCFG] Tail-merge calls with sideeffects

This was deliberately disabled during my rewrite of SinkIfThenToEnd to keep behaviour
at least vaguely consistent with the previous version and keep it as close to NFC as
I could.

There's no real reason not to merge sideeffect calls though, so let's do it! Small fixup
along the way to ensure we don't create indirect calls.

Should fix PR28964.

llvm-svn: 280215

7 years ago[X86][SSE] Improve awareness of fptrunc implicit zeroing of upper 64-bits of xmm...
Simon Pilgrim [Wed, 31 Aug 2016 10:35:13 +0000 (10:35 +0000)]
[X86][SSE] Improve awareness of fptrunc implicit zeroing of upper 64-bits of xmm result

Add patterns to avoid inserting unnecessary zeroing shuffles when lowering fptrunc to (v)cvtpd2ps

Differential Revision: https://reviews.llvm.org/D23797

llvm-svn: 280214

7 years agoFix buildbot bug: Wasn't printing scariness for DoubleFree
Filipe Cabecinhas [Wed, 31 Aug 2016 09:39:47 +0000 (09:39 +0000)]
Fix buildbot bug: Wasn't printing scariness for DoubleFree

llvm-svn: 280213

7 years ago[ELF] - Remove VersionScriptParser class and move the members to ScriptParser
George Rimar [Wed, 31 Aug 2016 09:08:26 +0000 (09:08 +0000)]
[ELF] - Remove VersionScriptParser class and move the members to ScriptParser

Patch removes VersionScriptParser class and moves the members to ScriptParser
It opens road for implementation of VERSION linkerscript command.

Differential revision: https://reviews.llvm.org/D23774

llvm-svn: 280212

7 years ago[ELF] - Fix (partial) for bug 28843 - Make sure we handle options with opposing meanings.
George Rimar [Wed, 31 Aug 2016 08:53:21 +0000 (08:53 +0000)]
[ELF] - Fix (partial) for bug 28843 - Make sure we handle options with opposing meanings.

As stated in PR28843:

we should handle command lines with

-target1-rel -target1-abs
--demangle --no-demangle
Patch implements this for specified options.
There are probably other conflicting options can exist,
so fix is called "partial".

Differential revision: https://reviews.llvm.org/D23867

llvm-svn: 280211

7 years agoAdd DT_REL(A)COUNT tag to .dynamic section
Eugene Leviant [Wed, 31 Aug 2016 08:51:39 +0000 (08:51 +0000)]
Add DT_REL(A)COUNT tag to .dynamic section

This patch groups relative relocations in a single block
in combrelocs mode and adds DT_RELCOUNT or DT_RELACOUNT
tag to .dynamic section

Differential revision: https://reviews.llvm.org/D23661

llvm-svn: 280210

7 years ago[ELF] - Introduce DiscardPolicy instead of 3 relative bool fields.
George Rimar [Wed, 31 Aug 2016 08:46:30 +0000 (08:46 +0000)]
[ELF] - Introduce DiscardPolicy instead of 3 relative bool fields.

DiscardPolicy is enum replacing several boolean options.
This approach is not only consistent with what we use for
unresolveds (UnresolvedPolicy), but also should help to solve a problem
of options with opposing meanings, mentioned in PR28843

Differential revision: https://reviews.llvm.org/D23868

llvm-svn: 280209

7 years agoXFail new TestPyObjSynthProvider.py on linux until I can investigate the cause of...
Pavel Labath [Wed, 31 Aug 2016 08:43:40 +0000 (08:43 +0000)]
XFail new TestPyObjSynthProvider.py on linux until I can investigate the cause of the problem

llvm-svn: 280208

7 years agoRevert r280137 and 280139 and subsequent build fixes
Pavel Labath [Wed, 31 Aug 2016 08:43:37 +0000 (08:43 +0000)]
Revert r280137 and 280139 and subsequent build fixes

The rewrite of StringExtractor::GetHexMaxU32 changes functionality in a way which makes
lldb-server crash. The crash (assert) happens when parsing the "qRegisterInfo0" packet, because
the function tries to drop_front more bytes than the packet contains. It's not clear to me
whether we should consider this a bug in the caller or the callee, but it any case, it worked
before, so I am reverting this until we can figure out what the proper interface should be.

llvm-svn: 280207

7 years ago[ELF] - Introduce StripPolicy instead of Config->StripAll/StripDebug flags.
George Rimar [Wed, 31 Aug 2016 08:38:11 +0000 (08:38 +0000)]
[ELF] - Introduce StripPolicy instead of Config->StripAll/StripDebug flags.

This approach is not only consistent with UnresolvedPolicy,
but also should help to solve a problem
of options with opposing meanings, mentioned in PR28843

Differential revision: https://reviews.llvm.org/D23869

llvm-svn: 280206

7 years agoAllow adding start/end symbols to any section
Eugene Leviant [Wed, 31 Aug 2016 08:13:33 +0000 (08:13 +0000)]
Allow adding start/end symbols to any section

Allows adding start and/or end symbols to special output sections,
like .eh_frame_hdr, which aren't lists of regular input sections.

Differential revision: https://reviews.llvm.org/D23716

llvm-svn: 280205

7 years agoRevert r280200 and put it a proper fix
Pavel Labath [Wed, 31 Aug 2016 07:49:37 +0000 (07:49 +0000)]
Revert r280200 and put it a proper fix

PeekChar returns a character, we want the whole string there.

llvm-svn: 280204

7 years agoAllow .eh_frame_hdr to be placed before .eh_frame
Eugene Leviant [Wed, 31 Aug 2016 07:43:50 +0000 (07:43 +0000)]
Allow .eh_frame_hdr to be placed before .eh_frame

Differential revision: https://reviews.llvm.org/D24041

llvm-svn: 280203

7 years agoFix lldb build on Mac.
Pavel Labath [Wed, 31 Aug 2016 07:42:38 +0000 (07:42 +0000)]
Fix lldb build on Mac.

Summary:
https://github.com/llvm-mirror/lldb/commit/e80f43fd78fa0fbc04d2d59b5713acb5d06c8308
greatly improved an API, but missed one more occurence of legacy usage.

This leads to:
  if (extractor.GetHexBytes(&payload_bytes[0], payload_bytes.size(), '\xdd') != payload_bytes.size())
                                ~~~~~~~~~~~~~~~~~~~~~                                          ^~~~~~
  /lldb/include/lldb/Utility/StringExtractor.h:151:5: note: 'GetHexBytes' declared here

Reviewers: zturner

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D24064
Author: Taras Tsugrii <ttsugrii@fb.com>

llvm-svn: 280202

7 years agoReify ErrorDoubleFree
Filipe Cabecinhas [Wed, 31 Aug 2016 07:38:09 +0000 (07:38 +0000)]
Reify ErrorDoubleFree

Summary: Keep reifying other errors.

Reviewers: kcc, samsonov

Subscribers: llvm-commits, kubabrecka

Differential Revision: https://reviews.llvm.org/D23717

llvm-svn: 280201

7 years agoUpdate the Linux code to reflect the changes done by zturner in r280139
Sylvestre Ledru [Wed, 31 Aug 2016 07:16:56 +0000 (07:16 +0000)]
Update the Linux code to reflect the changes done by zturner in r280139

llvm-svn: 280200

7 years ago[Coverage] Suppress creating a code region if the same area is covered by an expansio...
Igor Kudrin [Wed, 31 Aug 2016 07:04:16 +0000 (07:04 +0000)]
[Coverage] Suppress creating a code region if the same area is covered by an expansion region.

In most cases these code regions are just redundant, but sometimes they
could be assigned to the counter of the parent code region instead of
the counter of the nested block.

Differential Revision: https://reviews.llvm.org/D23987

llvm-svn: 280199

7 years ago[Coverage] Make sorting criteria for CounterMappingRegions local.
Igor Kudrin [Wed, 31 Aug 2016 07:01:17 +0000 (07:01 +0000)]
[Coverage] Make sorting criteria for CounterMappingRegions local.

Move the comparison function into the only place there it is used,
i.e. the call to std::stable_sort in CoverageMappingWriter::write().

Add sorting by region kinds as it is required to ensure stable order
in our tests and to simplify D23987.

Differential Revision: https://reviews.llvm.org/D24034

llvm-svn: 280198

7 years ago[AVX-512] Implement masked floating point logical operations with native IR and remov...
Craig Topper [Wed, 31 Aug 2016 05:38:58 +0000 (05:38 +0000)]
[AVX-512] Implement masked floating point logical operations with native IR and remove the builtins.

llvm-svn: 280197

7 years ago[X86] Use v2i64 vectors to implement _mm_and/andn/or/xor_pd.
Craig Topper [Wed, 31 Aug 2016 05:38:55 +0000 (05:38 +0000)]
[X86] Use v2i64 vectors to implement _mm_and/andn/or/xor_pd.

These will be reused when removing some builtins from avx512vldqintrin.h and this will make the tests for that change show a better number of vector elements.

llvm-svn: 280196

7 years ago[AVX-512] Add patterns to select masked logical operations if the select has a floati...
Craig Topper [Wed, 31 Aug 2016 05:37:52 +0000 (05:37 +0000)]
[AVX-512] Add patterns to select masked logical operations if the select has a floating point type.

This is needed in order to replace the masked floating point logical op intrinsics with native IR.

llvm-svn: 280195

7 years ago[AVX-512] Add test cases for masked floating point logic operations with bitcasts...
Craig Topper [Wed, 31 Aug 2016 05:37:50 +0000 (05:37 +0000)]
[AVX-512] Add test cases for masked floating point logic operations with bitcasts between the logic ops and the select. We don't currently select masked operations for these cases.

Test cases taken from optimized clang output after trying to convert the masked floating point logical op intrinsics to native IR.

llvm-svn: 280194

7 years ago[X86] Regenerate a test using update_llc_test_checks.py.
Craig Topper [Wed, 31 Aug 2016 05:37:47 +0000 (05:37 +0000)]
[X86] Regenerate a test using update_llc_test_checks.py.

llvm-svn: 280193

7 years ago[XRay] Support multiple return instructions in a single basic block
Dean Michael Berris [Wed, 31 Aug 2016 05:20:08 +0000 (05:20 +0000)]
[XRay] Support multiple return instructions in a single basic block

Add a .mir test to catch this case, and fix the xray-instrumentation
pass to handle it appropriately.

llvm-svn: 280192

7 years ago[Loads] Properly populate the visited set in isDereferenceableAndAlignedPointer
David Majnemer [Wed, 31 Aug 2016 03:22:32 +0000 (03:22 +0000)]
[Loads] Properly populate the visited set in isDereferenceableAndAlignedPointer

There were paths where we wouldn't populate the visited set, causing us
to recurse forever if an SSA variable was defined in terms of itself.

This fixes PR30210.

llvm-svn: 280191

7 years agoPR12298 et al: don't recursively instantiate a template specialization from
Richard Smith [Wed, 31 Aug 2016 02:15:21 +0000 (02:15 +0000)]
PR12298 et al: don't recursively instantiate a template specialization from
within the instantiation of that same specialization. This could previously
happen for eagerly-instantiated function templates, variable templates,
exception specifications, default arguments, and a handful of other cases.

We still have an issue here for default template arguments that recursively
make use of themselves and likewise for substitution into the type of a
non-type template parameter, but in those cases we're producing a different
entity each time, so they should instead be caught by the instantiation depth
limit. However, currently we will typically run out of stack before we reach
it. :(

llvm-svn: 280190

7 years agoConcatenate two FileCheck lines in a test.
Richard Trieu [Wed, 31 Aug 2016 01:57:12 +0000 (01:57 +0000)]
Concatenate two FileCheck lines in a test.

'cc1' is a valid sequence of hexadecimal and sometimes can occur in the path
when testing.  This can lead to FileCheck matching the incorrect occurance
of the 'cc1' string and causing a test failure.  Join two adjacent flags
together into one check to prevent this.

llvm-svn: 280189

7 years ago[PowerPC] Don't spill the frame pointer twice
Hal Finkel [Wed, 31 Aug 2016 00:52:03 +0000 (00:52 +0000)]
[PowerPC] Don't spill the frame pointer twice

When a function contains something, such as inline asm, which explicitly
clobbers the register used as the frame pointer, don't spill it twice. If we
need a frame pointer, it will be saved/restored in the prologue/epilogue code.
Explicitly spilling it again will reuse the same spill slot used by the
prologue/epilogue code, thus clobbering the saved value. The same applies
to the base-pointer or PIC-base register.

Partially fixes PR26856. Thanks to Ulrich for his analysis and the small
inline-asm reproducer.

llvm-svn: 280188

7 years agoclangTooling: Update libdeps: LLVMOptions, since r280118.
NAKAMURA Takumi [Wed, 31 Aug 2016 00:46:32 +0000 (00:46 +0000)]
clangTooling: Update libdeps: LLVMOptions, since r280118.

llvm-svn: 280187

7 years agoclangTooling depends on ClangDriverOptions since r280118.
NAKAMURA Takumi [Wed, 31 Aug 2016 00:46:25 +0000 (00:46 +0000)]
clangTooling depends on ClangDriverOptions since r280118.

llvm-svn: 280186