Commit Graph

2157 Commits

Author SHA1 Message Date
Simon Pilgrim
bbb1dbaaca Strip trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263162 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-10 20:58:11 +00:00
Artur Pilipenko
980df33d17 Support arbitrary addrspace pointers in masked load/store intrinsics
This patch fixes the problem which occurs when loop-vectorize tries to use @llvm.masked.load/store intrinsic for a non-default addrspace pointer. It fails with "Calling a function with a bad signature!" assertion in CallInst constructor because it tries to pass a non-default addrspace pointer to the pointer argument which has default addrspace.

The fix is to add pointer type as another overloaded type to @llvm.masked.load/store intrinsics.

Reviewed By: reames

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263158 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-10 20:39:22 +00:00
Mehdi Amini
2de9927963 Add a flag to the LLVMContext to disable name for Value other than GlobalValue
Summary:
This is intended to be a performance flag, on the same level as clang
cc1 option "--disable-free". LLVM will never initialize it by default,
it will be up to the client creating the LLVMContext to request this
behavior. Clang will do it by default in Release build (just like
--disable-free).

"opt" and "llc" can opt-in using -disable-named-value command line
option.

When performing LTO on llvm-tblgen, the initial merging of IR peaks
at 92MB without this patch, and 86MB after this patch,setNameImpl()
drops from 6.5MB to 0.5MB.
The total link time goes from ~29.5s to ~27.8s.

Compared to a compile-time flag (like the IRBuilder one), it performs
very close. I profiled on SROA and obtain these results:

 420ms with IRBuilder that preserve name
 372ms with IRBuilder that strip name
 375ms with IRBuilder that preserve name, and a runtime flag to strip

Reviewers: chandlerc, dexonsmith, bogner

Subscribers: joker.eph, llvm-commits

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263086 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-10 01:28:54 +00:00
Quentin Colombet
dbefd77861 [IR] Provide an API to skip the details of a structured type when printed.
The mir infrastructure will need this for generic instructions and currently
this feature was only available through the anonymous TypePrinter class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262869 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-07 22:32:42 +00:00
Amaury Sechet
618dea3d12 Small formating change in Core.cpp . NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262860 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-07 21:39:20 +00:00
Mehdi Amini
f73f5cd094 Add a new insert_as() method to DenseMap and use it for ConstantUniqueMap
Just like the existing find_as() method, the new insert_as() accepts
an extra parameter which is used as a key to find the bucket in the
map.
When creating a Constant, we want to check the map before actually
creating the object. In this case we have to perform two queries to
the map, and this extra parameter can save recomputing the hash value
for the second query.

This is a reapply of r260458, that was reverted because it was
suspected to be the cause of instability of an internal bot, but
wasn't confirmed.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262812 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-07 00:51:00 +00:00
Sanjoy Das
1d754782e0 [ConstantRange] Generalize makeGuaranteedNoWrapRegion to work on ranges
This will be used in a later patch to ScalarEvolution.  Right now only
the unit tests exercise the newly added code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262637 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03 18:31:16 +00:00
Dylan McKay
ca03902fd5 [AVR] Add calling convention parser tokens
Summary: Adds the 'avr_intrcc' and 'avr_signalcc' IR calling convention tokens to the parser.

Reviewers: arsenm

Subscribers: dylanmckay, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262600 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03 10:08:02 +00:00
David Majnemer
d724de3510 [Verifier] Don't abort on invalid cleanuprets
Code in visitEHPadPredecessors assume a little too much about the
validity of a cleanupret with an invalid cleanuppad operand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262364 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 18:59:50 +00:00
Matt Arsenault
9a6db34754 Add isScalarInteger helper to EVT/MVT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262357 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 18:01:28 +00:00
David Majnemer
a34c14ca02 [Verifier] Diagnose when unwinding out of cycles of blocks
Generally speaking, this can only happen with unreachable code.
However, neglecting to check for this condition would lead us to loop
forever.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262284 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 01:19:05 +00:00
David Majnemer
87e4278b8c [Verifier] Handle more funclet edge cases
This change makes the verifier a little more paranoid.  It was possible
to trick the verifier into crashing or infinite looping.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262268 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-29 22:56:36 +00:00
Sanjoy Das
bfc5df0cb4 [Verifier] Minor fix to error message; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262262 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-29 22:04:25 +00:00
Dehao Chen
eb295ed84e Move discriminator assignment to the right place.
Summary: Now discriminator is assigned per-function instead of per-module.

Reviewers: davidxl, dnovillo

