Commit Graph

2494 Commits

Author SHA1 Message Date
Easwaran Raman
7be6f15432 Remove interface to get/set MaxFunctionCount
Differential revision: http://reviews.llvm.org/D19185


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273203 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-20 21:36:38 +00:00
Matt Arsenault
96ad9ea23d Generalize DiagnosticInfoStackSize to support other limits
Backends may want to report errors on resources other than
stack size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273177 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-20 18:13:04 +00:00
Sanjay Patel
e5e5a82f84 fix formatting, typo; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273118 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-19 17:20:27 +00:00
Simon Pilgrim
e2e7d46a44 [X86][SSE4A] Autoupgrade and remove MOVNTSD/MOVNTSS intrinsics
Required better annotation of the instruction defs upon removal of the builtin intrinsic pattern.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273077 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-18 02:38:26 +00:00
Reid Kleckner
a450edf8b9 [codeview] Add DIFlags for pointer to member representations
Summary:
This seems like the least intrusive way to pass this information
through.

Fixes PR28151

Reviewers: majnemer, aprantl, dblaikie

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273053 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 21:31:33 +00:00
Davide Italiano
d2e7196d0a [Codegen] Change PICLevel.
We convert `Default` to `NotPIC` so that target independent code
can reason about this correctly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273024 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 18:07:14 +00:00
Chandler Carruth
bd6882c677 [PM] Run clang-format over various parts of the new pass manager code
prior to some very substantial patches to isolate any formatting-only
changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272991 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 07:15:29 +00:00
Chandler Carruth
04d0fe9c10 [PM] Remove support for omitting the AnalysisManager argument to new
pass manager passes' `run` methods.

This removes a bunch of SFINAE goop from the pass manager and just
requires pass authors to accept `AnalysisManager<IRUnitT> &` as a dead
argument. This is a small price to pay for the simplicity of the system
as a whole, despite the noise that changing it causes at this stage.

This will also helpfull allow us to make the signature of the run
methods much more flexible for different kinds af passes to support
things like intelligently updating the pass's progression over IR units.

While this touches many, many, files, the changes are really boring.
Mostly made with the help of my trusty perl one liners.

Thanks to Sean and Hal for bouncing ideas for this with me in IRC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272978 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 00:11:01 +00:00
Sanjay Patel
a240c3eb0e [x86] autoupgrade and remove AVX2 integer min/max intrinsics
This will (hopefully very temporarily) break clang.
The clang side of this should be the next commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272932 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 18:44:20 +00:00
Sanjay Patel
2c8c45d695 [x86] autoupgrade and remove SSE2/SSE41 integer min/max intrinsics
Follow-up to:
http://reviews.llvm.org/rL272806
http://reviews.llvm.org/rL272807


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272907 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 15:48:30 +00:00
Justin Lebar
60cc4971e1 [IR] [DAE] Copy comdats during DAE, and don't copy comdats in GlobalObject::copyAttributesFrom.
Summary: This reverts the changes to Globals.cpp and IRMover.cpp in
"[IR] Copy comdats in GlobalObject::copyAttributesFrom" (D20631,
rL270743).

The DeadArgElim test is left unchanged, and we change DAE to explicitly
copy comdats.

The reverted change breaks copyAttributesFrom when the destination lives
in a different module from the source.  The decision in D21255 was to
revert this patch and handle comdat copying separately from
copyAttributesFrom.

Reviewers: majnemer, rnk

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272855 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-15 23:20:15 +00:00
Sanjay Patel
2514d4ab55 fix comments; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272848 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-15 22:01:28 +00:00
Amaury Sechet
a2f727daf6 Add support for string attributes in the C API.
Summary: As per title. This completes the C API Attribute support.

Reviewers: Wallbraker, whitequark, echristo, rafael, jyknight

Subscribers: mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272811 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-15 17:50:39 +00:00
Aaron Ballman
0774f89723 Add llvm_unreachable to silence a "not all control paths" false positive warning from MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272793 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-15 15:27:53 +00:00
Amaury Sechet
4e14c8337b Add support for callsite in the new C API for attributes
Summary: The second consumer of attributes.

Reviewers: Wallbraker, whitequark, echristo, rafael, jyknight

Subscribers: mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272754 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-15 05:14:29 +00:00
Peter Collingbourne
cf9e0af1ce Verifier: check that functions have at most a single !prof attachment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272734 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 23:13:15 +00:00
Amaury Sechet
8da6b784a1 Remove unused import. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272731 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 22:30:50 +00:00
Amaury Sechet
aac9882be6 Rename AttributeSetImpl::NumAttrs and AttributeSetImpl::getNumAttributes to reflect that they work on slots rather than attributes. NFC
Summary: The current naming not only doesn't convey the meaning of what this does, but worse, it convey the wrong meaning. This was a major source of confusion understanding the code, so I'm applying the boy scout rule here and making it better after I leave.

Reviewers: void, bkramer, whitequark

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272725 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 22:04:16 +00:00
Peter Collingbourne
63b34cdf34 IR: Introduce local_unnamed_addr attribute.
If a local_unnamed_addr attribute is attached to a global, the address
is known to be insignificant within the module. It is distinct from the
existing unnamed_addr attribute in that it only describes a local property
of the module rather than a global property of the symbol.

This attribute is intended to be used by the code generator and LTO to allow
the linker to decide whether the global needs to be in the symbol table. It is
possible to exclude a global from the symbol table if three things are true:
- This attribute is present on every instance of the global (which means that
  the normal rule that the global must have a unique address can be broken without
  being observable by the program by performing comparisons against the global's
  address)
- The global has linkonce_odr linkage (which means that each linkage unit must have
  its own copy of the global if it requires one, and the copy in each linkage unit
  must be the same)
- It is a constant or a function (which means that the program cannot observe that
  the unique-address rule has been broken by writing to the global)

Although this attribute could in principle be computed from the module
contents, LTO clients (i.e. linkers) will normally need to be able to compute
this property as part of symbol resolution, and it would be inefficient to
materialize every module just to compute it.

See:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160509/356401.html
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160516/356738.html
for earlier discussion.

Part of the fix for PR27553.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272709 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 21:01:22 +00:00
Amaury Sechet
3564e5c13d Make sure attribute kind and attributes are named respectively Kind and Attr consistently. Historically they used to be the same the terminology is very confused in the codebase. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272704 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 20:27:35 +00:00
Craig Topper
dbd262941c [AVX512] Remove maksed pshufd, pshuflw, and phufhw intrinsics and autoupgrade them to selects and shufflevector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272527 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-13 02:36:48 +00:00
Craig Topper
26778f96df [X86] Refactor some of the X86 autoupgrade code to split mask vector and select generation into routines that can be reused for future intrinsic upgrades. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272526 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-13 02:36:42 +00:00
Benjamin Kramer
d92b0de878 Use 'auto' to avoid implicit copies.
td_type is std::pair<std::string, std::string>, but the map returns
elements of std::pair<const std::string, std::string>. In well-designed
languages like C++ that yields an implicit copy perfectly hidden by
constref's lifetime extension. Just use auto, the typedef obscured the
real type anyways.

