platform/upstream/llvm.git
10 years agoObjective-C qoi. When Objective-C pointer mismatches with
Fariborz Jahanian [Thu, 19 Jun 2014 23:05:46 +0000 (23:05 +0000)]
Objective-C qoi. When Objective-C pointer mismatches with
a qualified-id type because pointer is object of a forward
class declaration, include this info in a diagnostic note.
// rdar://10751015

llvm-svn: 211324

10 years agodiagtool: simplify TreeView diagnostic classification
Alp Toker [Thu, 19 Jun 2014 23:00:52 +0000 (23:00 +0000)]
diagtool: simplify TreeView diagnostic classification

This utility doesn't need to know about the specifics of diagnostic levels.

llvm-svn: 211323

10 years agoSet gold plugin options in a sane order.
Rafael Espindola [Thu, 19 Jun 2014 22:54:47 +0000 (22:54 +0000)]
Set gold plugin options in a sane order.

This fixes the  processing of --plugin-opt=-jump-table-type=arity.

Nice properties:
 * We call InitTargetOptionsFromCodeGenFlags once.
 * We call parseCodeGenDebugOptions once.
 * It works :-)

llvm-svn: 211322

10 years agoFix the output of llvm-nm for Mach-O files to use the characters ‘d’ and ‘b’ for
Kevin Enderby [Thu, 19 Jun 2014 22:49:21 +0000 (22:49 +0000)]
Fix the output of llvm-nm for Mach-O files to use the characters ‘d’ and ‘b’ for
data and bss symbols instead of the generic ’s’ for a symbol in a section.

llvm-svn: 211321

10 years agoSimplify. No functionality change.
Rafael Espindola [Thu, 19 Jun 2014 22:33:23 +0000 (22:33 +0000)]
Simplify. No functionality change.

Thanks to Alp Toker for noticing it.

llvm-svn: 211320

10 years agoUse the assignment operator.
Rafael Espindola [Thu, 19 Jun 2014 22:27:46 +0000 (22:27 +0000)]
Use the assignment operator.

No functionality change.

llvm-svn: 211319

10 years agoReduce indentation. No functionality change.
Rafael Espindola [Thu, 19 Jun 2014 22:20:07 +0000 (22:20 +0000)]
Reduce indentation. No functionality change.

llvm-svn: 211318

10 years agoSet missing options in LTOCodeGenerator::setTargetOptions.
Rafael Espindola [Thu, 19 Jun 2014 22:14:12 +0000 (22:14 +0000)]
Set missing options in LTOCodeGenerator::setTargetOptions.

Patch by Tom Roeder, I just added the test.

llvm-svn: 211317