Subscribers: dblaikie, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262240 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-29 18:59:48 +00:00
NAKAMURA Takumi
d9b6afb249 [PM] Appease mingw32's auto-import DLL build with minimal tweaks, with fix for clang.
char AnalysisBase::ID should be declared as extern and defined in one module.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262188 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-28 17:17:00 +00:00
NAKAMURA Takumi
bebf4a6f9d Revert r262185, "[PM] Appease mingw32's auto-import DLL build with minimal tweaks."
I'll rework soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262186 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-28 16:54:06 +00:00
NAKAMURA Takumi
fd32a56bfa [PM] Appease mingw32's auto-import DLL build with minimal tweaks.
char AnalysisBase::ID should be declared as extern and defined in one module.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262185 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-28 16:38:46 +00:00
Chandler Carruth
a36b27d584 [PM] Provide explicit instantiation declarations and definitions for the
PassManager and AnalysisManager template specializations as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262128 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-27 10:45:35 +00:00
Chandler Carruth
500af85bd1 [PM] Provide two templates for the two directionalities of analysis
manager proxies and use those rather than repeating their definition
four times.

There are real differences between the two directions: outer AMs are
const and don't need to have invalidation tracked. But every proxy in
a particular direction is identical except for the analysis manager type
and the IR unit they proxy into. This makes them prime candidates for
nice templates.

I've started introducing explicit template instantiation declarations
and definitions as well because we really shouldn't be emitting all this
everywhere. I'm going to go back and add the same for the other
templates like this in a follow-up patch.

I've left the analysis manager as an opaque type rather than using two
IR units and requiring it to be an AnalysisManager template
specialization. I think its important that users retain the ability to
provide their own custom analysis management layer and provided it has
the appropriate API everything should Just Work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262127 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-27 10:38:10 +00:00
Philip Reames
fcd97ccb03 [ConstantRange] Add umin/smin operators
This was split off from http://reviews.llvm.org/D17184.

Reviewed by: Sanjoy



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262080 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 22:08:18 +00:00
Reid Kleckner
4f8c4bec33 [IR] Optimize bitfield layout of Value for MSVC
This should save a pointer of padding from all MSVC Value subclasses.

Recall that MSVC will not pack the following bitfields together:
  unsigned Bits : 29;
  unsigned Flag1 : 1;
  unsigned Flag2 : 1;
  unsigned Flag3 : 1;

Add a static_assert because LLVM developers always trip over this
behavior. This regressed in June.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262045 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 18:08:59 +00:00
Chandler Carruth
adb60a3a11 [PM] Introduce CRTP mixin base classes to help define passes and
analyses in the new pass manager.

These just handle really basic stuff: turning a type name into a string
statically that is nice to print in logs, and getting a static unique ID
for each analysis.

Sadly, the format of passes in anonymous namespaces makes using their
names in tests really annoying so I've customized the names of the no-op
passes to keep tests sane to read.

This is the first of a few simplifying refactorings for the new pass
manager that should reduce boilerplate and confusion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262004 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 11:44:45 +00:00
Sanjay Patel
125897287e rangify; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261888 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 16:44:27 +00:00
Justin Bogner
ec0c489bcf IR: Make the X / undef -> undef fold match the comment
The constant folding for sdiv and udiv has a big discrepancy between the
comments and the code, which looks like a typo. Currently, we're folding
X / undef pretty inconsistently:

  0 / undef -> undef
  C / undef -> 0
  undef / undef -> 0

Whereas the comments state we do X / undef -> undef. The logic that
returns zero is actually commented as doing undef / X -> 0, despite that
the LHS isn't undef in many of the cases that hit it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261813 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 01:02:18 +00:00
Artur Pilipenko
f5b27499f5 NFC. Move getAlignment helper function from ValueTracking to Value class.
Reviewed By: reames, hfinkel

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261735 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-24 12:25:10 +00:00
Chandler Carruth
73ba9bfc2e [PM] Improve the API and comments around the analysis manager proxies.
These are really handles that ensure the analyses get cleared at
appropriate places, and as such copying doesn't really make sense.
Instead, they should look more like unique ownership objects. Make that
the case.

Relatedly, if you create a temporary of one and move out of it
its destructor shouldn't actually clear anything. I don't think there is
any code that can trigger this currently, but it seems like a more
robust implementation.

If folks want, I can add a unittest that forces this to be exercised,
but that seems somewhat pointless -- whether a temporary is ever created
in the innards of AnalysisManager is not really something we should be
adding a reliance on, but I didn't want to leave a timebomb in the code
here.