Found with a little help from clang-tidy's
performance-implicit-cast-in-loop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272519 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-12 19:02:34 +00:00
Benjamin Kramer
8fc5df7092 [Verifier] Simplify code. No functionality change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272517 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-12 17:46:23 +00:00
Craig Topper
b2cfb64e72 [X86] Remove sse2 pshufd/pshuflw/pshufhw intrinsics and upgrade them to shufflevector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272510 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-12 14:11:32 +00:00
Amaury Sechet
58fd93ad90 Change () to (void) in the C API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272506 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-12 07:56:21 +00:00
Amaury Sechet
ca669104bf Make sure we have a Add/Remove/Has function for various thing that can have attribute.
Summary: This also deprecated the get attribute function familly.

Reviewers: Wallbraker, whitequark, joker.eph, echristo, rafael, jyknight

Subscribers: axw, joker.eph, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272504 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-12 06:17:24 +00:00
Craig Topper
fa4b4ced7f [X86] Pre-allocate some of the shuffle mask SmallVectors in the auto upgrade code instead of calling push_back in a loop. This removes the need to check if the vector needs to grow on each iteration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272501 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-12 04:48:00 +00:00
Craig Topper
44d1e38210 [X86] Greatly simplify the llvm.x86.avx.vpermil.* auto-upgrade code. We can fully derive everything using types of the intrinsic arguments rather than writing separate loops for each intrinsic. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272496 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-12 03:10:47 +00:00
Craig Topper
482bba0fb3 [X86,IR] Make use of the CreateShuffleVector form that takes an ArrayRef<uint32_t> to avoid the need to manually create a bunch of Constants and a ConstantVector. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272493 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-12 01:05:59 +00:00
Craig Topper
e2cf2e02a7 [IR] Require ArrayRef of 'uint32_t' instead of 'int' for the mask argument for one of the signatures of CreateShuffleVector. This better emphasises that you can't use it for the -1 as undef behavior.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272491 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-12 00:41:19 +00:00
Sanjoy Das
285b85b96e [STLExtras] Introduce and use llvm::count_if; NFC
(This is split out from was D21115)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272435 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-10 21:18:39 +00:00
Simon Pilgrim
3ddec70a78 [X86][AVX512] Dropped avx512 VPSLLDQ/VPSRLDQ intrinsics
Auto-upgrade to generic shuffles like sse/avx2 implementations now that we can lower to VPSLLDQ/VPSRLDQ 

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272308 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09 21:09:03 +00:00
Reid Kleckner
3d3aca2d97 [DebugInfo] Add calling convention support for DWARF and CodeView
Summary:
Now DISubroutineType has a 'cc' field which should be a DW_CC_ enum.  If
it is present and non-zero, the backend will emit it as a
DW_AT_calling_convention attribute. On the CodeView side, we translate
it to the appropriate enum for the LF_PROCEDURE record.

I added a new LLVM vendor specific enum to the list of DWARF calling
conventions. DWARF does not appear to attempt to standardize these, so I
assume it's OK to do this until we coordinate with GCC on how to emit
vectorcall convention functions.

Reviewers: dexonsmith, majnemer, aaboud, amccarth

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272197 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 20:34:29 +00:00
Benjamin Kramer
04a303b821 Avoid copies of std::strings and APInt/APFloats where we only read from it
As suggested by clang-tidy's performance-unnecessary-copy-initialization.
This can easily hit lifetime issues, so I audited every change and ran the
tests under asan, which came back clean.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272126 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 10:01:20 +00:00
Peter Collingbourne
052c9ee80b Verifier: Simplify and fix issue where we were not verifying unmaterialized functions.
Arrange to call verify(Function &) on each function, followed by
verify(Module &), whether the verifier is being used from the pass or
from verifyModule(). As a side effect, this fixes an issue that caused
us not to call verify(Function &) on unmaterialized functions from
verifyModule().

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271956 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 23:21:27 +00:00
Peter Collingbourne
6510b62554 Verifier: Remove dead code.
Remove previously unreachable code that verifies that a function definition has
an entry block. By definition, a function definition has at least one block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271948 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 22:32:52 +00:00
Craig Topper
6dbfac925f [AVX512] Remove masked palignr intrinsics and auto-upgrade them to native IR of vector shuffle and select.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271872 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 06:12:54 +00:00
Nick Lewycky
1947c7cca1 Fix spelling and capitalization in comments. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271862 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 01:51:23 +00:00
Easwaran Raman
7ef349f4f7 Reapply r271728 after adding move cobstructor for ProfileSummaryInfo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271745 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 22:54:26 +00:00
Easwaran Raman
b920b27660 Revert r271728 as it breaks Windows build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271738 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 21:14:26 +00:00
Easwaran Raman
f22c11f6fb Analysis pass to access profile summary info
Differential Revision: http://reviews.llvm.org/D20648


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271728 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 20:37:19 +00:00
Simon Pilgrim
f940424957 [X86][XOP] Support for VPERMIL2PD/VPERMIL2PS 2-input shuffle instructions
This patch begins adding support for lowering to the XOP VPERMIL2PD/VPERMIL2PS shuffle instructions - adding the X86ISD::VPERMIL2 opcode and cleaning up the usage.

The internal llvm intrinsics were assuming the shuffle mask operand was the same type as the float/double input operands (I guess to simplify the intrinsic definitions in X86InstrXOP.td to a single value type). These needed changing to integer types (matching the clang builtin and the AMD intrinsics definitions), an auto upgrade path is added to convert old calls.

Mask decoding/target shuffle support will be added in future patches.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271633 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 08:06:03 +00:00
Sanjay Patel
d6b7d70dad fix documentation comments; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271584 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 20:37:52 +00:00
Simon Pilgrim
22d789345f [X86][SSE] Replace (V)CVTTPS2DQ and VCVTTPD2DQ truncating (round to zero) f32/f64 to i32 with generic IR (llvm)
This patch removes the llvm intrinsics (V)CVTTPS2DQ and VCVTTPD2DQ truncation (round to zero) conversions and auto-upgrades to FP_TO_SINT calls instead.