10 years agoChange the output of llvm-nm and llvm-size for Mach-O universal files (aka
Kevin Enderby [Thu, 19 Jun 2014 22:03:18 +0000 (22:03 +0000)]
Change the output of llvm-nm and llvm-size for Mach-O universal files (aka
fat files) to print “ (for architecture XYZ)” for fat files with more than
one architecture to be like what the darwin tools do for fat files.

Also clean up the Mach-O printing of archive membernames in llvm-nm to use
the darwin form of "libx.a(foo.o)".

llvm-svn: 211316

10 years agoUse lib/LTO directly in the gold plugin.
Rafael Espindola [Thu, 19 Jun 2014 21:14:13 +0000 (21:14 +0000)]
Use lib/LTO directly in the gold plugin.

The tools/lto API is not the best choice for implementing a gold plugin. Among
other issues:

* It is an stable ABI. Old errors stay and we have to be really careful
  before adding new features.
* It has to support two fairly different linkers: gold and ld64.
* We end up with a plugin that depends on a shared lib, something quiet
  unusual in LLVM land.
* It hides LLVM. For some features in the gold plugin it would be really
  nice to be able to just get a Module or a GlobalValue.

This change is intended to be a very direct translation from the C API. It
will just enable other fixes and cleanups.

Tested with a LTO bootstrap on linux.

llvm-svn: 211315

10 years agoAdd a new subtarget hook for whether or not we'd like to enable
Eric Christopher [Thu, 19 Jun 2014 21:03:04 +0000 (21:03 +0000)]
Add a new subtarget hook for whether or not we'd like to enable
the atomic load linked expander pass to run for a particular
subtarget. This requires a check of the subtarget and so save
the TargetMachine rather than only TargetLoweringInfo and update
all callers.

llvm-svn: 211314

10 years agoProvide mul for IEEE quad. From GuanHong Liu.
Joerg Sonnenberger [Thu, 19 Jun 2014 20:34:03 +0000 (20:34 +0000)]
Provide mul for IEEE quad. From GuanHong Liu.

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

llvm-svn: 211313

10 years agoProvide add and sub for IEEE quad. From GuanHong Liu.
Joerg Sonnenberger [Thu, 19 Jun 2014 20:24:49 +0000 (20:24 +0000)]
Provide add and sub for IEEE quad. From GuanHong Liu.

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

llvm-svn: 211312

10 years agoInclude Threading.h instead of forward declaring a function.
Zachary Turner [Thu, 19 Jun 2014 20:20:03 +0000 (20:20 +0000)]
Include Threading.h instead of forward declaring a function.

Previously this led to a circular header dependency, but a recent
change has since removed this dependency, so the correct fix is
to simply include the header rather than forward declare.

llvm-svn: 211311

10 years agotest: Just check the VFS when testing module-dependency-dump
Justin Bogner [Thu, 19 Jun 2014 20:18:00 +0000 (20:18 +0000)]
test: Just check the VFS when testing module-dependency-dump

Checking the filesystem seems to be a bit unreliable. Limit the tests
to the VFS map for now.

llvm-svn: 211310

10 years agoAdd StringMap::insert(pair) consistent with the standard associative container concept.
David Blaikie [Thu, 19 Jun 2014 20:08:56 +0000 (20:08 +0000)]
Add StringMap::insert(pair) consistent with the standard associative container concept.

Patch by Agustín Bergé.

llvm-svn: 211309

10 years agoSince we're using DW_AT_string rather than DW_AT_strp for debug_info
Eric Christopher [Thu, 19 Jun 2014 20:00:13 +0000 (20:00 +0000)]
Since we're using DW_AT_string rather than DW_AT_strp for debug_info
for assembly files we can't depend on the offset within the section
after a string since it could be different between producers etc.
Relax these tests accordingly.

llvm-svn: 211308

10 years agoFix up a few formatting issues.
Eric Christopher [Thu, 19 Jun 2014 20:00:09 +0000 (20:00 +0000)]
Fix up a few formatting issues.

llvm-svn: 211307

10 years agoFrontend: Fix a typo
Justin Bogner [Thu, 19 Jun 2014 19:49:28 +0000 (19:49 +0000)]
Frontend: Fix a typo

llvm-svn: 211306

10 years agoRemove an incorrect fixme.
Rafael Espindola [Thu, 19 Jun 2014 19:45:25 +0000 (19:45 +0000)]
Remove an incorrect fixme.

dynamic-no-pic is just another output type. If gnu ld gets support for MachO,
it should also add something like LDPO_DYN_NO_PIC to the plugin interface.

llvm-svn: 211305

10 years agoFix typos
Alp Toker [Thu, 19 Jun 2014 19:41:26 +0000 (19:41 +0000)]
Fix typos

llvm-svn: 211304

10 years agoFrontend: Add a CC1 flag to dump module dependencies to a directory
Justin Bogner [Thu, 19 Jun 2014 19:36:03 +0000 (19:36 +0000)]
Frontend: Add a CC1 flag to dump module dependencies to a directory

This adds the -module-dependency-dir to clang -cc1, which specifies a
directory to copy all of a module's dependencies into in a form
suitable to be used as a VFS using -ivfsoverlay with the generated
vfs.yaml.

This is useful for crashdumps that involve modules, so that the module
dependencies will be intact when a crash report script is used to
reproduce a problem on another machine.

We currently encode the absolute path to the dump directory, due to
limitations in the VFS system. Until we can handle relative paths in
the VFS, users of the VFS map may need to run a simple search and
replace in the file.

llvm-svn: 211303

10 years agoSupport: Add llvm::sys::fs::copy_file
Justin Bogner [Thu, 19 Jun 2014 19:35:39 +0000 (19:35 +0000)]
Support: Add llvm::sys::fs::copy_file

A function to copy one file's contents to another.

llvm-svn: 211302

10 years agoRemove bogus configure check
David Greene [Thu, 19 Jun 2014 19:31:11 +0000 (19:31 +0000)]
Remove bogus configure check

Configure creates makefiles, so it doesn't make sense to check for
them to see if we can configure.

llvm-svn: 211301

10 years agoAdd option to keep flavor out of the install directory
David Greene [Thu, 19 Jun 2014 19:31:09 +0000 (19:31 +0000)]
Add option to keep flavor out of the install directory

Sometimes we want to install things in "standard" locations and the
flavor directories interfere with that.  Add an option to keep them
out of the install path.

llvm-svn: 211300

10 years agoTurn of -Werror by default
David Greene [Thu, 19 Jun 2014 19:31:05 +0000 (19:31 +0000)]
Turn of -Werror by default

Don't build with -Werror unless asked to.

llvm-svn: 211299

10 years agoFix this test a little harder - use llc_dwarf to make sure we don't
Eric Christopher [Thu, 19 Jun 2014 19:26:42 +0000 (19:26 +0000)]
Fix this test a little harder - use llc_dwarf to make sure we don't
try to execute it on windows.

llvm-svn: 211298

10 years agoRemove unused includes following r211294
Alp Toker [Thu, 19 Jun 2014 19:25:49 +0000 (19:25 +0000)]
Remove unused includes following r211294

llvm-svn: 211297

10 years agoTest commit: Correct type in two comments.
John Wolfe [Thu, 19 Jun 2014 19:21:53 +0000 (19:21 +0000)]
Test commit: Correct type in two comments.

llvm-svn: 211296

10 years agoFixed formatting.
Yaron Keren [Thu, 19 Jun 2014 19:12:02 +0000 (19:12 +0000)]
Fixed formatting.

llvm-svn: 211295

10 years agoUse the c++ APIs.
Rafael Espindola [Thu, 19 Jun 2014 19:11:22 +0000 (19:11 +0000)]
Use the c++ APIs.

No functionality change.

llvm-svn: 211294

10 years agoRelax this test a bit, we don't need the full contents of the
Eric Christopher [Thu, 19 Jun 2014 18:36:15 +0000 (18:36 +0000)]
Relax this test a bit, we don't need the full contents of the
frame section to match, just the version for this test.

llvm-svn: 211293

10 years agoFix PR20069: bad loop pragma arguments crash FE
Eli Bendersky [Thu, 19 Jun 2014 18:30:15 +0000 (18:30 +0000)]
Fix PR20069: bad loop pragma arguments crash FE

This patch fixes a crash when handling malformed arguments to loop pragmas such
as: "#pragma clang loop vectorize(()".  Essentially any argument which is not an
identifier or constant resulted in a crash.  This patch also changes a couple of
the error messages which weren't quite correct.  New behavior with this patch vs
old behavior:

#pragma clang loop vectorize(1)
OLD: error: missing keyword; expected 'enable' or 'disable'
NEW: error: invalid argument; expected 'enable' or 'disable'

#pragma clang loop vectorize()
OLD: error: expected ')'
NEW: error: missing argument to loop pragma 'vectorize'

#pragma clang loop vectorize_width(bad)
OLD: error: missing value; expected a positive integer value
NEW: error: invalid argument; expected a positive integer value

#pragma clang loop vectorize(bad)
OLD: invalid keyword 'bad'; expected 'enable' or 'disable'
NEW: error: invalid argument; expected 'enable' or 'disable'

http://reviews.llvm.org/D4197

Patch by Mark Heffernan

llvm-svn: 211292

10 years agoRemove use of removed function, llvm_stop_multithreading
David Blaikie [Thu, 19 Jun 2014 18:26:28 +0000 (18:26 +0000)]
Remove use of removed function, llvm_stop_multithreading

llvm-svn: 211291

10 years agoRemove circular header reference in Threading.h/Mutex.h
David Blaikie [Thu, 19 Jun 2014 18:26:26 +0000 (18:26 +0000)]
Remove circular header reference in Threading.h/Mutex.h

llvm-svn: 211290

10 years agoSwitch over to using object_getClass to get the class of an object. Previously we...
Jim Ingham [Thu, 19 Jun 2014 18:25:51 +0000 (18:25 +0000)]
Switch over to using object_getClass to get the class of an object.  Previously we were
directly accessing the isa pointer of a class object to get its meta-class, but the isa
pointers are not simple pointers on arm64, so this would cause the stepping to fail.
object_getClass does whatever magic needs doing in this case.

<rdar://problem/17239690>

llvm-svn: 211289

10 years agoFix build on non-Windows platforms.
Zachary Turner [Thu, 19 Jun 2014 18:25:06 +0000 (18:25 +0000)]
Fix build on non-Windows platforms.

llvm-svn: 211288

10 years agoRemove support for LLVM runtime multi-threading.
Zachary Turner [Thu, 19 Jun 2014 18:18:23 +0000 (18:18 +0000)]
Remove support for LLVM runtime multi-threading.

After a number of previous small iterations, the functions
llvm_start_multithreaded() and llvm_stop_multithreaded() have
been reduced essentially to no-ops.  This change removes them
entirely.

Reviewed by: rnk, dblaikie

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

llvm-svn: 211287

10 years agoDocument unroll and unroll_count directives.
Eli Bendersky [Thu, 19 Jun 2014 18:12:44 +0000 (18:12 +0000)]
Document unroll and unroll_count directives.

Extend the documentation for "#pragma clang loop" hints to include the unroll
and unroll_count directives.

Patch by Mark Heffernan [http://reviews.llvm.org/D4198]

llvm-svn: 211286

10 years agoDon't call llvm_start_multithreaded() during init. As of LLVM
Zachary Turner [Thu, 19 Jun 2014 18:03:56 +0000 (18:03 +0000)]
Don't call llvm_start_multithreaded() during init.  As of LLVM
revision r211277, this function is essentially a no-op.

llvm-svn: 211285

10 years agoDebugInfo: Fission: Ensure the address pool entries for location lists are emitted.
David Blaikie [Thu, 19 Jun 2014 17:59:14 +0000 (17:59 +0000)]
DebugInfo: Fission: Ensure the address pool entries for location lists are emitted.

The address pool was being emitted before location lists. The latter
could add more entries to the pool which would be lost/never emitted.

llvm-svn: 211284

10 years agoFixed up gdb-remote auxv regex issues with binary data.
Todd Fiala [Thu, 19 Jun 2014 17:35:40 +0000 (17:35 +0000)]
Fixed up gdb-remote auxv regex issues with binary data.
Fixes two causes for https://github.com/tfiala/lldb/issues/7.

1. Ensures the inferior program has started executing, by printing
a message on output first thing (per the "message:" command line arg)
and waiting for that text to arrive before doing any checks related
to auxv support.

2. Fixes up auxv-related regex patterns to be compiled with the Python
re.MULTILINE and re.DOTALL options.  The multiline is needed because
the binary data can include what look like newlines when interpreted
as text, and the DOTALL is needed to have the (.*) content portion match
newlines.

Added interrupt packet helper methods to add interrupt test sequence
packets and parse the results from them.

llvm-svn: 211283

10 years agoMCNullStreamer: assign file IDs to resolve crashes and errors
Alp Toker [Thu, 19 Jun 2014 17:15:36 +0000 (17:15 +0000)]
MCNullStreamer: assign file IDs to resolve crashes and errors

Use the MCStreamer base implementations for file ID tracking instead of
overriding them as no-ops.

Avoids assertions when streaming Dwarf debug info, and fixes ASM parsing of loc
and file directives.

llvm-svn: 211282

10 years ago[ValueTracking] Extend range metadata to call/invoke
Jingyue Wu [Thu, 19 Jun 2014 16:50:16 +0000 (16:50 +0000)]
[ValueTracking] Extend range metadata to call/invoke

Summary:
With this patch, range metadata can be added to call/invoke including
IntrinsicInst. Previously, it could only be added to load.

Rename computeKnownBitsLoad to computeKnownBitsFromRangeMetadata because
range metadata is not only used by load.

Update the language reference to reflect this change.

Test Plan:
Add several tests in range-2.ll to confirm the verifier is happy with
having range metadata on call/invoke.

Add two tests in AddOverFlow.ll to confirm annotating range metadata to
call/invoke can benefit InstCombine.

Reviewers: meheff, nlewycky, reames, hfinkel, eliben

Reviewed By: eliben

Subscribers: llvm-commits

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

llvm-svn: 211281

10 years agoUpdate for ScopStmt iterator name change in LLVM r210927
Tobias Grosser [Thu, 19 Jun 2014 16:45:04 +0000 (16:45 +0000)]
Update for ScopStmt iterator name change in LLVM r210927

Contributed-by: Yabin Hu <yabin.hwu@gmail.com>
llvm-svn: 211280

10 years agoTests for r211273
Oliver Stannard [Thu, 19 Jun 2014 16:35:19 +0000 (16:35 +0000)]
Tests for r211273

llvm-svn: 211279

10 years agoFix build
Johannes Doerfert [Thu, 19 Jun 2014 16:19:32 +0000 (16:19 +0000)]
Fix build

See r210927 and r210847

llvm-svn: 211278

10 years agoKill the LLVM global lock.
Zachary Turner [Thu, 19 Jun 2014 16:17:42 +0000 (16:17 +0000)]
Kill the LLVM global lock.

This patch removes the LLVM global lock, and updates all existing
users of the global lock to use their own mutex.    None of the
existing users of the global lock were protecting code that was
mutually exclusive with any of the other users of the global
lock, so its purpose was not being met.

Reviewed by: rnk

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

llvm-svn: 211277

10 years agoImprove robustness of tests for module flags metadata
Oliver Stannard [Thu, 19 Jun 2014 16:10:21 +0000 (16:10 +0000)]
Improve robustness of tests for module flags metadata

Fix clang tests to not break if the ID numbers of module flags metadata
nodes change.

llvm-svn: 211276

10 years agoEmit DWARF info for all code section in an assembly file
Oliver Stannard [Thu, 19 Jun 2014 15:52:37 +0000 (15:52 +0000)]
Emit DWARF info for all code section in an assembly file

Currently, when using llvm as an assembler, DWARF debug information is only
generated for the .text section. This patch modifies this so that DWARF info
is emitted for all executable sections.

llvm-svn: 211273

10 years agoEmit DWARF3 call frame information when DWARF3+ debug info is requested
Oliver Stannard [Thu, 19 Jun 2014 15:39:33 +0000 (15:39 +0000)]
Emit DWARF3 call frame information when DWARF3+ debug info is requested

Currently, llvm always emits a DWARF CIE with a version of 1, even when emitting
DWARF 3 or 4, which both support CIE version 3. This patch makes it emit the
newer CIE version when we are emitting DWARF 3 or 4. This will not reduce
compatibility, as we already emit other DWARF3/4 features, and is worth doing as
the DWARF3 spec removed some ambiguities in the interpretation of call frame
information.

It also fixes a minor bug where the "return address" field of the CIE was
encoded as a ULEB128, which is only valid when the CIE version is 3. There are
no test changes for this, because (as far as I can tell) none of the platforms
that we test have a return address register with a DWARF register number >127.

llvm-svn: 211272

10 years ago[mips] Implementation of dli.
Matheus Almeida [Thu, 19 Jun 2014 15:08:04 +0000 (15:08 +0000)]
[mips] Implementation of dli.

Patch by David Chisnall
His work was sponsored by: DARPA, AFRL

Some small modifications to the original patch: we now error if
it's not possible to expand an instruction (mips-expansions-bad.s has some
examples). Added some comments to the expansions.

llvm-svn: 211271

10 years agoFix assertion hit or bogus compiler error in cases when instantiating ObjC property...
Argyrios Kyrtzidis [Thu, 19 Jun 2014 14:45:16 +0000 (14:45 +0000)]
Fix assertion hit or bogus compiler error in cases when instantiating ObjC property accesses used with overloaded binary operators.

rdar://17153478

llvm-svn: 211270

10 years ago[mips] Small update to the logic behind the expansion of assembly pseudo instructions.
Matheus Almeida [Thu, 19 Jun 2014 14:39:14 +0000 (14:39 +0000)]
[mips] Small update to the logic behind the expansion of assembly pseudo instructions.

Summary:
The functions that do the expansion now return false on success and true otherwise. This is so
we can catch some errors during the expansion (e.g.: immediate too large). The next patch adds some test cases.

Reviewers: vmedic

Reviewed By: vmedic

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

llvm-svn: 211269

10 years agoUpdated comments as suggested by Rafael. Thanks.
Dinesh Dwivedi [Thu, 19 Jun 2014 14:11:53 +0000 (14:11 +0000)]
Updated comments as suggested by Rafael. Thanks.

llvm-svn: 211268

10 years ago[c++1z] Implement N3994: a range-based for loop can declare a variable with super...
Richard Smith [Thu, 19 Jun 2014 11:42:00 +0000 (11:42 +0000)]
[c++1z] Implement N3994: a range-based for loop can declare a variable with super-terse notation

  for (x : range) { ... }

which is equivalent to

  for (auto &&x : range) { ... }

llvm-svn: 211267

10 years agoAdded instruction combine to transform few more negative values addition to subtracti...
Dinesh Dwivedi [Thu, 19 Jun 2014 10:36:52 +0000 (10:36 +0000)]
Added instruction combine to transform few more negative values addition to subtraction (Part 1)
This patch enables transforms for following patterns.
  (x + (~(y & c) + 1)   -->   x - (y & c)
  (x + (~((y >> z) & c) + 1)   -->   x - ((y>>z) & c)

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

llvm-svn: 211266

10 years ago[X86] Teach how to combine horizontal binop even in the presence of undefs.
Andrea Di Biagio [Thu, 19 Jun 2014 10:29:41 +0000 (10:29 +0000)]
[X86] Teach how to combine horizontal binop even in the presence of undefs.

Before this change, the backend was unable to fold a build_vector dag
node with UNDEF operands into a single horizontal add/sub.

This patch teaches how to combine a build_vector with UNDEF operands into a
horizontal add/sub when possible. The algorithm conservatively avoids to combine
a build_vector with only a single non-UNDEF operand.

Added test haddsub-undef.ll to verify that we correctly fold horizontal binop
even in the presence of UNDEFs.

llvm-svn: 211265

10 years ago[sanitizer] Intercept pthread_*attr_get*.
Evgeniy Stepanov [Thu, 19 Jun 2014 10:19:57 +0000 (10:19 +0000)]
[sanitizer] Intercept pthread_*attr_get*.

This is a resubmit of r211166 reverted due to osx breakage.

llvm-svn: 211264

10 years ago[Mips] Make r26-1.test test case independent from external input files.
Simon Atanasyan [Thu, 19 Jun 2014 10:18:58 +0000 (10:18 +0000)]
[Mips] Make r26-1.test test case independent from external input files.

llvm-svn: 211263

10 years ago[OPENMP] Improved diagnostic messages for vars with the predetermined data sharing...
Alexey Bataev [Thu, 19 Jun 2014 09:13:45 +0000 (09:13 +0000)]
[OPENMP] Improved diagnostic messages for vars with the predetermined data sharing attributes and reformatting

llvm-svn: 211262

10 years agoRefactored and updated SimplifyUsingDistributiveLaws() to
Dinesh Dwivedi [Thu, 19 Jun 2014 08:29:18 +0000 (08:29 +0000)]
Refactored and updated SimplifyUsingDistributiveLaws() to
 * Find factorization opportunities using identity values.
 * Find factorization opportunities by treating shl(X, C) as mul (X, shl(C))
 * Keep NSW flag while simplifying instruction using factorization.

This fixes PR19263.

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

llvm-svn: 211261

10 years agoCommandLine: bail out when options get multiply registered
Alp Toker [Thu, 19 Jun 2014 07:25:25 +0000 (07:25 +0000)]
CommandLine: bail out when options get multiply registered

These errors are strictly unrecoverable and indicate serious issues such as
conflicting option names or an incorrectly linked LLVM distribution.

With this change, the errors actually get detected so tests don't pass
silently.

llvm-svn: 211260

10 years agoRemove OwningPtr.h and associated tests
Alp Toker [Thu, 19 Jun 2014 07:25:18 +0000 (07:25 +0000)]
Remove OwningPtr.h and associated tests

llvm::OwningPtr is superseded by std::unique_ptr.

llvm-svn: 211259

10 years agoInstCombine: Stop two transforms dueling
David Majnemer [Thu, 19 Jun 2014 07:14:33 +0000 (07:14 +0000)]
InstCombine: Stop two transforms dueling

InstCombineMulDivRem has:
// Canonicalize (X+C1)*CI -> X*CI+C1*CI.

InstCombineAddSub has:
// W*X + Y*Z --> W * (X+Z)  iff W == Y

These two transforms could fight with each other if C1*CI would not fold
away to something simpler than a ConstantExpr mul.

The InstCombineMulDivRem transform only acted on ConstantInts until
r199602 when it was changed to operate on all Constants in order to
let it fire on ConstantVectors.

To fix this, make this transform more careful by checking to see if we
actually folded away C1*CI.

This fixes PR20079.

llvm-svn: 211258

10 years agoMove -dwarf-version to an MC level command line option so it's
Eric Christopher [Thu, 19 Jun 2014 06:22:08 +0000 (06:22 +0000)]
Move -dwarf-version to an MC level command line option so it's
used by all of the MC level tools and codegen. Fix up all uses
in the compiler to use this and set it on the context accordingly.

llvm-svn: 211257

10 years agoRemove unnecessary include.
Eric Christopher [Thu, 19 Jun 2014 06:22:05 +0000 (06:22 +0000)]
Remove unnecessary include.

llvm-svn: 211256

10 years ago80-column fixups.
Eric Christopher [Thu, 19 Jun 2014 06:22:01 +0000 (06:22 +0000)]
80-column fixups.

llvm-svn: 211255

10 years agoConvert some assert(0) to llvm_unreachable or fold an 'if' condition into the assert.
Craig Topper [Thu, 19 Jun 2014 06:10:58 +0000 (06:10 +0000)]
Convert some assert(0) to llvm_unreachable or fold an 'if' condition into the assert.

llvm-svn: 211254

10 years agoR600: Add a few tests I forgot to add.
Matt Arsenault [Thu, 19 Jun 2014 04:24:43 +0000 (04:24 +0000)]
R600: Add a few tests I forgot to add.

These belong with r210827

llvm-svn: 211253

10 years agoMove optimization of some cases of (A & C1)|(B & C2) from instcombine to instsimplify...
Nick Lewycky [Thu, 19 Jun 2014 03:51:46 +0000 (03:51 +0000)]
Move optimization of some cases of (A & C1)|(B & C2) from instcombine to instsimplify. Patch by Rahul Jain, plus some last minute changes by me -- you can blame me for any bugs.

llvm-svn: 211252

10 years agoMake instsimplify's analysis of icmp eq/ne use computeKnownBits to determine whether...
Nick Lewycky [Thu, 19 Jun 2014 03:35:49 +0000 (03:35 +0000)]
Make instsimplify's analysis of icmp eq/ne use computeKnownBits to determine whether the icmp is always true or false. Patch by Suyog Sarda!

llvm-svn: 211251

10 years agoRemove redundant code in InstCombineShift, no functionality change because instsimpli...
Nick Lewycky [Thu, 19 Jun 2014 03:28:28 +0000 (03:28 +0000)]
Remove redundant code in InstCombineShift, no functionality change because instsimplify already does this and instcombine calls instsimplify a few lines above. Patch by Suyog Sarda!

llvm-svn: 211250

10 years agoMS asm: Properly handle quoted symbol names
David Majnemer [Thu, 19 Jun 2014 01:25:43 +0000 (01:25 +0000)]
MS asm: Properly handle quoted symbol names

We would get confused by '@' characters in symbol names, we would
mistake the text following them for the variant kind.

When an identifier a string, the variant kind will never show up inside
of it.  Instead, check to see if there is a variant following the
string.

This fixes PR19965.

llvm-svn: 211249

10 years agoDiagnoseUnknownTypename always emits a diagnostic and returns true
Reid Kleckner [Thu, 19 Jun 2014 01:23:22 +0000 (01:23 +0000)]
DiagnoseUnknownTypename always emits a diagnostic and returns true

Make it return void and delete the dead code in the parser that handled
the case where it might return false.  This has been dead since 2010
when John deleted Action.h.

llvm-svn: 211248

10 years agoR600/SI: Add intrinsics for various math instructions.
Matt Arsenault [Thu, 19 Jun 2014 01:19:19 +0000 (01:19 +0000)]
R600/SI: Add intrinsics for various math instructions.

These will be used for custom lowering and for library
implementations of various math functions, so it's useful
to expose these as builtins.

llvm-svn: 211247

10 years agoFix breakage from r211244 by using LLVM_EXPLICIT to avoid using explicit operators...
David Blaikie [Thu, 19 Jun 2014 01:09:49 +0000 (01:09 +0000)]
Fix breakage from r211244 by using LLVM_EXPLICIT to avoid using explicit operators under MSVC where they're not supported.

llvm-svn: 211246

10 years agoUnbreak the build after r211244.
David Blaikie [Thu, 19 Jun 2014 00:43:19 +0000 (00:43 +0000)]
Unbreak the build after r211244.

These operator overloads were unneeded (once the const correctness in
PooledStringPtr was corrected) and inefficient (since the strings are
pooled the pointers can just be compared for equality instead of doing
strcmp).

llvm-svn: 211245

10 years agoPR10140 - StringPool's PooledStringPtr has non-const operator== causing bad OR-result.
Nikola Smiljanic [Thu, 19 Jun 2014 00:26:49 +0000 (00:26 +0000)]
PR10140 - StringPool's PooledStringPtr has non-const operator== causing bad OR-result.

Mark conversion operator explicit and const qualify comparison operators.

llvm-svn: 211244

10 years agoObjective-C ARC. Allow conversion of (void*) pointers to
Fariborz Jahanian [Wed, 18 Jun 2014 23:52:49 +0000 (23:52 +0000)]
Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
in the context of pointer comparison as this is in effect
a +0 context. // rdar://16627903

llvm-svn: 211243

10 years agoActually make a real scoped locker rather than constructing one that gets immediately...
Jim Ingham [Wed, 18 Jun 2014 23:40:13 +0000 (23:40 +0000)]
Actually make a real scoped locker rather than constructing one that gets immediately thrown away...

llvm-svn: 211242

10 years agoAdd a lock in the UnwindTable class so two Targets won't try
Jason Molenda [Wed, 18 Jun 2014 23:32:53 +0000 (23:32 +0000)]
Add a lock in the UnwindTable class so two Targets won't try
to modify the same UnwindTable object simultaneously.  Fix
HistoryThread and HistoryUnwind's mutex lock acqusition to
retain the lock for the duration of the operation instead of
releasing the temporary immediately.
<rdar://problem/17055023>

llvm-svn: 211241

10 years agoSema: Static redeclaration after extern declarations is a Microsoft Extension
David Majnemer [Wed, 18 Jun 2014 23:26:25 +0000 (23:26 +0000)]
Sema: Static redeclaration after extern declarations is a Microsoft Extension

CL permits static redeclarations to follow extern declarations.  The
storage specifier on the latter declaration has no effect.

This fixes PR20034.

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

llvm-svn: 211238

10 years agoObjective-C. Revert my patch in r211234.
Fariborz Jahanian [Wed, 18 Jun 2014 23:22:38 +0000 (23:22 +0000)]
Objective-C. Revert my patch in r211234.

llvm-svn: 211237

10 years agoMissing reduction detection test cases
Johannes Doerfert [Wed, 18 Jun 2014 23:08:14 +0000 (23:08 +0000)]
Missing reduction detection test cases

llvm-svn: 211235

10 years agoObjective-C ARC. Allow conversion of (void*) pointers to
Fariborz Jahanian [Wed, 18 Jun 2014 22:50:40 +0000 (22:50 +0000)]
Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
by recognizing this as a +0 context. // rdar://16627903

llvm-svn: 211234

10 years agoMove ARMJITInfo off of the TargetMachine and down onto the subtarget.
Eric Christopher [Wed, 18 Jun 2014 22:48:09 +0000 (22:48 +0000)]
Move ARMJITInfo off of the TargetMachine and down onto the subtarget.
This required untangling a mess of headers that included around.

This a recommit of r210953 with a fix for the removed accessor
for JITInfo.

llvm-svn: 211233

10 years agoUse stdint macros for specifying size of constants
Matt Arsenault [Wed, 18 Jun 2014 22:11:03 +0000 (22:11 +0000)]
Use stdint macros for specifying size of constants

llvm-svn: 211231

10 years agoTeach llvm-size to know about Mach-O universal files (aka fat files) and
Kevin Enderby [Wed, 18 Jun 2014 22:04:40 +0000 (22:04 +0000)]
Teach llvm-size to know about Mach-O universal files (aka fat files) and
fat files containing archives.

Also fix a bug in MachOUniversalBinary::ObjectForArch::ObjectForArch()
where it needed a >= when comparing the Index with the number of
objects in a fat file.  As the index starts at 0.

llvm-svn: 211230

10 years agoR600: Handle fnearbyint
Matt Arsenault [Wed, 18 Jun 2014 22:03:45 +0000 (22:03 +0000)]
R600: Handle fnearbyint

The difference from rint isn't really relevant here,
so treat them as equivalent. OpenCL doesn't have nearbyint,
so this is sort of pointless other than for completeness.

llvm-svn: 211229

10 years agoR600/SI: add gather4 and getlod intrinsics (v3)
Marek Olsak [Wed, 18 Jun 2014 22:00:29 +0000 (22:00 +0000)]
R600/SI: add gather4 and getlod intrinsics (v3)

This contains all the previous patches + getlod support on top of it.
It doesn't use SDNodes anymore, so it's quite small.
It also adds v16i8 to SReg_128, which is used for the sampler descriptor.

Reviewed-by: Tom Stellard
llvm-svn: 211228

10 years agotests: relax ms-intrinsics test
Saleem Abdulrasool [Wed, 18 Jun 2014 21:48:44 +0000 (21:48 +0000)]
tests: relax ms-intrinsics test

Relax the tests to allow for differences between release and debug builds.  This
should fix the buildbots.

Thanks to Benjamin Kramer and Eric Christo for their invaluable tip that this
was release build specific issue.

llvm-svn: 211227

10 years agoUse LL suffix for literal that should be 64-bits.
Matt Arsenault [Wed, 18 Jun 2014 21:40:43 +0000 (21:40 +0000)]
Use LL suffix for literal that should be 64-bits.

This hopefully fixes Windows

llvm-svn: 211225

10 years agoRelax the cl-inputs.c test a little bit in case link.exe is on PATH
Reid Kleckner [Wed, 18 Jun 2014 21:34:36 +0000 (21:34 +0000)]
Relax the cl-inputs.c test a little bit in case link.exe is on PATH

llvm-svn: 211224

10 years ago[MS-ABI] Implement typeid
Warren Hunt [Wed, 18 Jun 2014 21:15:55 +0000 (21:15 +0000)]
[MS-ABI] Implement typeid
This patch enables clang to generate calls to __RTtypeid when lowering
typeid on win32 targets.  Test cases are included.

llvm-svn: 211223

10 years agoAdd a symbols() range and use a range loop.
Rafael Espindola [Wed, 18 Jun 2014 21:14:57 +0000 (21:14 +0000)]
Add a symbols() range and use a range loop.

llvm-svn: 211222

10 years agoSimplify code.
Rafael Espindola [Wed, 18 Jun 2014 21:08:17 +0000 (21:08 +0000)]
Simplify code.

We can delete the objects earlier now that we are copying the names to a buffer.

llvm-svn: 211221

10 years agoMC: do not add comment string to the AsmToken in AsmLexer::LexLineComment
Saleem Abdulrasool [Wed, 18 Jun 2014 20:57:32 +0000 (20:57 +0000)]
MC: do not add comment string to the AsmToken in AsmLexer::LexLineComment

Fixes macros with varargs if the macro instantiation has a trailing comment.

Patch by Janne Grunau!

llvm-svn: 211219

10 years agoMCAsmParser: full support for gas' '.if{cond} expression' directives
Saleem Abdulrasool [Wed, 18 Jun 2014 20:57:28 +0000 (20:57 +0000)]
MCAsmParser: full support for gas' '.if{cond} expression' directives

Patch by Janne Grunau!

llvm-svn: 211218

10 years agoCodeGen: improve ms instrincics support
Saleem Abdulrasool [Wed, 18 Jun 2014 20:51:10 +0000 (20:51 +0000)]
CodeGen: improve ms instrincics support

Add support for _InterlockedCompareExchangePointer, _InterlockExchangePointer,
_InterlockExchange.  These are available as a compiler intrinsic on ARM and x86.
These are used directly by the Windows SDK headers without use of the intrin
header.

llvm-svn: 211216