If anyone has a cleaner way to represent this, I'm all ears, but
I wanted to assure myself that this wasn't in fact responsible for
another bug I'm chasing down (it wasn't) and figured I'd commit that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261594 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-23 00:05:00 +00:00
Sanjoy Das
e9d736f57c [ConstantRange] Rename a method and add more doc
Rename makeNoWrapRegion to a more obvious makeGuaranteedNoWrapRegion,
and add a comment about the counter-intuitive aspects of the function.
This is to help prevent cases like PR26628.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261532 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-22 16:13:02 +00:00
Duncan P. N. Exon Smith
14147eda61 ADT: Stop using getNodePtrUnchecked on end() iterators
Stop using `getNodePtrUnchecked()` when building IR.  Eventually a
dereference will be required to get at the downcast node, since the
iterator will only store an `ilist_node_base` of some sort.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261495 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-21 19:52:15 +00:00
Duncan P. N. Exon Smith
34cfdde1e9 IR: Add ConstantData, for operand-less Constants
Add a common parent `ConstantData` to the constants that have no
operands.  These are guaranteed to represent abstract data that is in no
way tied to a specific Module.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261464 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-21 02:39:49 +00:00
Philip Reames
3dbdebce48 [IR] Extend cmpxchg to allow pointer type operands
Today, we do not allow cmpxchg operations with pointer arguments. We require the frontend to insert ptrtoint casts and do the cmpxchg in integers. While correct, this is problematic from a couple of perspectives:
1) It makes the IR harder to analyse (for instance, it make capture tracking overly conservative)
2) It pushes work onto the frontend authors for no real gain

This patch implements the simplest form of IR support. As we did with floating point loads and stores, we teach AtomicExpand to convert back to the old representation. This prevents us needing to change all backends in a single lock step change. Over time, we can migrate each backend to natively selecting the pointer type. In the meantime, we get the advantages of a cleaner IR representation without waiting for the backend changes.

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




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261281 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 00:06:41 +00:00
Richard Trieu
1b96cbe208 Remove uses of builtin comma operator.
Cleanup for upcoming Clang warning -Wcomma.  No functionality change intended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261270 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 22:09:30 +00:00
Amaury Sechet
10ae0ad505 Add support for invoke/landingpad/resume in C API test
Summary: As per title. There was a lot of part missing in the C API, so I had to extend the invoke and landingpad API.

Reviewers: echristo, joker.eph, Wallbraker

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261254 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 20:38:32 +00:00
Amaury Sechet
185aa0ed1a Add support for memory operations (load/store/gep) in C API echo test
Summary: As per title.

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261174 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 22:51:03 +00:00
Tim Northover
6470a5d8ba Fix warning on build without asserts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261155 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 21:16:59 +00:00
Elena Demikhovsky
2c7551bff2 Create masked gather and scatter intrinsics in Loop Vectorizer.
Loop vectorizer now knows to vectorize GEP and create masked gather and scatter intrinsics for random memory access.

The feature is enabled on AVX-512 target.
Differential Revision: http://reviews.llvm.org/D15690



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261140 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 19:23:04 +00:00
Mehdi Amini
1df6c24ac6 Revert "Query the StringMap only once when creating MDString (NFC)"
This reverts commit r261030 and r261036.
(The revision was marked "approved" on phabricator, but some concerns
were raised on the mailing list. Thanks D. Blaikie for notifying me.)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261055 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 02:18:58 +00:00
Mehdi Amini
30d7b4334a Query the StringMap only once when creating MDString (NFC)
Summary: Loading IR with debug info improves MDString::get() from 19ms to 10ms.

Reviewers: dexonsmith

Subscribers: llvm-commits

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261030 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-16 23:05:56 +00:00
Amaury Sechet
89e84d7221 Deprecate LLVMGetDataLayout and replace it by LLVMGetDataLayoutStr
Summary: The name is confusing as it matche another method on the module.

Reviewers: joker.eph, Wallbraker, echristo

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260920 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-16 00:23:52 +00:00
Amaury Sechet
ab96d57a0b Rename LLVMSetDataLayout's argument to match what they stand for
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260916 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-15 23:40:06 +00:00
Benjamin Kramer
34ae7b5808 [ConstantFolding] Reduce APInt and APFloat copying.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260826 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-13 16:54:14 +00:00
Mehdi Amini
0c5ff64c5f Revert "Add a new insert_as() method to DenseMap and use it for ConstantUniqueMap"
This reverts commit r260458.