Note: I looked at updating CVTTPD2DQ as well but this still requires a lot more work to correctly lower.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271510 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 10:55:21 +00:00
Craig Topper
11a12c2c07 [AVX512] Remove masked load intrinsics. Clang now emits generic masked load intrinsics instead.
The intrinsics will be autoupgraded to the same generic masked loads.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271478 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 04:19:36 +00:00
Sanjoy Das
ca4fdcc423 Remove Value::isPointerDereferenceable; NFCI
... and merge into `Value::getPointerDereferenceableBytes`. This was
suggested by Artur Pilipenko in D20764 -- since we no longer allow loads
of unsized types, there is no need anymore to have this special logic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271455 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 00:52:48 +00:00
Sanjoy Das
da6ed23fe1 [IR] Disallow loading and storing unsized types
Summary:
It isn't clear what is the operational meaning of loading or storing an
unsized types, since it cannot be lowered into something meaningful.
Since there does not seem to be any practical need for it either, make
such loads and stores illegal IR.

Reviewers: majnemer, chandlerc

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271402 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-01 16:13:10 +00:00
Craig Topper
323e9f1870 Revert r271362 "[AVX512] Remove masked load intrinsics. Clang now emits generic masked load intrinsics instead."
Looks like something isn't quite right still. Also forgot to move the test cases to an autoupgrade test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271363 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-01 05:57:55 +00:00
Craig Topper
c1bee8aab0 [AVX512] Remove masked load intrinsics. Clang now emits generic masked load intrinsics instead.
The intrinsics will be autoupgraded to the same generic masked loads.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271362 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-01 05:35:16 +00:00
Peter Collingbourne
d8d85ac3c9 IR: Allow multiple global metadata attachments with the same type.
This will be necessary to allow the global merge pass to attach
multiple debug info metadata nodes to global variables once we reverse
the edge from DIGlobalVariable to GlobalVariable.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271358 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-01 01:17:57 +00:00
Peter Collingbourne
6aef9f9248 Add support for metadata attachments for global variables.
This patch adds an IR, assembly and bitcode representation for metadata
attachments for globals. Future patches will port existing features to use
these new attachments.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271348 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31 23:01:54 +00:00
Craig Topper
acc7ed7b83 [AVX512] Remove masked store intrinsics. Clang now emits generic masked store intrinsics instead.
The intrinsics will be autoupgraded to the same generic masked stores.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271245 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31 01:50:02 +00:00
Craig Topper
2463f3bdaa [X86] Remove SSE/AVX unaligned store intrinsics as clang no longer uses them. Auto upgrade to native unaligned store instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271236 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-30 23:15:56 +00:00
Craig Topper
e55c354dcc [X86] Simplify and remove some unnecessary auto-upgrade code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271233 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-30 22:54:12 +00:00
Craig Topper
c7654447f7 [X86] Reduce the number of string compares in the autoupgrade logic by checking more prefixes instead of complete matches.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271232 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-30 22:54:05 +00:00
Benjamin Kramer
ac307e44e3 Remove some 'const' specifiers that do nothing but prevent moving the argument.
Found by clang-tidy's misc-move-const-arg. While there drop some
obsolete c_str() calls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271181 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-29 10:46:35 +00:00
Craig Topper
fab36bcca4 [X86] Simplify some of the autoupgrade code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271174 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-29 06:37:33 +00:00
Craig Topper
159551729d [IR] Teach the ArrayRef<int> form of IRBuilder::CreateShuffleVector to use ConstantDataVector.
This will be used in a follow up commit to simplify code in clang that creates a ConstantDataVector and calls the other form.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271164 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-29 02:39:20 +00:00
Simon Pilgrim
687467768e [X86][SSE] (Reapplied) Replace (V)PMOVSX and (V)PMOVZX integer extension intrinsics with generic IR (llvm)
This patch removes the llvm intrinsics VPMOVSX and (V)PMOVZX sign/zero extension intrinsics and auto-upgrades to SEXT/ZEXT calls instead. We already did this for SSE41 PMOVSX sometime ago so much of that implementation can be reused.

Reapplied now that the the companion patch (D20684) removes/auto-upgrade the clang intrinsics has been committed.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271131 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-28 18:03:41 +00:00
Pete Cooper
90a2421c29 Don't generate unnecessary signed ConstantRange during multiply. NFC
r231483 taught ConstantRange::multiply to be clever about signed vs unsigned ranges. For example, an unsigned range could be full-set while the signed range is more specific than that.

In looking at the allocations trace for LTO'ing verify-uselistorder (see r236629 for details), millions of allocations are from APInt, many of which come from ConstantRange's.

This change tries to avoid some (3.2 million) allocations by returning the unsigned range if its suitable. The checks here are that it should not be a wrapping range, and should be positive. That should be enough to check for ranges such as [1, 10) which the signed range will be equal to, if we were to calculate it.

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

Reviewed by James Molloy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271020 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 17:06:50 +00:00
Simon Pilgrim
3808026456 Revert: r270973 - [X86][SSE] Replace (V)PMOVSX and (V)PMOVZX integer extension intrinsics with generic IR (llvm)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270976 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 09:02:25 +00:00
Simon Pilgrim
337a02bbe0 [X86][SSE] Replace (V)PMOVSX and (V)PMOVZX integer extension intrinsics with generic IR (llvm)
This patch removes the llvm intrinsics VPMOVSX and (V)PMOVZX sign/zero extension intrinsics and auto-upgrades to SEXT/ZEXT calls instead. We already did this for SSE41 PMOVSX sometime ago so much of that implementation can be reused.

A companion patch (D20684) removes/auto-upgrade the clang intrinsics.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270973 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 08:49:15 +00:00
Adam Nemet
b09e1d33f6 [ConstantFold] NFC cleanup after previous change.
Merge two conditions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270827 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 07:08:09 +00:00
Adam Nemet
8a41a5d16f [ConstantFold] Fix incorrect index rewrites for GEPs
Summary:
If an index for a vector or array type is out-of-range GEP constant
folding tries to factor it into preceding dimensions.  The code however
does not consider addressing of structure field padding which should not
qualify as out-of-range index.

As demonstrated by the testcase, this can occur if the indexing
performed on a vector type and the preceding index is an array type.

SROA generates GEPs for example involving padding bytes as it slices an
alloca.

My fix disables this folding if the element type is a vector type.  I
believe that this is the only way we can end up with padding.  (We have
no access to DataLayout so I am not sure if there is actual robust way
of actually checking the presence of padding.)

Reviewers: majnemer

Subscribers: llvm-commits, Gerolf

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270826 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 07:08:05 +00:00
Manman Ren
b9f73597f6 Objective-C Class Properties: Autoupgrade "Class Properties" module flag.
When we have "Image Info Version" module flag but don't have "Class Properties"
module flag, set "Class Properties" module flag to 0, so we can correctly emit
errors when one module has the flag set and another module does not.

