1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

68 Commits

Author SHA1 Message Date
Mehdi Amini
f88efe5f8a DataLayout is mandatory, update the API to reflect it with references.
Summary:
Now that the DataLayout is a mandatory part of the module, let's start
cleaning the codebase. This patch is a first attempt at doing that.

This patch is not exactly NFC as for instance some places were passing
a nullptr instead of the DataLayout, possibly just because there was a
default value on the DataLayout argument to many functions in the API.
Even though it is not purely NFC, there is no change in the
validation.

I turned as many pointer to DataLayout to references, this helped
figuring out all the places where a nullptr could come up.

I had initially a local version of this patch broken into over 30
independant, commits but some later commit were cleaning the API and
touching part of the code modified in the previous commits, so it
seemed cleaner without the intermediate state.

Test Plan:

Reviewers: echristo

Subscribers: llvm-commits

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 231740
2015-03-10 02:37:25 +00:00
Mehdi Amini
29ebc2d39f Make DataLayout Non-Optional in the Module
Summary:
DataLayout keeps the string used for its creation.

As a side effect it is no longer needed in the Module.
This is "almost" NFC, the string is no longer
canonicalized, you can't rely on two "equals" DataLayout
having the same string returned by getStringRepresentation().

Get rid of DataLayoutPass: the DataLayout is in the Module

The DataLayout is "per-module", let's enforce this by not
duplicating it more than necessary.
One more step toward non-optionality of the DataLayout in the
module.

Make DataLayout Non-Optional in the Module

Module->getDataLayout() will never returns nullptr anymore.

Reviewers: echristo

Subscribers: resistor, llvm-commits, jholewinski

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 231270
2015-03-04 18:43:29 +00:00
Adrian Prantl
64d3d9a495 simplify expression
llvm-svn: 226701
2015-01-21 21:23:35 +00:00
Adrian Prantl
c8ae66ee60 Fix a compile issue on MSVC and call finalize().
llvm-svn: 226694
2015-01-21 19:25:35 +00:00
Adrian Prantl
a94057833d Let subprograms with instructions without parent scopes fail the
verification. Tested via a unit test.

Follow-up to r226616.

llvm-svn: 226684
2015-01-21 18:32:56 +00:00
Sanjay Patel
3e2eead641 Fix a logic bug when copying fast-math flags.
"Setting" does not equal "copying". This bug has sat dormant for 2 reasons:
1. The unit test was not adequate.
2. Every current user of the "copyFastMathFlags" API is operating on a new instruction.
   (ie, all existing fast-math flags are off). If you copy flags to an existing
   instruction that has some flags on already, you will not necessarily turn them off
   as expected.

I uncovered this bug while trying to implement a fix for PR20802.

llvm-svn: 216939
2014-09-02 20:03:00 +00:00
Craig Topper
b00824c629 [C++11] Use 'nullptr'.
llvm-svn: 210442
2014-06-08 22:29:17 +00:00
Ahmed Charles
52ce0c101e Replace OwningPtr<T> with std::unique_ptr<T>.
This compiles with no changes to clang/lld/lldb with MSVC and includes
overloads to various functions which are used by those projects and llvm
which have OwningPtr's as parameters. This should allow out of tree
projects some time to move. There are also no changes to libs/Target,
which should help out of tree targets have time to move, if necessary.

llvm-svn: 203083
2014-03-06 05:51:42 +00:00
Chandler Carruth
248195469c [Modules] Move the NoFolder into the IR library as it creates
instructions.

llvm-svn: 202834
2014-03-04 12:05:47 +00:00
Rafael Espindola
4ecee5654d Fix resetting the DataLayout in a Module.
No tool does this currently, but as everything else in a module we should be
able to change its DataLayout.

Most of the fix is in DataLayout to make sure it can be reset properly.

The test uses Module::setDataLayout since the fact that we mutate a DataLayout
is an implementation detail. The module could hold a OwningPtr<DataLayout> and
the DataLayout itself could be immutable.

Thanks to Philip Reames for pushing me in the right direction.

llvm-svn: 202198
2014-02-25 22:23:04 +00:00
Chandler Carruth
8d4f29ba83 Fix a bug in IRBuilder that's been there for who knows how long. It
failed to correctly propagate the NUW and NSW flags to the constant
folder for two instructions. I've added a unittest to cover flag
propagation for the rest of the instructions and constant expressions.

llvm-svn: 198538
2014-01-05 03:22:33 +00:00
Michael Ilseman
fb9a99d2cf Use present fast-math flags when applicable in CreateBinOp
We were previously not adding fast-math flags through CreateBinOp()
when it happened to be making a floating point binary operator. This
patch updates it to do so similarly to directly calling CreateF*().

llvm-svn: 196438
2013-12-05 00:32:09 +00:00
Benjamin Kramer
a2ecba54d6 Give unit test its own LLVMContext so MDNodes aren't leaked even if we never call llvm_shutdown.
Found by valgrind.

llvm-svn: 194797
2013-11-15 09:34:33 +00:00
Aaron Ballman
197142c475 Silencing an MSVC warning.
llvm-svn: 192042
2013-10-05 19:41:41 +00:00
Benjamin Kramer
33abdcddb3 IRBuilder: Add RAII objects to reset insertion points or fast math flags.
Inspired by the object from the SLPVectorizer. This found a minor bug in the
debug loc restoration in the vectorizer where the location of a following
instruction was attached instead of the location from the original instruction.

llvm-svn: 191673
2013-09-30 15:39:48 +00:00
NAKAMURA Takumi
be9f7c27f1 IRTests/IRBuilderTest.cpp: GetIntTy: Delete DL at yourself since it is not linked.
llvm-svn: 173238
2013-01-23 08:31:28 +00:00
NAKAMURA Takumi
9a7842a6f2 IRTests/IRBuilderTest.cpp: Let GV added to the module.
It fixes --vg-leak.

llvm-svn: 173237
2013-01-23 08:30:39 +00:00
Chandler Carruth
bcfdf656b1 Rename the VMCore unittest tree to IR. Somehow was missed when doing the
library rename.

llvm-svn: 171747
2013-01-07 15:35:46 +00:00