It was backported on an internal branch and broke stage2 build. Since
this can lead to weird random crash I'm reverting upstream as well
while investigating.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260605 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 22:00:36 +00:00
Amaury Sechet
c2e77df6b8 Add support for phi nodes in the LLVM C API test
Summary: This required to add binding to Instruction::removeFromParent so that instruction can be forward declared and then moved at the right place.

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260597 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 21:37:54 +00:00
Mehdi Amini
f181d046e0 Add a new insert_as() method to DenseMap and use it for ConstantUniqueMap
Summary:
Just like the existing find_as() method, the new insert_as() accepts
an extra parameter which is used as a key to find the bucket in the
map.
When creating a Constant, we want to check the map before actually
creating the object. In this case we have to perform two queries to
the map, and this extra parameter can save recomputing the hash value
for the second query.

Reviewers: dexonsmith, chandlerc

Subscribers: llvm-commits

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260458 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 23:07:29 +00:00
Mehdi Amini
4c69696279 Simplify handleOperandChangeImpl() removing last argument (NFC)
The Use argument was used to compute the operand number for a fast
path when replacing only one operand. However we always have to go
through all the operands. So the argument number can be recomputed
locally anyway.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260454 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 22:47:15 +00:00
Teresa Johnson
0060160bcf Restore "[ThinLTO] Use MD5 hash in function index." with fix
This restores commit r260408, along with a fix for a bot failure.

The bot failure was caused by dereferencing a unique_ptr in the same
call instruction parameter list where it was passed via std::move.
Apparently due to luck this was not exposed when I built the compiler
with clang, only with gcc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260442 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 21:55:02 +00:00
Teresa Johnson
bc947a0d8d Revert "[ThinLTO] Use MD5 hash in function index." due to bot failure
This reverts commit r260408. Bot failure that I need to investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260412 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 19:11:15 +00:00
Teresa Johnson
f38049c501 [ThinLTO] Use MD5 hash in function index.
Summary:
This patch uses the lower 64-bits of the MD5 hash of a function name as
a GUID in the function index, instead of storing function names. Any
local functions are first given a global name by prepending the original
source file name. This is the same naming scheme and GUID used by PGO in
the indexed profile format.

This change has a couple of benefits. The primary benefit is size
reduction in the combined index file, for example 483.xalancbmk's
combined index file was reduced by around 70%. It should also result in
memory savings for the index file in memory, as the in-memory map is
also indexed by the hash instead of the string.

Second, this enables integration with indirect call promotion, since the
indirect call profile targets are recorded using the same global naming
convention and hash. This will enable the function importer to easily
locate function summaries for indirect call profile targets to enable
their import and subsequent promotion.

The original source file name is recorded in the bitcode in a new
module-level record for use in the ThinLTO backend pipeline.

Reviewers: davidxl, joker.eph

Subscribers: llvm-commits, joker.eph

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260408 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 18:57:54 +00:00
Amaury Sechet
b711faf7b3 Add support for struct in C API test
Summary: As per title. This also include extra support for insertvalue and extracvalue.

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260335 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 00:38:50 +00:00
Amaury Sechet
6f6b35477f Add binding for counting argument and find called value of call and invoke instruction from the C API.
Summary: As per title. This remove the need to rely on internal knowledge of call and invoke instruction to find called value and argument count.

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260332 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 00:09:37 +00:00
Amaury Sechet
a92e5eb421 Add C binding for AllocaInst::getAllocatedType
Summary:
Comes with an awesome test.

Depends on D16912

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260313 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 22:50:53 +00:00
Amaury Sechet
0999758bcf Improve the C API echo test tool to emit basic block is the right order.
Summary: As per title. Also add a facility method to get the name of a basic block from the C API.

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260309 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 22:36:41 +00:00
Philip Reames
6d94591fc9 [Verifier] Add checks for masked.load and masked.store intrinsics
While trying to track down what appears to be a LoopVectorizer bug, I noticed that we had no validation of the correctness of calls emitted to @llvm.masked.load and @llvm.masked.store.  This meant malformed IR was showing up much much later than it should.  Hopefully, having Verifier rules in place will make this easier to isolate.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260296 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 21:43:12 +00:00
Teresa Johnson
9ac7dceace Refactor PGO function naming and MD5 hashing support out of ProfileData
Summary:
Move the function renaming logic into the Function class, and the
MD5Hash routine into the MD5 header.

This will enable these routines to be shared with ThinLTO, which
will be changed to store the MD5 hash instead of full function name
in the combined index for significant size reductions. And using the same
function naming for locals in the function index facilitates future
integration with indirect call value profiles.