rdar://26469641


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270791 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 23:14:48 +00:00
Adrian Prantl
b28eca74ff Port the strip-invalid-debuginfo logic to the legacy verifier pass, too.
Since r268966 the modern Verifier pass defaults to stripping invalid debug info
in nonasserts builds.  This patch ports this behavior back to the legacy
Verifier pass as well.  The primary motivation is that the clang frontend
accepts bitcode files as input but is still using the legacy pass pipeline.

Background: The problem I'm trying to solve with this sequence of patches is
that historically we've done a really bad job at verifying debug info. We want
to be able to make the verifier stricter without having to worry about breaking
bitcode compatibility with existing producers. For example, we don't necessarily
want IR produced by an older version of clang to be rejected by an LTO link just
because of malformed debug info, and rather provide an option to strip it. Note
that merely outdated (but well-formed) debug info would continue to be
auto-upgraded in this scenario.

http://reviews.llvm.org/D20629
<rdar://problem/26448800>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270768 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 21:33:20 +00:00
Reid Kleckner
6dc628ff61 [IR] Copy comdats in GlobalObject::copyAttributesFrom
This is probably correct for all uses except cross-module IR linking,
where we need to move the comdat from the source module to the
destination module.

Fixes PR27870.

Reviewers: majnemer

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270743 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 18:36:22 +00:00
Simon Pilgrim
e3a40ed873 [X86][SSE] Replace (V)CVTDQ2PD(Y) and (V)CVTPS2PD(Y) lossless conversion intrinsics with generic IR
Followup to D20528 clang patch, this removes the (V)CVTDQ2PD(Y) and (V)CVTPS2PD(Y) llvm intrinsics and auto-upgrades to sitofp/fpext instead.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270678 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 08:59:18 +00:00
Craig Topper
c333e16d8d [X86] Remove the llvm.x86.sse2.storel.dq intrinsic. It hasn't been used in a long time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270677 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 06:56:32 +00:00
Amaury Sechet
000b227286 Extract renaming from D19181
Summary: This needs to get in before anything is released concerning attribute. If the old name gets in the wild, then we are stuck with it forever. Putting it in its own diff should getting that part at least in fast.

Reviewers: Wallbraker, whitequark, joker.eph, echristo, rafael, jyknight

Subscribers: llvm-commits, joker.eph

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270452 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-23 16:38:25 +00:00
Alexander Potapenko
1c9f2a9b43 [InlineAsm] Avoid creating extra string instances in ConstraintInfo::Parse()
Don't create unnecessary std::string objects when pushing back to |pCodes|.
NFC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270436 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-23 13:58:04 +00:00
Matt Arsenault
bca8aba44a Fix constant folding of addrspacecast of null
This should not be making assumptions on the value of
the casted pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270293 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-21 00:14:04 +00:00
Easwaran Raman
30c760d801 Remove specializations of ProfileSummary
This removes the subclasses of ProfileSummary, moves the members of the derived classes to the base class.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270143 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-19 21:53:28 +00:00
Easwaran Raman
17e7f1191f Move ProfileSummary to IR.
This splits ProfileSummary into two classes: a ProfileSummary class that has methods to convert from/to metadata and a ProfileSummaryBuilder class that computes the profiles summary which is in ProfileData.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270136 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-19 21:07:12 +00:00
Sanjoy Das
15c62f945a [ConstantRange] Add an getEquivalentICmp helper
Currently only its unit test uses it, but this will be used in a later
change to simplify some logic in the GuardWidening pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270018 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-19 03:53:06 +00:00
Sanjay Patel
7aae44e690 fix formatting; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269990 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 22:05:28 +00:00
Renato Golin
3b0d377ef8 [llc] New diagnostic handler
Without a diagnostic handler installed, llc's behaviour is to exit on the first
error that it encounters. This is very different from the behaviour of clang
and other front ends, which try to gather as many errors as possible before
exiting.

This commit adds a diagnostic handler to llc, allowing it to find and report
more than one error. The old behaviour is preserved under a flag (-exit-on-error).

Some of the tests fail with the new diagnostic handler, so they have to use the
new flag in order to run under the previous behaviour. Some of these are known
bugs, others need further investigation. Ideally, we should fix the tests and
remove the flag at some point in the future.

Reapplied after fixing the LLDB build that was broken due to the new
DiagnosticSeverity in LLVMContext.h, and fixed an UB in the new change.

Patch by Diana Picus.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269655 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16 14:28:02 +00:00
Elena Demikhovsky
746e3cee24 Vector GEP - fixed a crash on InstSimplify Pass.
Vector GEP with mixed (vector and scalar) indices failed on the InstSimplify Pass when all indices are constants.

Differential revision http://reviews.llvm.org/D20149



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269590 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-15 12:30:25 +00:00
Renato Golin
7e38263edc Revert "[llc] New diagnostic handler"
This reverts commit r269563. Even though now it passes all LLDB bots
after a local fix, there's a new buildbot it fails with tests that we
hadn't seen locally:

http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules/builds/15647

Adding those tests to the list to investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269568 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-14 14:37:11 +00:00
Renato Golin
2c05d88b8d [llc] New diagnostic handler
Without a diagnostic handler installed, llc's behaviour is to exit on the first
error that it encounters. This is very different from the behaviour of clang
and other front ends, which try to gather as many errors as possible before
exiting.

This commit adds a diagnostic handler to llc, allowing it to find and report
more than one error. The old behaviour is preserved under a flag (-exit-on-error).

Some of the tests fail with the new diagnostic handler, so they have to use the
new flag in order to run under the previous behaviour. Some of these are known
bugs, others need further investigation. Ideally, we should fix the tests and
remove the flag at some point in the future.

Reapplied after fixing the LLDB build that was broken due to the new
DiagnosticSeverity in LLVMContext.h.

Patch by Diana Picus.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269563 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-14 13:15:22 +00:00
Mehdi Amini
77d5aec27e StripDebugInfo: uses isa<DbgInfoIntrinsic> instead of matching against llvm.dbg.* (NFC)
Suggested by Adrian. This is NFC right now but is more clean and
robust against future potential new debug info intrinsics.

