platform/upstream/llvm.git
8 years ago[VFS] Add 'overlay-relative' field to YAML files
Bruno Cardoso Lopes [Mon, 22 Feb 2016 18:41:09 +0000 (18:41 +0000)]
[VFS] Add 'overlay-relative' field to YAML files

The VFS overlay mapping between virtual paths and real paths is done through
the 'external-contents' entries in YAML files, which contains hardcoded paths
to the real files.

When a module compilation crashes, headers are dumped into <name>.cache/vfs
directory and are mapped via the <name>.cache/vfs/vfs.yaml. The script
generated for reproduction uses -ivfsoverlay pointing to file to gather the
mapping between virtual paths and files inside <name>.cache/vfs. Currently, we
are only capable of reproducing such crashes in the same machine as they
happen, because of the hardcoded paths in 'external-contents'.

To be able to reproduce a crash in another machine, this patch introduces a new
option in the VFS yaml file called 'overlay-relative'. When it's equal to
'true' it means that the provided path to the YAML file through the
-ivfsoverlay option should also be used to prefix the final path for every
'external-contents'.

Example, given the invocation snippet "... -ivfsoverlay
<name>.cache/vfs/vfs.yaml" and the following entry in the yaml file:

"overlay-relative": "true",
"roots": [
...
  "type": "directory",
  "name": "/usr/include",
  "contents": [
    {
      "type": "file",
      "name": "stdio.h",
      "external-contents": "/usr/include/stdio.h"
    },
...

Here, a file manager request for virtual "/usr/include/stdio.h", that will map
into real path "/<absolute_path_to>/<name>.cache/vfs/usr/include/stdio.h.

This is a useful feature for debugging module crashes in machines other than
the one where the error happened.

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

rdar://problem/24499339

llvm-svn: 261552

8 years ago[VFS] Add support for handling path traversals
Bruno Cardoso Lopes [Mon, 22 Feb 2016 18:41:01 +0000 (18:41 +0000)]
[VFS] Add support for handling path traversals

Handle ".", ".." and "./" with trailing slashes while collecting files
to be dumped into the vfs overlay directory.

Include the support for symlinks into components. Given the path:

/install-dir/bin/../lib/clang/3.8.0/include/altivec.h, if "bin"
component is a symlink, it's not safe to use `path::remove_dots` here,
and `realpath` is used to get the right answer. Since `realpath`
is expensive, we only do it at collecting time (which only happens
during the crash reproducer) and cache the base directory for fast lookups.

Overall, this makes the input to the VFS YAML file to be canonicalized
to never contain traversal components.

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

rdar://problem/24499339

llvm-svn: 261551

8 years agodocs/AMDGPUUsage: Update assembly example
Tom Stellard [Mon, 22 Feb 2016 18:36:00 +0000 (18:36 +0000)]
docs/AMDGPUUsage: Update assembly example

Reviewers: arsenm, nhaustov

Subscribers: llvm-commits

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

llvm-svn: 261550

8 years agoRevert "[attrs] Handle convergent CallSites."
Justin Lebar [Mon, 22 Feb 2016 18:24:43 +0000 (18:24 +0000)]
Revert "[attrs] Handle convergent CallSites."

This reverts r261544, which was causing a test failure in
Transforms/FunctionAttrs/readattrs.ll.

llvm-svn: 261549

8 years agoAdd has_feature attribute_availability_with_strict.
Manman Ren [Mon, 22 Feb 2016 18:24:30 +0000 (18:24 +0000)]
Add has_feature attribute_availability_with_strict.

rdar://23791325

llvm-svn: 261548

8 years agoRevert "[ifcnv] Add comment explaining why it's OK to duplicate convergent MIs in...
Justin Lebar [Mon, 22 Feb 2016 18:17:27 +0000 (18:17 +0000)]
Revert "[ifcnv] Add comment explaining why it's OK to duplicate convergent MIs in ifcnv."

This reverts r261543.  Accidental commit (not LGTM'ed).

llvm-svn: 261547

8 years agoFix for PR26690 take 2
Nemanja Ivanovic [Mon, 22 Feb 2016 18:04:00 +0000 (18:04 +0000)]
Fix for PR26690 take 2

This is what was meant to be in the initial commit to fix this bug. The
parens were missing. This commit also adds a test case for the bug and
has undergone full testing on PPC and X86.

llvm-svn: 261546

8 years ago[analyzer] Detect duplicate [super dealloc] calls
Devin Coughlin [Mon, 22 Feb 2016 17:56:24 +0000 (17:56 +0000)]
[analyzer] Detect duplicate [super dealloc] calls

Add an alpha path checker that warns about duplicate calls to [super dealloc].
This will form the foundation of a checker that will detect uses of
'self' after calling [super dealloc].

Part of rdar://problem/6953275.

Based on a patch by David Kilzer!

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

llvm-svn: 261545

8 years ago[attrs] Handle convergent CallSites.
Justin Lebar [Mon, 22 Feb 2016 17:51:35 +0000 (17:51 +0000)]
[attrs] Handle convergent CallSites.

Summary:
Previously we had a notion of convergent functions but not of convergent
calls.  This is insufficient to correctly analyze calls where the target
is unknown, e.g. indirect calls.

Now a call is convergent if it targets a known-convergent function, or
if it's explicitly marked as convergent.  As usual, we can remove
convergent where we can prove that no convergent operations are
performed in the call.

Reviewers: chandlerc, jingyue

Subscribers: hfinkel, jhen, tra, llvm-commits

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

llvm-svn: 261544

8 years ago[ifcnv] Add comment explaining why it's OK to duplicate convergent MIs in ifcnv.
Justin Lebar [Mon, 22 Feb 2016 17:51:30 +0000 (17:51 +0000)]
[ifcnv] Add comment explaining why it's OK to duplicate convergent MIs in ifcnv.

Summary:
Also add a comment briefly explaining what ifcnv is.

No functional changes.

Reviewers: resistor

Subscribers: echristo, tra, llvm-commits

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

llvm-svn: 261543

8 years ago[ifcnv] Use unique_ptr in IfConversion. NFC
Justin Lebar [Mon, 22 Feb 2016 17:51:28 +0000 (17:51 +0000)]
[ifcnv] Use unique_ptr in IfConversion.  NFC

Reviewers: rnk

Subscribers: llvm-commits

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

llvm-svn: 261541

8 years agoDon't tail-duplicate blocks that contain convergent instructions.
Justin Lebar [Mon, 22 Feb 2016 17:50:52 +0000 (17:50 +0000)]
Don't tail-duplicate blocks that contain convergent instructions.

Summary:
Convergent instrs shouldn't be made control-dependent on other values,
but this is basically the whole point of tail duplication.  So just bail
if we see a convergent instruction.

Reviewers: iteratee

Subscribers: jholewinski, jhen, hfinkel, tra, jingyue, llvm-commits

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

llvm-svn: 261540

8 years ago[WebAssembly] Properly ignore llvm.dbg.value instructions.
Dan Gohman [Mon, 22 Feb 2016 17:45:20 +0000 (17:45 +0000)]
[WebAssembly] Properly ignore llvm.dbg.value instructions.

llvm-svn: 261538

8 years agoDon't enable /GX by default
David Majnemer [Mon, 22 Feb 2016 17:44:51 +0000 (17:44 +0000)]
Don't enable /GX by default

The /GX flag is disabled unless explicitly specified on the command
line.  This partially addresses PR26698.

llvm-svn: 261537

8 years agoRefactor GetSoftwareBreakpointTrapOpcode
Aidan Dodds [Mon, 22 Feb 2016 17:29:56 +0000 (17:29 +0000)]
Refactor GetSoftwareBreakpointTrapOpcode

This patch aims to reduce the code duplication among all of the platforms in GetSoftwareBreakpointTrapOpcode by pushing all common code into the Platform base class.

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

llvm-svn: 261536

8 years ago[MS ABI] Correctly handle dllimport'd explicit instantiation declaration w/ vbases
David Majnemer [Mon, 22 Feb 2016 17:22:08 +0000 (17:22 +0000)]
[MS ABI] Correctly handle dllimport'd explicit instantiation declaration w/ vbases

We gave a VBTable dllimport storage class and external linkage while
also providing an initializer.  An initializer is only valid if the
VBTable has available_externally linkage.  Fix this by setting the
linkage to available_externally in situ while generating the
initializer.

This fixes PR26686.

llvm-svn: 261535

8 years agoAdd a test for r261425.
David Majnemer [Mon, 22 Feb 2016 17:22:01 +0000 (17:22 +0000)]
Add a test for r261425.

llvm-svn: 261534

8 years agoAdd support for Android Vector calling convention for AArch64
Nirav Dave [Mon, 22 Feb 2016 16:48:42 +0000 (16:48 +0000)]
Add support for Android Vector calling convention for AArch64

This modification applies the following Android commit when we have an
Android environment. This is the sole non-renderscript in the Android repo

commit 9212d4fb30a3ca2f4ee966dd2748c35573d9682c
Author: Tim Murray <timmurray@google.com>
Date:   Fri Aug 15 16:00:15 2014 -0700

    Update vector calling convention for AArch64.

    bug 16846318

    Change-Id: I3cfd167758b4bd634d8480ee6ba6bb55d61f82a7

Reviewers: srhines, jyknight

Subscribers: mcrosier, aemerson, rengolin, tberghammer, danalbert, srhines

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

llvm-svn: 261533

8 years ago[ConstantRange] Rename a method and add more doc
Sanjoy Das [Mon, 22 Feb 2016 16:13:02 +0000 (16:13 +0000)]
[ConstantRange] Rename a method and add more doc

Rename makeNoWrapRegion to a more obvious makeGuaranteedNoWrapRegion,
and add a comment about the counter-intuitive aspects of the function.
This is to help prevent cases like PR26628.

llvm-svn: 261532

8 years agoAdd a new check, cert-env33-c, that diagnoses uses of system(), popen(), and _popen...
Aaron Ballman [Mon, 22 Feb 2016 16:01:06 +0000 (16:01 +0000)]
Add a new check, cert-env33-c, that diagnoses uses of system(), popen(), and _popen() to execute a command processor. This check corresponds to the CERT secure coding rule: https://securecoding.cert.org/confluence/pages/viewpage.action?pageId=2130132

llvm-svn: 261530

8 years ago[mips] added support for trunc macro
Zoran Jovanovic [Mon, 22 Feb 2016 16:00:23 +0000 (16:00 +0000)]
[mips] added support for trunc macro

Author: obucina
Reviewers: dsanders
Differential Revision: http://reviews.llvm.org/D15745

llvm-svn: 261529

8 years agoclang-format: [JS] treat forwardDeclare as an import/export statement.
Daniel Jasper [Mon, 22 Feb 2016 15:06:53 +0000 (15:06 +0000)]
clang-format: [JS] treat forwardDeclare as an import/export statement.

Patch by Martin Probst. Thank you.

llvm-svn: 261528

8 years agoRevert bad fix for PR26690.
Nemanja Ivanovic [Mon, 22 Feb 2016 15:06:32 +0000 (15:06 +0000)]
Revert bad fix for PR26690.

llvm-svn: 261527

8 years agoFix for PR26690
Nemanja Ivanovic [Mon, 22 Feb 2016 14:47:49 +0000 (14:47 +0000)]
Fix for PR26690

I mistook BitVector::empty() to mean BitVector::count() == 0 and it does
not. Corrected the issue with the fix for PR26500.

llvm-svn: 261525

8 years agoFix some abuse of auto flagged by clang's -Wrange-loop-analysis.
Benjamin Kramer [Mon, 22 Feb 2016 13:11:58 +0000 (13:11 +0000)]
Fix some abuse of auto flagged by clang's -Wrange-loop-analysis.

llvm-svn: 261524

8 years agoUse an anonymous hyperlink reference to eliminate Sphinx warnings.
Aaron Ballman [Mon, 22 Feb 2016 13:09:36 +0000 (13:09 +0000)]
Use an anonymous hyperlink reference to eliminate Sphinx warnings.

llvm-svn: 261523

8 years agoMake Sema::CheckFormatString a static function inside SemaChecking.cpp
Andy Gibbs [Mon, 22 Feb 2016 13:00:43 +0000 (13:00 +0000)]
Make Sema::CheckFormatString a static function inside SemaChecking.cpp

No functionality change.  Change at the request of Richard Trieu, see
http://reviews.llvm.org/D15636#357858.

llvm-svn: 261522

8 years agoAVX512F: Add assembler Intel syntax tests for knl, fix minor bugs.
Igor Breger [Mon, 22 Feb 2016 12:37:41 +0000 (12:37 +0000)]
AVX512F: Add assembler Intel syntax tests for knl, fix minor bugs.

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

llvm-svn: 261521

8 years agoAVX512: Fix scalar mem operands.
Igor Breger [Mon, 22 Feb 2016 11:48:27 +0000 (11:48 +0000)]
AVX512: Fix scalar mem operands.

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

llvm-svn: 261520

8 years agoMark TestMiBreak.test_lldbmi_break_insert_function_pending as flaky on linux
Pavel Labath [Mon, 22 Feb 2016 09:51:32 +0000 (09:51 +0000)]
Mark TestMiBreak.test_lldbmi_break_insert_function_pending as flaky on linux

Test has become flaky again. Attempts to investigate the triggering commit have failed, so I
suspect it was flaky all along..

llvm-svn: 261519

8 years ago[CLANG] [AVX512] [BUILTIN] Adding prol{d|q|w}{128|256|512} builtin to clang .
Michael Zuckerman [Mon, 22 Feb 2016 09:42:57 +0000 (09:42 +0000)]
[CLANG] [AVX512] [BUILTIN] Adding prol{d|q|w}{128|256|512} builtin to clang .

Fixing problem with the lib/include/avx512vlintrin.h file.
Adding one more _ to the prefix of _extension__ -> __extension__.

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

llvm-svn: 261518

8 years agoAllow setting MaxRerollIterations above 16
Elena Demikhovsky [Mon, 22 Feb 2016 09:38:28 +0000 (09:38 +0000)]
Allow setting MaxRerollIterations above 16
By Ayal Zaks.

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

llvm-svn: 261517

8 years ago[CLANG] [AVX512] [BUILTIN] Adding prol{d|q|w}{128|256|512} builtin to clang .
Michael Zuckerman [Mon, 22 Feb 2016 09:05:41 +0000 (09:05 +0000)]
[CLANG] [AVX512] [BUILTIN] Adding prol{d|q|w}{128|256|512} builtin to clang .

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

llvm-svn: 261516

8 years ago[X86] Minor formatting fix. NFC
Craig Topper [Mon, 22 Feb 2016 08:00:04 +0000 (08:00 +0000)]
[X86] Minor formatting fix. NFC

llvm-svn: 261515

8 years agoUse EXPECT_EQ in the unittests instead of plain assert
Tobias Grosser [Mon, 22 Feb 2016 07:20:40 +0000 (07:20 +0000)]
Use EXPECT_EQ in the unittests instead of plain assert

This addresses post-review comments from Duncan P. N. Exon Smith to r261485.

llvm-svn: 261514

8 years ago[MSan] Make unaligned load/store functions compatible for both endians
Mohit K. Bhakkad [Mon, 22 Feb 2016 06:16:28 +0000 (06:16 +0000)]
[MSan] Make unaligned load/store functions compatible for both endians

Reviewers: eugenis

Subscribers: jaydeep, sagar, llvm-commits

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

llvm-svn: 261513

8 years agoAddressing review comments for r261163.
Manman Ren [Mon, 22 Feb 2016 04:47:24 +0000 (04:47 +0000)]
Addressing review comments for r261163.

Use "strict" instead of "nopartial". Also make strictly not-introduced
share the same diagnostics as Obsolete and Unavailable.

rdar://23791325

llvm-svn: 261512

8 years agoReapply "CodeGen: Use references in MachineTraceMetrics::Trace, NFC"
Duncan P. N. Exon Smith [Mon, 22 Feb 2016 03:33:28 +0000 (03:33 +0000)]
Reapply "CodeGen: Use references in MachineTraceMetrics::Trace, NFC"

This reverts commit r261510, effectively reapplying r261509.  The
original commit missed a caller in AArch64ConditionalCompares.

Original commit message:

Pass non-null arguments by reference in MachineTraceMetrics::Trace,
simplifying future work to remove implicit iterator => pointer
conversions.

llvm-svn: 261511

8 years agoRevert "CodeGen: Use references in MachineTraceMetrics::Trace, NFC"
Duncan P. N. Exon Smith [Mon, 22 Feb 2016 03:12:42 +0000 (03:12 +0000)]
Revert "CodeGen: Use references in MachineTraceMetrics::Trace, NFC"

This reverts commit r261509.  I'm not sure how this compiled locally,
but something was out of whack.

llvm-svn: 261510

8 years agoCodeGen: Use references in MachineTraceMetrics::Trace, NFC
Duncan P. N. Exon Smith [Mon, 22 Feb 2016 03:07:49 +0000 (03:07 +0000)]
CodeGen: Use references in MachineTraceMetrics::Trace, NFC

Pass non-null arguments by reference in MachineTraceMetrics::Trace,
simplifying future work to remove implicit iterator => pointer
conversions.

llvm-svn: 261509

8 years agoCodeGen: Explicitly convert from iterator to pointer, NFC
Duncan P. N. Exon Smith [Mon, 22 Feb 2016 02:53:42 +0000 (02:53 +0000)]
CodeGen: Explicitly convert from iterator to pointer, NFC

llvm-svn: 261508

8 years agoDocument assumption in X86FrameLowering::inlineStackProbe()
Duncan P. N. Exon Smith [Mon, 22 Feb 2016 02:32:35 +0000 (02:32 +0000)]
Document assumption in X86FrameLowering::inlineStackProbe()

Resolve FIXME from r261504.  Apparently bundled instructions are illegal
here:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160215/334146.html

llvm-svn: 261507

8 years agoFix PR24473 : Teach clang to remember to substitute into member variable templates...
Faisal Vali [Mon, 22 Feb 2016 02:24:29 +0000 (02:24 +0000)]
Fix PR24473 : Teach clang to remember to substitute into member variable templates referred to within dependent qualified ids.

In passing also fix a semi-related bug that allows access to variable templates through member access notation.

llvm-svn: 261506

8 years ago[X86] More test updates to support fixup-byte-word-insts optimization
Kevin B. Smith [Mon, 22 Feb 2016 01:27:56 +0000 (01:27 +0000)]
[X86] More test updates to support fixup-byte-word-insts optimization
either on or off.
Differential Revisions: http://reviews.llvm.org/D17458

llvm-svn: 261505

8 years agoCodeGen: MachineInstr::getIterator() => getInstrIterator(), NFC
Duncan P. N. Exon Smith [Sun, 21 Feb 2016 22:58:35 +0000 (22:58 +0000)]
CodeGen: MachineInstr::getIterator() => getInstrIterator(), NFC

Delete MachineInstr::getIterator(), since the term "iterator" is
overloaded when talking about MachineInstr.

- Downcast to ilist_node in iplist::getNextNode() and getPrevNode() so
  that ilist_node::getIterator() is still available.
- Add it back as MachineInstr::getInstrIterator().  This matches the
  naming in MachineBasicBlock.
- Add MachineInstr::getBundleIterator().  This is explicitly called
  "bundle" (not matching MachineBasicBlock) to disintinguish it clearly
  from ilist_node::getIterator().
- Update all calls.  Some of these I switched to `auto` to remove
  boiler-plate, since the new name is clear about the type.

There was one call I updated that looked fishy, but it wasn't clear what
the right answer was.  This was in X86FrameLowering::inlineStackProbe(),
added in r252578 in lib/Target/X86/X86FrameLowering.cpp.  I opted to
leave the behaviour unchanged, but I'll reply to the original commit on
the list in a moment.

llvm-svn: 261504

8 years ago[Orc] Add stack-realignment code to the i386 resolver function.
Lang Hames [Sun, 21 Feb 2016 22:50:26 +0000 (22:50 +0000)]
[Orc] Add stack-realignment code to the i386 resolver function.

The resolver uses the fxsave/fxrstor instructions, which require 16-byte
alignment, to save SSE state to the stack. Since 16-byte alignment can't be
assumed on all OSes (and all i386 OSes share this function) - add code to
automatically bump the alignment to 16-bytes on entry to the function.

llvm-svn: 261503

8 years agoCodeGen: Split bundle_iterator into a separate file, NFC
Duncan P. N. Exon Smith [Sun, 21 Feb 2016 22:05:50 +0000 (22:05 +0000)]
CodeGen: Split bundle_iterator into a separate file, NFC

Split MachineBasicBlock::bundle_iterator into a separate file, and
rename the class to MachineBundleIterator.

This is a precursor to adding a `MachineInstr::getBundleIterator()`
accessor, which will eventually let us delete the final call to
getNodePtrUnchecked(), and then remove the UB from ilist_iterator.

As a drive-by, I removed an unnecessary second template parameter.

llvm-svn: 261502

8 years agoAdd test case for [FIX] commit r261474
Johannes Doerfert [Sun, 21 Feb 2016 21:53:39 +0000 (21:53 +0000)]
Add test case for [FIX] commit r261474

llvm-svn: 261501

8 years agoCodeGen: Add constructor for MIBuilder from a bundle_iterator, NFC
Duncan P. N. Exon Smith [Sun, 21 Feb 2016 21:15:37 +0000 (21:15 +0000)]
CodeGen: Add constructor for MIBuilder from a bundle_iterator, NFC

Don't require explicit conversions for creating a MachineInstrBuilder
from a bundle_iterator.

llvm-svn: 261500

8 years agoADT: Disallow == and != between pointers and ilist iterators
Duncan P. N. Exon Smith [Sun, 21 Feb 2016 20:46:37 +0000 (20:46 +0000)]
ADT: Disallow == and != between pointers and ilist iterators

I completely missed these non-class operators when I removed the
implicit conversions in r252380.  Remove them now.  r261498 should have
already removed all uses.

Note (repeated from r252380): if you have out-of-tree code, it should be
fairly easy to revert this patch downstream while you update your
out-of-tree call sites.  Note that these conversions are occasionally
latent bugs (that may happen to "work" now, but only because of getting
lucky with UB; follow-ups will change your luck).  When they are valid,
I suggest using `->getIterator()` to go from pointer to iterator, and
`&*` to go from iterator to pointer.

llvm-svn: 261499

8 years agoADT: Remove == and != comparisons between ilist iterators and pointers
Duncan P. N. Exon Smith [Sun, 21 Feb 2016 20:39:50 +0000 (20:39 +0000)]
ADT: Remove == and != comparisons between ilist iterators and pointers

I missed == and != when I removed implicit conversions between iterators
and pointers in r252380 since they were defined outside ilist_iterator.

Since they depend on getNodePtrUnchecked(), they indirectly rely on UB.
This commit removes all uses of these operators.  (I'll delete the
operators themselves in a separate commit so that it can be easily
reverted if necessary.)

There should be NFC here.

llvm-svn: 261498

8 years agoTransformUtils: Avoid getNodePtrUnchecked() in integer division, NFC
Duncan P. N. Exon Smith [Sun, 21 Feb 2016 20:14:29 +0000 (20:14 +0000)]
TransformUtils: Avoid getNodePtrUnchecked() in integer division, NFC

Stop relying on `getNodePtrUnchecked()` being useful on invalid
iterators.  This function is documented to be for internal use only, and
the pointer type will eventually have to change to remove UB from
ilist_iterator.  Instead, check the iterator before it has been
invalidated.

llvm-svn: 261497

8 years agoIslAst: Expose IslAst class in header file [NFC]
Tobias Grosser [Sun, 21 Feb 2016 20:01:28 +0000 (20:01 +0000)]
IslAst: Expose IslAst class in header file [NFC]

This allows other passes and transformations to use some of the existing AST
building infrastructure. This is not yet used in Polly itself.

llvm-svn: 261496

8 years agoADT: Stop using getNodePtrUnchecked on end() iterators
Duncan P. N. Exon Smith [Sun, 21 Feb 2016 19:52:15 +0000 (19:52 +0000)]
ADT: Stop using getNodePtrUnchecked on end() iterators

Stop using `getNodePtrUnchecked()` when building IR.  Eventually a
dereference will be required to get at the downcast node, since the
iterator will only store an `ilist_node_base` of some sort.

This should have no functionality change for now, but is a path towards
removing some more UB from ilist.

llvm-svn: 261495

8 years ago[X86] Remove unused encoding types from disassembler. NFC
Craig Topper [Sun, 21 Feb 2016 19:49:16 +0000 (19:49 +0000)]
[X86] Remove unused encoding types from disassembler. NFC

llvm-svn: 261494

8 years agoCodeGen: Avoid getNodePtrUnchecked() where we need a Value, NFC
Duncan P. N. Exon Smith [Sun, 21 Feb 2016 19:37:45 +0000 (19:37 +0000)]
CodeGen: Avoid getNodePtrUnchecked() where we need a Value, NFC

`ilist_iterator<NodeTy>::getNodePtrUnchecked()` is documented as being
for internal use only, but CodeGenPrepare was using it anyway.  This
code relies on pulling out the `Value*` pointer even after the lifetime
of the iterator is over.  But having this pointer available in
ilist_iterator depends on UB in the first place.

Instead, safely pull out the `Value*` when the iterator is alive and
stop using the internal-only API.

There should be no functionality change here.

llvm-svn: 261493

8 years agoADT: clang-format ilist_iterator, NFC
Duncan P. N. Exon Smith [Sun, 21 Feb 2016 19:26:08 +0000 (19:26 +0000)]
ADT: clang-format ilist_iterator, NFC

Also removed a couple of noisy (no-value-added) comments.

llvm-svn: 261492

8 years agoADT: Remove ilist_iterator random access API, NFC
Duncan P. N. Exon Smith [Sun, 21 Feb 2016 19:23:18 +0000 (19:23 +0000)]
ADT: Remove ilist_iterator random access API, NFC

Remove explicitly deleted random access API from ilist_iterator.
Since it no longer has implicit conversions to a pointer type, we
no longer need this protection.

llvm-svn: 261491

8 years ago[X86][AVX] Add shuffle masking support for EltsFromConsecutiveLoads
Simon Pilgrim [Sun, 21 Feb 2016 19:15:48 +0000 (19:15 +0000)]
[X86][AVX] Add shuffle masking support for EltsFromConsecutiveLoads

Add support for the case where we have a consecutive load (which must include the first + last elements) with a mixture of undef/zero elements. We load the vector and then apply a shuffle to clear the zero'd elements.

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

llvm-svn: 261490

8 years agoSupport memory intrinsics
Johannes Doerfert [Sun, 21 Feb 2016 19:13:19 +0000 (19:13 +0000)]
Support memory intrinsics

  This patch adds support for memcpy, memset and memmove intrinsics. They are
  represented as one (memset) or two (memcpy, memmove) memory accesses in the
  polyhedral model. These accesses have an access range that describes the
  summarized effect of the intrinsic, i.e.,
    memset(&A[i], '$', N);
  is represented as a write access from A[i] to A[i+N].

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

llvm-svn: 261489

8 years agoUse regular expressions instead of temporary names for IR test [NFC]
Johannes Doerfert [Sun, 21 Feb 2016 18:59:35 +0000 (18:59 +0000)]
Use regular expressions instead of temporary names for IR test [NFC]

llvm-svn: 261488

8 years agoScalerEvolution: Only erase temporary values if they actually have been added
Tobias Grosser [Sun, 21 Feb 2016 18:50:09 +0000 (18:50 +0000)]
ScalerEvolution: Only erase temporary values if they actually have been added

This addresses post-review comments from Sanjoy Das for r261485.

llvm-svn: 261486

8 years agoScalarEvolution: Do not keep temporary PHI values in ValueExprMap
Tobias Grosser [Sun, 21 Feb 2016 17:42:10 +0000 (17:42 +0000)]
ScalarEvolution: Do not keep temporary PHI values in ValueExprMap

Before this patch simplified SCEV expressions for PHI nodes were only returned
the very first time getSCEV() was called, but later calls to getSCEV always
returned the non-simplified value, which had "temporarily" been stored in the
ValueExprMap, but was never removed and consequently blocked the caching of the
simplified PHI expression.

llvm-svn: 261485

8 years agofix inaccurate comment; NFC
Sanjay Patel [Sun, 21 Feb 2016 17:33:31 +0000 (17:33 +0000)]
fix inaccurate comment; NFC

llvm-svn: 261484

8 years ago[InstCombine] add getNegativeIsTrueBoolVec() helper function; NFC
Sanjay Patel [Sun, 21 Feb 2016 17:29:33 +0000 (17:29 +0000)]
[InstCombine] add getNegativeIsTrueBoolVec() helper function; NFC

Originally part of:
http://reviews.llvm.org/D17485

We need this when simplifying masked memory ops too.

llvm-svn: 261483

8 years agoFix LLVM's handling and detection of skylake and cannonlake CPUs
Sanjoy Das [Sun, 21 Feb 2016 17:12:03 +0000 (17:12 +0000)]
Fix LLVM's handling and detection of skylake and cannonlake CPUs

Summary:
 - Rename `"skylake"` == SkylakeServerProc to `"skylake-avx512"`
 - Change `"skylake"` to denote SkylakeClientProc
 - Fix the detection of cpu family 6 and model 94 to be
   SkylakeClientProc instead of SkylakeServerProc
 - Remove the `"cnl"` for CannonLake

Reviewers: craig.topper, delena

Subscribers: zansari, echristo, qcolombet, RKSimon, spatel, DavidKreitzer, mcrosier, llvm-commits

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

llvm-svn: 261482

8 years ago[LoopDeletion] Add an assert that verifies LCSSA
Sanjoy Das [Sun, 21 Feb 2016 17:11:59 +0000 (17:11 +0000)]
[LoopDeletion] Add an assert that verifies LCSSA

This is inspired by PR24804 -- had this assert been there before,
isolating the root cause for PR24804 would have been far easier.

llvm-svn: 261481

8 years ago[analyzer][scan-build] Non-existing directory for scan-build output.
Anton Yartsev [Sun, 21 Feb 2016 17:04:26 +0000 (17:04 +0000)]
[analyzer][scan-build] Non-existing directory for scan-build output.

Makes scan-build successfully accept non-existing output directories provided via "-o" option. The directory is created in this case. This behavior is conforming to the old perl scan-build implementation.
(http://reviews.llvm.org/D17091)

llvm-svn: 261480

8 years agoWebAssembly: update expected torture test failures
JF Bastien [Sun, 21 Feb 2016 16:52:00 +0000 (16:52 +0000)]
WebAssembly: update expected torture test failures

r261457 handles CopyToReg nodes with flag results in LowerCopyToReg, which was causing the SelectionDAGNodes assert.

llvm-svn: 261479

8 years ago[Refactor] Add missing newline after functions
Johannes Doerfert [Sun, 21 Feb 2016 16:37:58 +0000 (16:37 +0000)]
[Refactor] Add missing newline after functions

llvm-svn: 261478

8 years ago[Refactor] Indicate pointer and reference types when auto is used
Johannes Doerfert [Sun, 21 Feb 2016 16:37:25 +0000 (16:37 +0000)]
[Refactor] Indicate pointer and reference types when auto is used

  See also:
    http://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable

llvm-svn: 261477

8 years ago[Refactor] Add newlines to separate doxygen fields
Johannes Doerfert [Sun, 21 Feb 2016 16:36:54 +0000 (16:36 +0000)]
[Refactor] Add newlines to separate doxygen fields

llvm-svn: 261476

8 years ago[Refactor] Avoid variables with name of types
Johannes Doerfert [Sun, 21 Feb 2016 16:36:21 +0000 (16:36 +0000)]
[Refactor] Avoid variables with name of types

llvm-svn: 261475

8 years ago[FIX] Compare SCEVs not values during SCEV expansion
Johannes Doerfert [Sun, 21 Feb 2016 16:36:00 +0000 (16:36 +0000)]
[FIX] Compare SCEVs not values during SCEV expansion

  This fixes a compile time bug in SPEC2006 403.gcc, namely an endless
  recursion in the ScopExpander::visitUnknown function.

llvm-svn: 261474

8 years agoBlockGenerator: Drop unnecessary return value
Tobias Grosser [Sun, 21 Feb 2016 15:44:34 +0000 (15:44 +0000)]
BlockGenerator: Drop unnecessary return value

llvm-svn: 261473

8 years ago[InstCombine] Added SSE41 roundss/roundsd demanded vector elements invec tests
Simon Pilgrim [Sun, 21 Feb 2016 14:50:27 +0000 (14:50 +0000)]
[InstCombine] Added SSE41 roundss/roundsd demanded vector elements invec tests

llvm-svn: 261472

8 years ago[CLANG] [AVX512] [BUILTIN] Adding pmovzx{b|d|w}{w|d|q}{128|256|512} builtin to clang
Michael Zuckerman [Sun, 21 Feb 2016 14:00:11 +0000 (14:00 +0000)]
[CLANG] [AVX512] [BUILTIN] Adding pmovzx{b|d|w}{w|d|q}{128|256|512} builtin to clang

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

llvm-svn: 261471

8 years ago[InstCombine] Added XOP frczss/vfrczsd demanded vector elements tests
Simon Pilgrim [Sun, 21 Feb 2016 12:45:36 +0000 (12:45 +0000)]
[InstCombine] Added XOP frczss/vfrczsd demanded vector elements tests

llvm-svn: 261469

8 years ago[InstCombine] Added SSE41 roundss/roundsd demanded vector elements tests
Simon Pilgrim [Sun, 21 Feb 2016 12:40:39 +0000 (12:40 +0000)]
[InstCombine] Added SSE41 roundss/roundsd demanded vector elements tests

llvm-svn: 261468

8 years agoAdded SKL and CNL processors and features to Clang
Elena Demikhovsky [Sun, 21 Feb 2016 07:41:23 +0000 (07:41 +0000)]
Added SKL and CNL processors and features to Clang

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

llvm-svn: 261467

8 years agoClass Property: Fix a crash with old ABI when generating metadata in classes.
Manman Ren [Sun, 21 Feb 2016 05:31:05 +0000 (05:31 +0000)]
Class Property: Fix a crash with old ABI when generating metadata in classes.

rdar://23891898

llvm-svn: 261466

8 years ago[WebAssembly] Support physical registers in the rewrite-to-discard optimization.
Dan Gohman [Sun, 21 Feb 2016 03:27:22 +0000 (03:27 +0000)]
[WebAssembly] Support physical registers in the rewrite-to-discard optimization.

llvm-svn: 261465

8 years agoIR: Add ConstantData, for operand-less Constants
Duncan P. N. Exon Smith [Sun, 21 Feb 2016 02:39:49 +0000 (02:39 +0000)]
IR: Add ConstantData, for operand-less Constants

Add a common parent `ConstantData` to the constants that have no
operands.  These are guaranteed to represent abstract data that is in no
way tied to a specific Module.

This is a good cleanup on its own.  It also makes it simpler to disallow
RAUW (and factor away use-lists) on these constants in the future.  (I
have some experimental patches that make RAUW illegal on ConstantData,
and they seem to catch a bunch of bugs...)

llvm-svn: 261464

8 years agoUnbreak non-X86 targets from fallout caused by r261462
David Majnemer [Sun, 21 Feb 2016 01:40:04 +0000 (01:40 +0000)]
Unbreak non-X86 targets from fallout caused by r261462

llvm-svn: 261463

8 years ago[X86] Use the correct alignment for COMDAT constant pool entries
David Majnemer [Sun, 21 Feb 2016 01:30:30 +0000 (01:30 +0000)]
[X86] Use the correct alignment for COMDAT constant pool entries

COFF doesn't have sections with mergeable contents.  Instead, each
constant pool entry ends up in a COMDAT section.  The linker, when
choosing between COMDAT sections, doesn't choose the max alignment of
the two sections.  You just get whatever alignment was on the section.

If one constant needed a higher alignment in one object file from
another one, then we will get into trouble if the linker chooses the
lower alignment one.

Instead, lets promote the alignment of the constant pool entry to make
sure we don't use an under aligned constant with an instruction which
assumed otherwise.

This fixes PR26680.

llvm-svn: 261462

8 years agoLex: Never overflow the file in HeaderMap::lookupFilename()
Duncan P. N. Exon Smith [Sun, 21 Feb 2016 00:14:36 +0000 (00:14 +0000)]
Lex: Never overflow the file in HeaderMap::lookupFilename()

If a header map file is corrupt, the strings in the string table may not
be null-terminated.  The logic here previously relied on `MemoryBuffer`
always being null-terminated, but this isn't actually guaranteed by the
class AFAICT.  Moreover, we're seeing a lot of crash traces at calls to
`strlen()` inside of `lookupFilename()`, so something is going wrong
there.

Instead, use `strnlen()` to get the length, and check for corruption.

Also remove code paths that could call `StringRef(nullptr)`.  r261459
made these rather obvious (although they'd been there all along).

llvm-svn: 261461

8 years ago[InstCombine] SSE/SSE2 (u)comiss/(u)comisd comparison intrinsics only use the lowest...
Simon Pilgrim [Sat, 20 Feb 2016 23:17:35 +0000 (23:17 +0000)]
[InstCombine] SSE/SSE2 (u)comiss/(u)comisd comparison intrinsics only use the lowest vector element

llvm-svn: 261460

8 years agoLex: Change HeaderMapImpl::getString() to return StringRef, NFC
Duncan P. N. Exon Smith [Sat, 20 Feb 2016 23:12:51 +0000 (23:12 +0000)]
Lex: Change HeaderMapImpl::getString() to return StringRef, NFC

llvm-svn: 261459

8 years ago[WebAssembly] Refine a README.txt entry.
Dan Gohman [Sat, 20 Feb 2016 23:11:14 +0000 (23:11 +0000)]
[WebAssembly] Refine a README.txt entry.

The register coloring pass may also need to be involved in order to
optimally sort registers.

llvm-svn: 261458

8 years ago[WebAssembly] Handle CopyToReg nodes with flag results in LowerCopyToReg.
Dan Gohman [Sat, 20 Feb 2016 23:09:44 +0000 (23:09 +0000)]
[WebAssembly] Handle CopyToReg nodes with flag results in LowerCopyToReg.

llvm-svn: 261457

8 years agoLex: Use dbgs() instead of fprintf() in HeaderMap::dump()
Duncan P. N. Exon Smith [Sat, 20 Feb 2016 23:09:14 +0000 (23:09 +0000)]
Lex: Use dbgs() instead of fprintf() in HeaderMap::dump()

This way it's easy to change HeaderMapImpl::getString() to return a
StringRef.

There's a slight change here, because I used `errs()` instead of
`dbgs()`.  But `dbgs()` is more appropriate for a dump method.

llvm-svn: 261456

8 years agoLex: Add a test for HeaderMap::lookupFileName()
Duncan P. N. Exon Smith [Sat, 20 Feb 2016 22:53:22 +0000 (22:53 +0000)]
Lex: Add a test for HeaderMap::lookupFileName()

Add a simple test for `HeaderMap::lookupFileName()`.  I'm planning to
add better error checking in a moment, and I'll add more tests like this
then.

llvm-svn: 261455

8 years ago[InstCombine] Added SSE/SSE2 comparison intrinsics demanded vector elements tests
Simon Pilgrim [Sat, 20 Feb 2016 22:41:31 +0000 (22:41 +0000)]
[InstCombine] Added SSE/SSE2 comparison intrinsics demanded vector elements tests

llvm-svn: 261454

8 years ago[WebAssembly] Write stack pointer back to memory when FP is used
Derek Schuff [Sat, 20 Feb 2016 22:18:47 +0000 (22:18 +0000)]
[WebAssembly] Write stack pointer back to memory when FP is used

The stack pointer is bumped when there is a frame pointer or when there
are static-size objects, but was only getting written back when there
were static-size objects.

llvm-svn: 261453

8 years ago[WebAssembly] Stackify function prologs and epilogs
Derek Schuff [Sat, 20 Feb 2016 21:46:50 +0000 (21:46 +0000)]
[WebAssembly] Stackify function prologs and epilogs

The instructions are the same, but fewer locals are used.

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

llvm-svn: 261452

8 years ago[InstCombine] Added some SSE/SSE2 demanded vector elements tests
Simon Pilgrim [Sat, 20 Feb 2016 21:44:48 +0000 (21:44 +0000)]
[InstCombine] Added some SSE/SSE2 demanded vector elements tests

llvm-svn: 261451

8 years agoDon't scan for SSA register operands to update when not in SSA form.
Dan Gohman [Sat, 20 Feb 2016 21:28:18 +0000 (21:28 +0000)]
Don't scan for SSA register operands to update when not in SSA form.

TailDuplicate can run on either on SSA code or non-SSA code, as indicated to
it by MRI->isSSA() ("PreRegAlloc" here). TailDuplicate does extra work to
preserve SSA invariants when it duplicates code. This patch makes it skip
some of this extra work in the case where the code is not in SSA form.

llvm-svn: 261450

8 years agoLex: Check whether the header map buffer has space for the buckets
Duncan P. N. Exon Smith [Sat, 20 Feb 2016 21:24:31 +0000 (21:24 +0000)]
Lex: Check whether the header map buffer has space for the buckets

Check up front whether the header map buffer has space for all of its
declared buckets.

There was already a check in `getBucket()`, but it had UB (comparing
pointers that were outside of objects in the error path) and was
insufficient (only checking for a single byte of the relevant bucket).
I fixed the check, moved it to `checkHeader()`, and left a fixed version
behind as an assertion.

llvm-svn: 261449

8 years agoLex: Check buckets on header map construction
Duncan P. N. Exon Smith [Sat, 20 Feb 2016 21:00:58 +0000 (21:00 +0000)]
Lex: Check buckets on header map construction

If the number of buckets is not a power of two, immediately recognize
the header map as corrupt, rather than waiting for the first lookup.  I
converted the later check to an assert.

llvm-svn: 261448

8 years agoFix the build bot break caused by rL261441.
Nemanja Ivanovic [Sat, 20 Feb 2016 20:45:37 +0000 (20:45 +0000)]
Fix the build bot break caused by rL261441.

The patch has a necessary call to a function inside an assert. Which is fine
when you have asserts turned on. Not so much when they're off. Sorry about
the regression.

llvm-svn: 261447