Reviewers: davidxl

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260197 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 05:12:44 +00:00
Richard Smith
749e602ac0 Remove TrailingObjects::operator delete. It's still suffering from
compiler-specific issues. Instead, repeat an 'operator delete' definition in
each derived class that is actually deleted, and give up on the static type
safety of an error when sized delete is accidentally used on a type derived
from TrailingObjects.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260190 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 02:09:16 +00:00
Richard Smith
bca133d0bb Re-commit r259942 (reverted in r260053) with a different workaround for the MSVC bug.
This fixes undefined behavior in C++14 due to the size of the object being
deleted being different from sizeof(dynamic type) when it is allocated with
trailing objects.

MSVC seems to have several bugs around using-declarations changing the access
of a member inherited from a base class, so use forwarding functions instead of
using-declarations to make TrailingObjects::operator delete accessible where
desired.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260180 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 01:03:42 +00:00
Justin Bogner
eb833bab8d llvm-cov: Fix reading gcov data that does not have function names
In order for recent gcov versions to read the coverage data, you have
to use UseCfgChecksum=true and FunctionNamesInData=false options for
coverage profiling pass. This is because gcov is expecting the
function section in .gcda to be exactly 3 words in size, containing
ident and two checksums.

While llvm-cov is compatible with UseCfgChecksum=true, it always
expects a function name in .gcda function sections (it's not
compatible with FunctionNamesInData=false). Thus it's currently
impossible to generate one set of coverage files that works with both
gcov and llvm-cov.

This change fixes the reading of coverage information to only read the
function name if it's present.

Patch by Arseny Kapoulkine. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260162 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-08 22:49:40 +00:00
Nico Weber
732c5d90b7 Revert 259942, r259943, r259948.
The Windows bots have been failing for the last two days, with:

FAILED: C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe -c LLVMContextImpl.cpp
D:\buildslave\clang-x64-ninja-win7\llvm\lib\IR\LLVMContextImpl.cpp(137) :
    error C2248: 'llvm::TrailingObjects<llvm::AttributeSetImpl,
                                        llvm::IndexAttrPair>::operator delete' :
        cannot access private member declared in class 'llvm::AttributeSetImpl'
    TrailingObjects.h(298) : see declaration of
        'llvm::TrailingObjects<llvm::AttributeSetImpl,
                               llvm::IndexAttrPair>::operator delete'
    AttributeImpl.h(213) : see declaration of 'llvm::AttributeSetImpl'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260053 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-07 20:09:18 +00:00
Teresa Johnson
74409a0b8a [ThinLTO] Include linkage type in function summary
Summary:
Adds the linkage type to both the per-module and combined function
summaries, which subsumes the current islocal bit. This will eventually
be used to optimized linkage types based on global summary-based
analysis.

Reviewers: joker.eph

Subscribers: joker.eph, davidxl, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259993 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-06 16:07:35 +00:00
Adrian Prantl
e56d199eb3 Relax assertion in ReplaceableMetadataImpl::replaceAllUsesWith().
There is a legitimate use-case in clang where we need to replace a
temporary placeholder node with the temporary node that may be a
forward declaration.

<rdar://problem/24493203>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259973 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-06 01:56:55 +00:00
Richard Smith
8ed60ab661 Attempt#2 to work around MSVC rejects-valid.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259948 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-05 23:05:09 +00:00
Richard Smith
2597d07f15 More workarounds for undefined behavior exposed when compiling in C++14 with
-fsized-deallocation. Disable sized deallocation for all objects derived from
TrailingObjects, as we expect the storage allocated for these objects to be
larger than the size of their dynamic type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259942 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-05 22:32:52 +00:00
Ana Pazos
e6463c961c Fix pointers to go on the right hand side. NFC.
Summary:
Fixed pointers to go on the right hand side following coding guidelines. NFC.

Patch by Mandeep Singh Grang.

Reviewers: majnemer, arsenm, sanjoy

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259703 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-03 21:34:39 +00:00
Todd Fiala
888a66d966 Address NDEBUG-related linkage issues for Value::assertModuleIsMaterialized()
The IR/Value class had a linkage issue present when LLVM was built
as a library, and the LLVM library build time had different settings
for NDEBUG than the client of the LLVM library.  Clients could get
into a state where the LLVM lib expected
Value::assertModuleIsMaterialized() to be inline-defined in the header
but clients expected that method to be defined in the LLVM library.