From: mehdi_amini <mehdi_amini@91177308-0d34-0410-b5e6-96231b3b80d8>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269540 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-14 04:58:35 +00:00
Mehdi Amini
bdd5f696c0 Revert "StripDebugInfo: uses isa<DbgInfoIntrinsic> instead of matching against llvm.dbg.* (NFC)"
This reverts commit r269537, was not ready to be commited and went through by mistake

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269539 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-14 04:42:51 +00:00
Mehdi Amini
3b492ee764 StripDebugInfo: uses isa<DbgInfoIntrinsic> instead of matching against llvm.dbg.* (NFC)
Suggested by Adrian. This is NFC right now but is more clean and
robust against future potential new debug info intrinsics.

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269537 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-14 04:41:21 +00:00
Jun Bum Lim
1bbd21ba14 Rename getLargestLegalIntTypeSize to getLargestLegalIntTypeSizeInBits(). NFC.
Summary: Rename DataLayout::getLargestLegalIntTypeSize to DataLayout::getLargestLegalIntTypeSizeInBits() to prevent similar mistakes  fixed in r269433.

Reviewers: joker.eph, mcrosier

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269456 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 18:38:35 +00:00
Renato Golin
865778e04a Revert "[llc] New diagnostic handler"
This reverts commit r269428, as it breaks the LLDB build. We need to
understand how to change LLDB in the same way as LLC before landing this
again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269432 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 16:02:44 +00:00
Renato Golin
89ca6c01c0 [llc] New diagnostic handler
Without a diagnostic handler installed, llc's behaviour is to exit on the first
error that it encounters. This is very different from the behaviour of clang
and other front ends, which try to gather as many errors as possible before
exiting.

This commit adds a diagnostic handler to llc, allowing it to find and report
more than one error. The old behaviour is preserved under a flag (-exit-on-error).

Some of the tests fail with the new diagnostic handler, so they have to use the
new flag in order to run under the previous behaviour. Some of these are known
bugs, others need further investigation. Ideally, we should fix the tests and
remove the flag at some point in the future.

Patch by Diana Picus.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269428 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 15:37:46 +00:00
Sanjoy Das
d54aac1ae1 Appease MSVC with curly braces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269262 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 01:38:08 +00:00
Sanjoy Das
d2e75bd7aa All llvm.deoptimize declarations must use the same calling convention
This new verifier rule lets us unambigously pick a calling convention
when creating a new declaration for
`@llvm.experimental.deoptimize.<ty>`.  It is also congruent with our
lowering strategy -- since all calls to `@llvm.experimental.deoptimize`
are lowered to calls to `__llvm_deoptimize`, it is reasonable to enforce
a unique calling convention.

Some of the tests that were breaking this verifier rule have had to be
split up into different .ll files.

The inliner was violating this rule as well, and has been fixed to avoid
producing invalid IR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269261 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 01:17:38 +00:00
Rafael Espindola
e973d3f2ce Return a StringRef from getSection.
This is similar to how getName is handled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269218 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-11 18:21:59 +00:00
Filipe Cabecinhas
3e915294ae [NFC] Remove some dead code:
DbgInfoIntrinsic::StripCast() is dead since r79977
The only function that creates Comdat objects seems to be in Module, and always creates them using the default constructor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269204 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-11 16:38:40 +00:00
Artur Pilipenko
f20a7ef4cf NFC. Introduce Value::isPointerDereferenceable
Extract a part of isDereferenceableAndAlignedPointer functionality to Value:
    
Reviewed By: hfinkel, sanjoy
    
Differential Revision: http://reviews.llvm.org/D17611


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269190 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-11 14:43:28 +00:00
Rafael Espindola
06d92089dd Refactor duplicated check for valid declaration linkage. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269184 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-11 13:51:39 +00:00
Rafael Espindola
d9f2fdcea9 Delete duplicated verifier test.
Also add unittest to show we still detect the errors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269182 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-11 13:23:52 +00:00
Rafael Espindola
853d0da1b5 Try to fix a msvc warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269178 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-11 12:37:16 +00:00
Rafael Espindola
fd8a750b72 Replace PrintLinkage with getLinkagePrintName. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269155 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-11 01:45:31 +00:00
Adrian Prantl
f68fb38629 Separate the Verifier into an analysis and a transformation pass and
allow the transformation to strip invalid debug info.

This patch separates the Verifier into an analysis and a transformation
pass, with the transformation pass optionally stripping malformed
debug info.

The problem I'm trying to solve with this sequence of patches is that
historically we've done a really bad job at verifying debug info. We want
to be able to make the verifier stricter without having to worry about
breaking bitcode compatibility with existing producers. For example, we
don't necessarily want IR produced by an older version of clang to be
rejected by an LTO link just because of malformed debug info, and rather
provide an option to strip it. Note that merely outdated (but well-formed)
debug info would continue to be auto-upgraded in this scenario.

http://reviews.llvm.org/D19988
rdar://problem/25818489

This reapplies r268937 without modifications.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268966 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-09 19:57:29 +00:00
Adrian Prantl
b6708cf087 Allow the LTO code generator to strip invalid debug info from the input.
This patch introduces a new option -lto-strip-invalid-debug-info, which
drops malformed debug info from the input.

The problem I'm trying to solve with this sequence of patches is that
historically we've done a really bad job at verifying debug info. We want
to be able to make the verifier stricter without having to worry about
breaking bitcode compatibility with existing producers. For example, we
don't necessarily want IR produced by an older version of clang to be
rejected by an LTO link just because of malformed debug info, and rather
provide an option to strip it. Note that merely outdated (but well-formed)
debug info would continue to be auto-upgraded in this scenario.

rdar://problem/25818489
http://reviews.llvm.org/D19987

This reapplies 268936 with a test case fix for Linux (-exported-symbol foo)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268965 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-09 19:57:15 +00:00
Adrian Prantl
cfd85505ad Revert "Allow the LTO code generator to strip invalid debug info from the input."
This reverts commit 268936 while investigating buildbot breakage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268940 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-09 17:43:30 +00:00
Adrian Prantl
0a3572607f Revert "Separate the Verifier into an analysis and a transformation pass and"
This reverts commit 268937 while investigating build bot breakage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268939 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-09 17:43:24 +00:00
Adrian Prantl
6d99a3d56e Separate the Verifier into an analysis and a transformation pass and
allow the transformation to strip invalid debug info.

This patch separates the Verifier into an analysis and a transformation
pass, with the transformation pass optionally stripping malformed
debug info.

The problem I'm trying to solve with this sequence of patches is that
historically we've done a really bad job at verifying debug info. We want
to be able to make the verifier stricter without having to worry about
breaking bitcode compatibility with existing producers. For example, we
don't necessarily want IR produced by an older version of clang to be
rejected by an LTO link just because of malformed debug info, and rather
provide an option to strip it. Note that merely outdated (but well-formed)
debug info would continue to be auto-upgraded in this scenario.

http://reviews.llvm.org/D19988
rdar://problem/25818489

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268937 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-09 17:37:42 +00:00
Adrian Prantl
9860b93e07 Allow the LTO code generator to strip invalid debug info from the input.
This patch introduces a new option -lto-strip-invalid-debug-info, which
drops malformed debug info from the input.