See this llvm-commits thread for more details:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160201/329667.html

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259695 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-03 21:13:23 +00:00
George Burgess IV
02e0bb6dc6 This patch adds MemorySSA to LLVM.
Please see include/llvm/Transforms/Utils/MemorySSA.h for a description
of MemorySSA, and what it does.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259595 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-02 22:46:49 +00:00
Eugene Zelenko
380d47d651 Fix Clang-tidy readability-redundant-control-flow warnings; other minor fixes.
Differential revision: http://reviews.llvm.org/D16793


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259539 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-02 18:20:45 +00:00
Oliver Stannard
9ed9eb72f4 Refactor backend diagnostics for unsupported features
Re-commit of r258951 after fixing layering violation.

The BPF and WebAssembly backends had identical code for emitting errors
for unsupported features, and AMDGPU had very similar code. This merges
them all into one DiagnosticInfo subclass, that can be used by any
backend.

There should be minimal functional changes here, but some AMDGPU tests
have been updated for the new format of errors (it used a slightly
different format to BPF and WebAssembly). The AMDGPU error messages will
now benefit from having precise source locations when debug info is
available.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259498 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-02 13:52:43 +00:00
Sanjay Patel
54543aceab clean up; NFC
function names, comments, formatting, typos


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259322 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-31 16:32:23 +00:00
Matthias Braun
96c7162300 Use Support/DataTypes.h instead of cstdint
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259282 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-30 01:14:01 +00:00
Reid Kleckner
2e10304d4f Fix the MSVC build by moving static asserts into constructors
Apparently MSVC won't allow you to ask for the sizeof() a data member at
class scope.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259257 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 22:40:22 +00:00
Matthias Braun
7448ec5a3d Need #include <cstdint> for uint64_t
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259255 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 22:35:29 +00:00
Matthias Braun
62c2e3cdee Need #include <climit> for CHAR_BIT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259254 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 22:30:30 +00:00
Matthias Braun
1a0e291e60 AttributeSetImpl: Summarize existing function attributes in a bitset.
The majority of attribute queries checks for the existence of an enum
attribute in the FunctionIndex slot. We only have 48 of those and can
therefore summarize them in an uint64_t bitset which measurably improves
compile time.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259252 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 22:25:19 +00:00
Matthias Braun
a5c14e4492 AttributeSetNode: Summarize existing attributes in a bitset.
The majority of queries just checks for the existince of an enum
attribute.  We only have 48 of those and can summaryiz them in an
uint64_t bitfield so we can avoid searching the list. This improves
"opt" compile time by 1-4% in my measurements.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259251 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 22:25:13 +00:00
Yaron Keren
55307987a1 Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 post commit comment.
clang part in r259232, this is the LLVM part of the patch.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259240 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 20:50:44 +00:00
Oliver Stannard
b95072ef89 Revert r259035, it introduces a cyclic library dependency
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259045 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 13:19:47 +00:00
Oliver Stannard
ef19a274ad Add backend dignostic printer for unsupported features
Re-commit of r258951 after fixing layering violation.

The related LLVM patch adds a backend diagnostic type for reporting
unsupported features, this adds a printer for them to clang.

In the case where debug location information is not available, I've
changed the printer to report the location as the first line of the
function, rather than the closing brace, as the latter does not give the
user any information. This also affects optimisation remarks.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259035 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 10:07:27 +00:00
NAKAMURA Takumi
c1aeea845d Revert r258951 (and r258950), "Refactor backend diagnostics for unsupported features"
It broke layering violation in LLVMIR.

clang r258950 "Add backend dignostic printer for unsupported features"
llvm  r258951 "Refactor backend diagnostics for unsupported features"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259016 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 04:41:32 +00:00
Evgeniy Stepanov
ca14b57177 Tweak unnamed label syntax in textual IR for easier matching in tests.
Change the unnamed label comments like
  ; <label>:8  ; preds = %1
to
  ; <label>:8:  ; preds = %1

This way lit tests can match [[LABEL]]: in both asserts and no-asserts builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258993 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27 21:53:08 +00:00
Benjamin Kramer
b8c1bbf870 One more batch of self-containing headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258974 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27 19:29:56 +00:00
Oliver Stannard
bf8415a84d Refactor backend diagnostics for unsupported features
The BPF and WebAssembly backends had identical code for emitting errors
for unsupported features, and AMDGPU had very similar code. This merges
them all into one DiagnosticInfo subclass, that can be used by any
backend.

There should be minimal functional changes here, but some AMDGPU tests
have been updated for the new format of errors (it used a slightly
different format to BPF and WebAssembly). The AMDGPU error messages will
now benefit from having precise source locations when debug info is
available.

The implementation of DiagnosticInfoUnsupported::print must be in
lib/Codegen rather than in the existing file in lib/IR/ to avoid
introducing a dependency from IR to CodeGen.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258951 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27 17:30:33 +00:00
Reid Kleckner
53e35e63a2 [cmake] Remove /Og- flag which was working around PR24785
With r258897, MSVC 2013 now successfully compiles Function.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258899 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27 01:52:46 +00:00
Reid Kleckner
dc8eb983e7 Handle more edge cases in intrinsic name binary search
I tried to make the AMDGPU intrinsic info table use this instead of
another StringMatcher, and some issues arose.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258871 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 22:33:19 +00:00
Chris Bieneman
caeade4234 Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened."
- Obi Wan Kenobi

Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark

Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258861 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 21:29:08 +00:00
Reid Kleckner
8a1bace95a Use binary search for intrinsic ID lookups
This improves compile time of Function.cpp from 57s to 37s for me
locally.  Intrinsic IDs are cached on the Function object, so this
shouldn't regress performance.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258774 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 02:06:41 +00:00
Manuel Jacob
2d0376c55d Remove duplicate documentation in Attributes.cpp. NFC.
The documentation for these methods is already present in the header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258648 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-23 22:42:24 +00:00
Manuel Jacob
9690516835 Replace Type::getInt32Ty() and comparison by isIntegerTy(32). NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258480 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 03:30:27 +00:00
Eduard Burtescu
a269478394 [opaque pointer types] [NFC] DataLayout::getIndexedOffset: take source element type instead of pointer type and rename to getIndexedOffsetInType.
Summary:

Reviewers: mjacob, dblaikie

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258478 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 03:08:27 +00:00
Eduard Burtescu
17a7116948 [opaque pointer types] [NFC] gep_type_{begin,end} now take source element type and address space.
Reviewers: mjacob, dblaikie

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258474 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 01:33:43 +00:00
Sanjoy Das
e6a9ed76ea Add a "gc-transition" operand bundle
Summary:
This adds a new kind of operand bundle to LLVM denoted by the
`"gc-transition"` tag.  Inputs to `"gc-transition"` operand bundle are
lowered into the "transition args" section of `gc.statepoint` by
`RewriteStatepointsForGC`.

This removes the last bit of functionality that was unsupported in the
deopt bundle based code path in `RewriteStatepointsForGC`.

Reviewers: pgavlin, JosephTremoulet, reames

Subscribers: sanjoy, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258338 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 19:50:25 +00:00
Ivan Krasin
d54bc6a415 [Verifier] Fix performance regression for LTO builds
Summary:
Fix a significant performance regression by introducing GlobalValueVisited field and reusing the map.
This is a follow up to r257823 that slowed down linking Chrome with LTO by 2.5x.

If you revert this commit, please, also revert r257823.

BUG=https://llvm.org/bugs/show_bug.cgi?id=26214

Reviewers: pcc, loladiro, joker.eph

Subscribers: krasin1, joker.eph, loladiro, pcc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258297 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 08:41:22 +00:00
Eduard Burtescu
f70dc429e7 [opaque pointer types] [NFC] GEP: replace get(Pointer)ElementType uses with get{Source,Result}ElementType.
Summary:
GEPOperator: provide getResultElementType alongside getSourceElementType.
This is made possible by adding a result element type field to GetElementPtrConstantExpr, which GetElementPtrInst already has.

GEP: replace get(Pointer)ElementType uses with get{Source,Result}ElementType.

Reviewers: mjacob, dblaikie

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258145 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 17:28:00 +00:00
Manuel Jacob
5ad54e5885 Fix constant folding of constant vector GEPs with undef or null as pointer argument.
Reviewers: eddyb

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258134 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 16:34:31 +00:00
Manuel Jacob
95992a2e04 Rename Variable Ptr to PtrTy. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258130 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 15:21:15 +00:00
Manuel Jacob
75e1cfb035 GlobalValue: use getValueType() instead of getType()->getPointerElementType().
Reviewers: mjacob

Subscribers: jholewinski, arsenm, dsanders, dblaikie

Patch by Eduard Burtescu.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257999 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-16 20:30:46 +00:00
David Blaikie
da899da9a1 [opaque pointer types] Remove an unnecessary extra explicit value type in Function
Now that this is up in GlobalValue, just use the value there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257949 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-15 23:07:58 +00:00
Rafael Espindola
17920c238d Bring back "Assert that we have all use/users in the getters."
This reverts commit r257751, bringing back r256105.

The problem the assert found was fixed in r257915.

Original commit message:

Assert that we have all use/users in the getters.

An error that is pretty easy to make is to use the lazy bitcode reader
and then do something like

if (V.use_empty())