The problem I'm trying to solve with this sequence of patches is that
historically we've done a really bad job at verifying debug info. We want
to be able to make the verifier stricter without having to worry about
breaking bitcode compatibility with existing producers. For example, we
don't necessarily want IR produced by an older version of clang to be
rejected by an LTO link just because of malformed debug info, and rather
provide an option to strip it. Note that merely outdated (but well-formed)
debug info would continue to be auto-upgraded in this scenario.

rdar://problem/25818489
http://reviews.llvm.org/D19987

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268936 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-09 17:37:33 +00:00
Mehdi Amini
0c3421d8d9 Fix stripDebugInfo: was modifying "DebugLoc" attached to the intrinsic after deleting it.
Fix MSAN build.

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268849 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-07 05:07:47 +00:00
Mehdi Amini
79941185c0 Refactor stripDebugInfo(Function) to handle intrinsic
This moves the code that handles stripping debug info intrinsic from
 StripDebugInfo(Module) to StripDebugInfo(Function). The latter is
already walking every instructions so it makes sense to do it at the
same time.
This makes also stripDebugInfo(Function) as an API more useful: it
is really dropping every debug info in the Function.
Finally the existing code is trigerring an assertion when the Module
is not fully materialized.

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268847 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-07 04:10:52 +00:00
Vitaly Buka
cc8923b4e4 Revert r268832 "Refactor stripDebugInfo(Function) to handle intrinsic"
It breaks many bots

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268837 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-07 02:10:59 +00:00
Mehdi Amini
7be47c324a Refactor stripDebugInfo(Function) to handle intrinsic
This moves the code that handles stripping debug info intrinsic from
 StripDebugInfo(Module) to StripDebugInfo(Function). The latter is
already walking every instructions so it makes sense to do it at the
same time.
This makes also stripDebugInfo(Function) as an API more useful: it
is really dropping every debug info in the Function.
Finally the existing code is trigerring an assertion when the Module
is not fully materialized.

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268832 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-07 01:42:36 +00:00
Adrian Prantl
70fdb3ef48 Refactor the Verifier so it can diagnose IR validation errors and debug
info metadata errors separately. (NFC)

This patch refactors the Verifier so it can diagnose IR validation errors
and debug info metadata errors separately.
The motivation behind this change is that broken (or outdated) debug info
can be "recovered" from by stripping the debug info.

The problem I'm trying to solve with this sequence of patches is that
historically we've done a really bad job at verifying debug info.
We want to be able to make the verifier stricter without having to worry
about breaking bitcode compatibility with existing producers. For example,
we don't necessarily want IR produced by an older version of clang to be
rejected by an LTO link just because of malformed debug info, and rather
provide an option to strip it. Note that merely outdated (but well-formed)
debug info would continue to be auto-upgraded in this scenario.

http://reviews.llvm.org/D19986
rdar://problem/25818489

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268778 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 19:26:47 +00:00
Nikolay Haustov
ac1dd296bc AMDGPU/SI: Add amdgpu_kernel calling convention. Part 1.
Summary:
This will be used for AMDGPU_HSA_KERNEL symbol type in output ELF.

Also, in the future unused non-kernels may be optimized.

For now, also accept SPIR_KERNEL for HCC frontend.

Also, add bitcode compatibility tests for missing calling conventions
except AVR_BUILTIN which doesn't have parse code.

Reviewers: tstellarAMD, arsenm

Subscribers: arsenm, joker.eph, llvm-commits

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268717 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 09:07:29 +00:00
Balaram Makam
94ee5ea0aa "Reapply r268521 "[InstCombine] Canonicalize icmp instructions based on dominating conditions.""
This reapplies commit r268521, that was reverted in r268530 due to a test failure in select-implied.ll
Modified the test case to reflect the new change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268557 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 21:32:14 +00:00
Hal Finkel
5813ee1a22 [ConstantFold] Don't try to strip fp -> int bitcasts to simplify icmps
ConstantFold has logic to take icmp (bitcast x to y), null and strip the
bitcast. This makes sense in general, but not if x has floating-point type. In
this case, we'd need a fcmp, not an icmp, and the code will assert. We normally
don't see this situation because we constant fold fp -> int bitcasts, however,
we'll see it for bitcasts of ppc_fp128 -> i128. This is because that bitcast is
Endian-dependent, and as a result, we don't simplify it in ConstantFold (we
could, but no one has yet added the necessary logic). Regardless, ConstantFold
should not depend on that canonicalization for correctness.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268534 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 19:37:08 +00:00
Balaram Makam
30f97f1d5c Revert "[InstCombine] Canonicalize icmp instructions based on dominating conditions."
This reverts commit 573a40f79b35cf3e71db331bb00f6a84f03b835d.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268530 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 18:37:35 +00:00
Balaram Makam
decf72be2d [InstCombine] Canonicalize icmp instructions based on dominating conditions.
Summary:
    This patch canonicalizes conditions based on the constant range information
    of the dominating branch condition.
    For example:

      %cmp = icmp slt i64 %a, 0
      br i1 %cmp, label %land.lhs.true, label %lor.rhs
      lor.rhs:
        %cmp2 = icmp sgt i64 %a, 0

    Would now be canonicalized into:

      %cmp = icmp slt i64 %a, 0
      br i1 %cmp, label %land.lhs.true, label %lor.rhs
      lor.rhs:
        %cmp2 = icmp ne i64 %a, 0

Reviewers: mcrosier, gberry, t.p.northover, llvm-commits, reames, hfinkel, sanjoy, majnemer

Subscribers: MatzeB, majnemer, mcrosier

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268521 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 17:34:20 +00:00
Reid Kleckner
0e77da267e Revert "[SimplifyCFG] Extend TryToSimplifyUncondBranchFromEmptyBlock for empty block including lifetime intrinsics"
This reverts commit r268254.

This change causes assertion failures while building Chromium. Reduced
test case coming soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268288 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 19:43:22 +00:00
Hans Wennborg
0c15a0b738 [SimplifyCFG] Extend TryToSimplifyUncondBranchFromEmptyBlock for empty block including lifetime intrinsics
Make it possible that TryToSimplifyUncondBranchFromEmptyBlock merges empty
basic block including lifetime intrinsics as well as phi nodes and
unconditional branch into its successor or predecessor(s).

If successor of empty block has single predecessor, all contents including
lifetime intrinsics are sinked into the successor. Otherwise, they are
hoisted into its predecessor(s) and then merged into the predecessor(s).