The problem is that uses in unmaterialized functions are not accounted
for.

This patch adds asserts that all uses are known.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257920 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-15 19:00:20 +00:00
James Y Knight
b707e2a85c Stop increasing alignment of externally-visible globals on ELF
platforms.

With ELF, the alignment of a global variable in a shared library will
get copied into an executables linked against it, if the executable even
accesss the variable. So, it's not possible to implicitly increase
alignment based on access patterns, or you'll break existing binaries.

This happened to affect libc++'s std::cout symbol, for example. See
thread: http://thread.gmane.org/gmane.comp.compilers.clang.devel/45311

(This is a re-commit of r257719, without the bug reported in
PR26144. I've tweaked the code to not assert-fail in
enforceKnownAlignment when computeKnownBits doesn't recurse far enough
to find the underlying Alloca/GlobalObject value.)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257902 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-15 16:33:06 +00:00
Keno Fischer
506b733a0b Once again revert debug info verifier changes
Yet another wave of buildbot failures (though fewer this time).
I'm only reverting the Verifier changes, as the test cases
will be fine without them as well, and touching them as often
just introduces unnecessary churn.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257855 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-15 02:12:38 +00:00
Keno Fischer
621b821be3 Reapply r257105 "[Verifier] Check that debug values have proper size"
I originally reapplied this in 257550, but had to revert again due to bot
breakage. The only change in this version is to allow either the TypeSize
or the TypeAllocSize of the variable to be the one represented in debug info
(hopefully in the future we can figure out how to encode the difference).
Additionally, several bot failures following r257550, were due to
optimizer bugs now fixed in r257787 and r257795.

r257550 commit message was:

```
The follow extra changes were made to test cases:

Manually making the variable be the actual type instead of a pointer
to avoid pointer-size differences in generic code:

    LLVM :: DebugInfo/Generic/2010-03-24-MemberFn.ll
    LLVM :: DebugInfo/Generic/2010-04-06-NestedFnDbgInfo.ll
    LLVM :: DebugInfo/Generic/2010-05-03-DisableFramePtr.ll
    LLVM :: DebugInfo/Generic/varargs.ll

Delete sizing information from debug info for the same reason
(but the presence of the pointer was important to the test case):

    LLVM :: DebugInfo/Generic/restrict.ll
    LLVM :: DebugInfo/Generic/tu-composite.ll
    LLVM :: Linker/type-unique-type-array-a.ll
    LLVM :: Linker/type-unique-simple2.ll

Fixing an incorrect DW_OP_deref

    LLVM :: DebugInfo/Generic/2010-05-03-OriginDIE.ll

Fixing a missing DW_OP_deref

    LLVM :: DebugInfo/Generic/incorrect-variable-debugloc.ll

Additionally, clang should no longer complain during bootstrap should no
longer happen after r257534.

The original commit message was:
``
Summary:
Teach the Verifier to make sure that the storage size given to llvm.dbg.declare
or the value size given to llvm.dbg.value agree with what is declared in
DebugInfo. This is implicitly assumed in a number of passes (e.g. in SROA).
Additionally this catches a number of common mistakes, such as passing a
pointer when a value was intended or vice versa.

One complication comes from stack coloring which modifies the original IR when
it merges allocas in order to make sure that if AA falls back to the IR it gets
the correct result. However, given this new invariant, indiscriminately
replacing one alloca by a different (differently sized one) is no longer valid.
Fix this by just undefing out any use of the alloca in a dbg.declare in this
case.

Additionally, I had to fix a number of test cases. Of particular note:
- I regenerated dbg-changes-codegen-branch-folding.ll from the given source as
  it was affected by the bug fixed in r256077
- two-cus-from-same-file.ll was changed to avoid having a variable-typed debug
  variable as that would depend on the target, even though this test is
  supposed to be generic
- I had to manually declared size/align for reference type. See also the
  discussion for D14275/r253186.
- fpstack-debuginstr-kill.ll required changing `double` to `long double`
- most others were just a question of adding OP_deref
``

```

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257850 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-15 00:46:17 +00:00
Keno Fischer
508bcbefca [Verifier] Check parentage of GVs in dbg metadata
Summary:
Before this the Verifier didn't complain if the GlobalVariable
referenced from a DIGlobalVariable was not in fact in the correct
module (it would crash while writing bitcode though). Fix this by
always checking parantage of GlobalValues while walking constant
expressions and changing the DIGlobalVariable visitor to also
visit the constant it contains.

Reviewers: rafael
Differential Revision: http://reviews.llvm.org/D16059

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257825 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14 22:42:02 +00:00