Patch by Josh Yoon <josh.yoon@samsung.com>!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268254 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 17:22:54 +00:00
Simon Pilgrim
8bb8e81ce4 Fixed signed/unsigned comparison warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268249 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 16:45:02 +00:00
Amaury Sechet
58e9430c5d Properly name LLVMSetIsInBounds's argument. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268176 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 02:23:14 +00:00
Sanjay Patel
0ac37a4267 clean up documentation comments; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268122 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 22:03:27 +00:00
Filipe Cabecinhas
2fd54348ae Unify XDEBUG and EXPENSIVE_CHECKS (into the latter), and add an option to the cmake build to enable them.
Summary:
Historically, we had a switch in the Makefiles for turning on "expensive
checks". This has never been ported to the cmake build, but the
(dead-ish) code is still around.

This will also make it easier to turn it on in buildbots.

Reviewers: chandlerc

Subscribers: jyknight, mzolotukhin, RKSimon, gberry, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268050 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 15:22:48 +00:00
David Majnemer
3047183427 [GlobalOpt] Propagate operand bundles
We neglected to transfer operand bundles for some transforms.  These
were found via inspection, I'll try to come up with some test cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268011 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 08:07:22 +00:00
Yaron Keren
4030c6e2a8 Remove doInitialization() and doFinalization() member declarations without definitions.
Visual C++ 2015 flags this in the IDE.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267919 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 19:21:30 +00:00
Sriraman Tallam
d41672fa69 Add "PIE Level" metadata to module flags.
http://reviews.llvm.org/D19671

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267911 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 18:15:44 +00:00
Eugene Zelenko
aaf3f0426b Fix some Clang-tidy modernize and Include What You Use warnings.
Differential revision: http://reviews.llvm.org/D19673


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267910 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 18:04:41 +00:00
Yaron Keren
85c121599e Rangify for loops, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267889 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 14:49:44 +00:00
Artur Pilipenko
25f648c298 NFC. Introduce Value::getPointerDerferecnceableBytes
Extract a part of isDereferenceableAndAlignedPointer functionality to Value::getPointerDerferecnceableBytes. Currently it's a NFC, but in future I'm going to accumulate all the logic about value dereferenceability in this function similarly to Value::getPointerAlignment function (D16144).

Reviewed By: reames

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267708 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 12:51:01 +00:00
Artur Pilipenko
5f2b68d895 Use DL preferred alignment for alloca in Value::getPointerAlignment
Teach Value::getPointerAlignment that allocas with no explicit alignment are aligned to preferred alignment of the allocated type.

Reviewed By: hfinkel

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267689 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 10:42:29 +00:00
Sanjay Patel
6f5aa79cda [CodeGenPrepare] use branch weight metadata to decide if a select should be turned into a branch
This is part of solving PR27344:
https://llvm.org/bugs/show_bug.cgi?id=27344

CGP should undo the SimplifyCFG transform for the same reason that earlier patches have used this
same mechanism: it's possible that passes between SimplifyCFG and CGP may be able to optimize the
IR further with a select in place.

For the TLI hook default, >99% taken or not taken is chosen as the default threshold for a highly
predictable branch. Even the most limited HW branch predictors will be correct on this branch almost
all the time, so even a massive mispredict penalty perf loss would be overcome by the win from all
the times the branch was predicted correctly.

As a follow-up, we could make the default target hook less conservative by using the SchedMachineModel's
MispredictPenalty. Or we could just let targets override the default by implementing the hook with that
and other target-specific options. Note that trying to statically determine mispredict rates for 
close-to-balanced profile weight data is generally impossible if the HW is sufficiently advanced. Ie, 
50/50 taken/not-taken might still be 100% predictable.

Finally, note that this patch as-is will not solve PR27344 because the current __builtin_unpredictable()
branch weight default values are 4 and 64. A proposal to change that is in D19435.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267572 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 17:11:17 +00:00
Sanjay Patel
d08220a7df Add check for "branch_weights" with prof metadata
While we're here, fix the comment and variable names to make it
clear that these are raw weights, not percentages.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267491 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25 23:15:16 +00:00
Amaury Sechet
3c50cf9777 Reformat LLVMConstPointerNull. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267484 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25 22:23:35 +00:00
Teresa Johnson
4668002971 [ThinLTO] Introduce typedef for commonly-used map type (NFC)
Add a typedef for the std::map<GlobalValue::GUID, GlobalValueSummary *>
map that is passed around to identify summaries for values defined in a
particular module. This shortens up declarations in a variety of places.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267471 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25 21:09:51 +00:00
Chad Rosier
4d87cf623d Typo. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267399 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25 13:25:14 +00:00
Adrian Prantl
c5cc3f2a20 Verifier: Verify that each inlinable callsite of a debug-info-bearing function
in a debug-info-bearing function has a debug location attached to it. Failure to
do so causes an "!dbg attachment points at wrong subprogram for function"
assertion failure when the inliner sets up inline scope info.

rdar://problem/25878916

This reaplies r267320 without changes after fixing an issue in the OpenMP IR
generator in clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267370 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-24 22:23:13 +00:00
Teresa Johnson
ff1d72888b [ThinLTO] Remove GlobalValueInfo class from index
Summary:
Remove the GlobalValueInfo and change the ModuleSummaryIndex to directly
reference summary objects. The info structure was there to support lazy
parsing of the combined index summary objects, which is no longer
needed and not supported.

Reviewers: joker.eph

Subscribers: joker.eph, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267344 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-24 14:57:11 +00:00
Adrian Prantl
08290fd4f3 Revert "Verifier: Verify that each inlinable callsite of a debug-info-bearing function"
This reverts commit r267320 while investigating an OpenMP buildbot failure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267322 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-24 03:47:37 +00:00
Adrian Prantl
522b700b9b Verifier: Verify that each inlinable callsite of a debug-info-bearing function
in a debug-info-bearing function has a debug location attached to it. Failure to
do so causes an "!dbg attachment points at wrong subprogram for function"
assertion failure when the inliner sets up inline scope info.

rdar://problem/25878916

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267320 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-24 03:23:02 +00:00
Duncan P. N. Exon Smith
1e7e2b2b55 DebugInfo: Change DIBuilder to make distinct DIGlobalVariables
A long overdue change to make DIGlobalVariable distinct.  Much like
DISubprogram definitions (changed in r246098), it isn't logical to
unique DIGlobalVariable definitions from two different compile units.

(Longer-term, we should also find a way to reverse the link between
GlobalVariable and DIGlobalVariable, and between DIGlobalVariable and
DICompileUnit, so that debug info to do with optimized-out globals
disappears.  Admittedly it's harder than with Function/DISubprogram,
since global variables may be constant-folded and the debug info should
still describe that somehow.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267301 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23 22:29:09 +00:00
Duncan P. N. Exon Smith
de7484036b DebugInfo: Remove MDString-based type references
Eliminate DITypeIdentifierMap and make DITypeRef a thin wrapper around
DIType*.  It is no longer legal to refer to a DICompositeType by its
'identifier:', and DIBuilder no longer retains all types with an
'identifier:' automatically.

Aside from the bitcode upgrade, this is mainly removing logic to resolve
an MDString-based reference to an actualy DIType.  The commits leading
up to this have made the implicit type map in DICompileUnit's
'retainedTypes:' field superfluous.

This does not remove DITypeRef, DIScopeRef, DINodeRef, and
DITypeRefArray, or stop using them in DI-related metadata.  Although as
of this commit they aren't serving a useful purpose, there are patchces
under review to reuse them for CodeView support.

The tests in LLVM were updated with deref-typerefs.sh, which is attached
to the thread "[RFC] Lazy-loading of debug info metadata":

  http://lists.llvm.org/pipermail/llvm-dev/2016-April/098318.html

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267296 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23 21:08:00 +00:00
Sanjay Patel
7ceecf02a1 replace duplicated static functions for profile metadata access with BranchInst member function; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267295 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23 20:01:22 +00:00
Duncan P. N. Exon Smith
20c4466364 BitcodeReader: Avoid referencing unresolved nodes from distinct ones
Each reference to an unresolved MDNode is expensive, since the RAUW
support in MDNode uses a separate allocation and side map.  Since
a distinct MDNode doesn't require its operands on creation (unlike
uniuqed nodes, there's no need to check for structural equivalence),
use nullptr for any of its unresolved operands.  Besides reducing the
burden on MDNode maps, this can avoid allocating temporary MDNodes in
the first place.

We need some way to track operands.  Invent DistinctMDOperandPlaceholder
for this purpose, which is a Metadata subclass that holds an ID and
points at its single user.  DistinctMDOperandPlaceholder::replaceUseWith
is just like RAUW, but its name highlights that there is only ever
exactly one use.

There is no support for moving (or, obviously, copying) these.  Move
support would be possible but expensive; leaving it unimplemented
prevents user error.  In the BitcodeReader I originally considered
allocating on a BumpPtrAllocator and keeping a vector of pointers to
them, and then I realized that std::deque implements exactly this.

A couple of obvious follow-ups:

  - Change ValueEnumerator to emit distinct nodes first to take more
    advantage of this optimization.  (How convenient... I think I might
    have a couple of patches for this.)

  - Change DIBuilder and its consumers (like CGDebugInfo in clang) to
    use something like this when constructing debug info in the first
    place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267270 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23 04:15:56 +00:00
Duncan P. N. Exon Smith
c49984db99 BitcodeReader: Use getMD/getMDOrNull helpers consistently, almost NFC
The only functionality change was removing an error check from the
BitcodeReader (and an assertion from DILocation::getImpl) that is
already caught by Verifier::visitDILocation.  The Verifier is a better
place for this anyway, and being inconsistent with other subclasses of
MDNode isn't serving anyone.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267267 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23 03:55:14 +00:00
Amaury Sechet
eeabfb0a05 Style fix in Core.h / Core.cpp. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267257 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23 00:12:45 +00:00
Andrew Kaylor
8a1d408868 Removing unused function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267236 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22 22:24:20 +00:00
Andrew Kaylor
1e455c5cfb Re-commit optimization bisect support (r267022) without new pass manager support.
The original commit was reverted because of a buildbot problem with LazyCallGraph::SCC handling (not related to the OptBisect handling).

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267231 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22 22:06:11 +00:00
Chad Rosier
6d282e5efc [SimplifyCFG] Add final missing implications to isImpliedTrueByMatchingCmp.
Summary: eq imply [u|s]ge and [u|s]le are true.

Remove redundant logic by implementing isImpliedFalseByMatchingCmp(Pred1, Pred2)
as isImpliedTrueByMatchingCmp(Pred1, getInversePredicate(Pred2)).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267177 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22 17:57:34 +00:00
Chad Rosier
14f36d715b [SimplifyCFG] Add missing implications to isImpliedTrueByMatchingCmp.
Summary: [u|s]gt and [u|s]lt imply [u|s]ge and [u|s]le are true, respectively.
I've simplified the existing tests and added additional tests to cover the new
cases mentioned above.  I've also added tests for all the cases where the
first compare doesn't imply anything about the second compare.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267171 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22 17:14:12 +00:00
Vedant Kumar
8866d94a61 Revert "Initial implementation of optimization bisect support."
This reverts commit r267022, due to an ASan failure:

  http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_check/1549

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267115 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22 06:51:37 +00:00
David Majnemer
582e856107 [GVN] Respect fast-math-flags on fcmps
We assumed that flags were only present on binary operators.  This is
not true, they may also be present on calls and fcmps.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267113 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22 06:37:51 +00:00
David Majnemer
91e5e85831 [EarlyCSE] Take the intersection of flags on instructions
EarlyCSE had inconsistent behavior with regards to flag'd instructions:
- In some cases, it would pessimize if the available instruction had
  different flags by not performing CSE.
- In other cases, it would miscompile if it replaced an instruction
  which had no flags with an instruction which has flags.

Fix this by being more consistent with our flag handling by utilizing
andIRFlags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267111 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22 06:37:45 +00:00
Amaury Sechet
b50527515a Add utility function to manipulate attributes on CallSite. NFC
Summary: As per title. This will help work on the C API.

Reviewers: Wallbraker, whitequark, joker.eph, echristo, rafael

Subscribers: joker.eph, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267057 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-21 21:29:10 +00:00
Andrew Kaylor
c852398cbc Initial implementation of optimization bisect support.
This patch implements a optimization bisect feature, which will allow optimizations to be selectively disabled at compile time in order to track down test failures that are caused by incorrect optimizations.

The bisection is enabled using a new command line option (-opt-bisect-limit).  Individual passes that may be skipped call the OptBisect object (via an LLVMContext) to see if they should be skipped based on the bisect limit.  A finer level of control (disabling individual transformations) can be managed through an addition OptBisect method, but this is not yet used.

The skip checking in this implementation is based on (and replaces) the skipOptnoneFunction check.  Where that check was being called, a new call has been inserted in its place which checks the bisect limit and the optnone attribute.  A new function call has been added for module and SCC passes that behaves in a similar way.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267022 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-21 17:58:54 +00:00
Amjad Aboud
1268621b54 Fixed Dwarf debug info emission to skip DILexicalBlockFile entries.
Before this fix, DILexicalBlockFile entries were skipped only in some cases and were not in other cases.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267004 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-21 16:58:49 +00:00