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

106 Commits

Author SHA1 Message Date
Rafael Espindola
2331b01068 [bugpoint] Fix crash when testing for miscompilation.
Method BugDriver::performFinalCleanups(...) would delete Module object
it worked on, which was also deleted by its caller
(e.g. TestCodeGenerator(...)). Changed the code to avoid double delete
and make Module ownership slightly clearer.

Patch by Andrzej Janik.

llvm-svn: 330763
2018-04-24 20:15:27 +00:00
Rafael Espindola
829dbc0aeb Change the BugDriver to store the current module with std::unique_ptr.
While there, change a bunch of helper functions to take references to
avoid adding calls to get().

This should conclude the bugpoint yak shaving.

llvm-svn: 325177
2018-02-14 21:44:34 +00:00
Rafael Espindola
cad5ba463c Convert another use of createUniqueFile to TempFile::create.
This one requires a new small feature in TempFile: the ability to keep
the temporary file with the temporary name.

llvm-svn: 318458
2017-11-16 21:40:10 +00:00
Rafael Espindola
7e005d18fb Convert another use of createUniqueFile to TempFile::create.
llvm-svn: 318427
2017-11-16 17:35:50 +00:00
Justin Bogner
ed0c6b769f bugpoint: Return Errors instead of passing around strings
This replaces the threading of `std::string &Error` through all of
these APIs with checked Error returns instead. There are very few
places here that actually emit any errors right now, but threading the
APIs through will allow us to replace a bunch of exit(1)'s that are
scattered through this code with proper error handling.

This is more or less NFC, but does move around where a couple of error
messages are printed out.

llvm-svn: 280720
2016-09-06 17:18:22 +00:00
Justin Bogner
45a874b8d4 Revert "bugpoint: Stop threading errors through APIs that never fail"
This isn't the right thing to do - it turns out a number of the APIs
that "never fail" just exit(1) if something bad happens. We can and
should thread Error through this instead.

That diff will make more sense with this reverted. Sorry for the
noise.

This reverts r280690

llvm-svn: 280691
2016-09-06 04:45:37 +00:00
Justin Bogner
12cec98bae bugpoint: Stop threading errors through APIs that never fail
This simplifies ListReducer and most of its subclasses by removing the
std::string &Error that was threaded through all of them but almost
never used. If we end up needing error handling in more places here we
can reinstate it using llvm::Error instead of these unwieldy strings.

The 2 cases (out of 12) that actually can hit the error cases are a
little bit awkward now, but those will clean up as I refactor this API
further.

llvm-svn: 280690
2016-09-06 04:04:13 +00:00
Justin Bogner
2d09a9efc2 bugpoint: clang-format all of bugpoint. NFC
I'm going to clean up the APIs here a bit and touch many many lines
anyway.

llvm-svn: 280450
2016-09-02 01:21:37 +00:00
Philip Reames
bb2869fe21 [bugpoint] Delete a stale comment.
llvm-svn: 274093
2016-06-29 03:02:01 +00:00
Philip Reames
f5ddf407a2 [bugpoint] Unwrap one level of wrapper functions [NFC]
llvm-svn: 274092
2016-06-29 03:01:13 +00:00
Philip Reames
c744416a3d [bugpoint] Simplify code by moving exception to only caller
llvm-svn: 274083
2016-06-29 00:26:21 +00:00
Benjamin Kramer
d415569b3b Apply most suggestions of clang-tidy's performance-unnecessary-value-param
Avoids unnecessary copies. All changes audited & pass tests with asan.
No functional change intended.

llvm-svn: 272190
2016-06-08 19:09:22 +00:00
Rafael Espindola
8f77f17d0f Return std::unique_ptr from SplitFunctionsOutOfModule. NFC.
llvm-svn: 255084
2015-12-09 00:34:10 +00:00
Hal Finkel
2deea83231 [bugpoint] Fix "Alias must point to a definition" problems
GlobalAliases may reference function definitions, but not function declarations.

bugpoint would sometimes create invalid IR by deleting a function's body (thus
mutating a function definition into a declaration) without first 'fixing' any
GlobalAliases that reference that function definition.

This change iteratively prevents that issue. Before deleting a function's body,
it scans the module for GlobalAliases which reference that function. When
found, it eliminates them using replaceAllUsesWith.

Fixes PR20788.

Patch by Nick Johnson!

llvm-svn: 254171
2015-11-26 19:23:49 +00:00
Davide Italiano
9fca22ddf4 [Bugpoint] Use 'CC' instead of 'GCC' for variable naming.
We now use clang by default and fallback to gcc when requested.
With this commit, names reflect reality. No functional change
intended.

Discussed with: Rafael Espindola.

llvm-svn: 250321
2015-10-14 20:29:54 +00:00
Rafael Espindola
7c0442fa71 Return a std::unique_ptr from parseInputFile and propagate. NFC.
The memory management in BugPoint is fairly convoluted, so this just unwraps
one layer by changing the return type of functions that always return
owned Modules.

llvm-svn: 216464
2014-08-26 17:19:03 +00:00
Benjamin Kramer
da144ed5a2 Canonicalize header guards into a common format.
Add header guards to files that were missing guards. Remove #endif comments
as they don't seem common in LLVM (we can easily add them back if we decide
they're useful)

Changes made by clang-tidy with minor tweaks.

llvm-svn: 215558
2014-08-13 16:26:38 +00:00
Craig Topper
b663bffa27 [C++] Use 'nullptr'.
llvm-svn: 207394
2014-04-28 04:05:08 +00:00
Chandler Carruth
63713e9f95 [Modules] Move ValueMap to the IR library. While this class does not
directly care about the Value class (it is templated so that the key can
be any arbitrary Value subclass), it is in fact concretely tied to the
Value class through the ValueHandle's CallbackVH interface which relies
on the key type being some Value subclass to establish the value handle
chain.

Ironically, the unittest is already in the right library.

llvm-svn: 202824
2014-03-04 11:26:31 +00:00
Hal Finkel
461bd33944 Fix bugpoint execution/reference output file name
sys::fs::unique_file will now loop infinitely if provided with a file name
without '%' characters and the input file already exists. As a result, bugpoint
cannot use a fixed file name for the execution output (including the reference
output).

llvm-svn: 185166
2013-06-28 16:37:52 +00:00
Rafael Espindola
8cdee56810 Don't use PathV1.h in tools/bugpoint/Miscompilation.cpp.
llvm-svn: 184193
2013-06-18 15:29:32 +00:00
Chandler Carruth
800daa7d3d Sort the #include lines for tools/...
Again, tools are trickier to pick the main module header for than
library source files. I've started to follow the pattern of using
LLVMContext.h when it is included as a stub for program source files.

llvm-svn: 169252
2012-12-04 10:44:52 +00:00
Rafael Espindola
aa5448f520 Be more consistent in using ValueToValueMapTy.
llvm-svn: 116387
2010-10-13 01:36:30 +00:00
Rafael Espindola
c90e97f163 Use RunPassesOn as in the rest of bugpoint.
llvm-svn: 110682
2010-08-10 15:46:11 +00:00
Rafael Espindola
a2e8c6383e Most of bugpoint now only needs to know the pass names.
llvm-svn: 110534
2010-08-08 03:55:08 +00:00
Rafael Espindola
0236b41a5e Run opt instead of bugpoint itself.
llvm-svn: 110524
2010-08-07 23:03:21 +00:00
Bob Wilson
74157ac156 Revert bugpoint change due to buildbot breakage.
--- Reverse-merging r110333 into '.':
U    tools/bugpoint/BugDriver.h
U    tools/bugpoint/OptimizerDriver.cpp
U    tools/bugpoint/bugpoint.cpp
U    tools/bugpoint/BugDriver.cpp

llvm-svn: 110341
2010-08-05 16:26:32 +00:00
Rafael Espindola
3ef1be0f0a Run opt instead of bugpoint itself.
Fixes PR753.

llvm-svn: 110333
2010-08-05 15:25:38 +00:00
Rafael Espindola
ca885492ab Add const to compileProgram and to the various test functions in CrashDebugger.
llvm-svn: 110306
2010-08-05 03:00:22 +00:00
Rafael Espindola
0755ad0602 Add a Module argument to the remaining runPasses methods and mark getContext
const.

llvm-svn: 110300
2010-08-05 02:16:32 +00:00
Rafael Espindola
e580313f9e Make EmitProgressBitcode const and add a Module argument to runPasses. Use
that argument to simplify runPassesOn.

llvm-svn: 110291
2010-08-05 00:29:04 +00:00
Rafael Espindola
b74919778f Add const to some methods and change TestMergedProgram to return the merged
module and take a const BugDriver.

llvm-svn: 109951
2010-07-31 14:34:49 +00:00
Rafael Espindola
ba90b65153 Add a Program argument to diffProgram to avoid a use of swapProgramIn.
llvm-svn: 109859
2010-07-30 14:19:00 +00:00
Rafael Espindola
a618c1e4ec Instead of abusing swapProgramIn, just add a Module argument to
EmitProgressBitcode.

llvm-svn: 109602
2010-07-28 18:12:30 +00:00
Owen Anderson
5f218b8612 Speculatively revert r108813, in an attempt to get the self-host buildbots working again. I don't see why this patch
would cause them to fail the way they are, but none of the other intervening patches seem likely either.

llvm-svn: 108818
2010-07-20 08:26:15 +00:00
Owen Anderson
cf625d0179 Reapply r108794, a fix for the failing test from last time.
llvm-svn: 108813
2010-07-20 06:52:42 +00:00
Daniel Dunbar
3280e3aebf Revert r108794, "Separate PassInfo into two classes: a constructor-free
superclass (StaticPassInfo) and a constructor-ful subclass (PassInfo).", it is
breaking teh everything.

llvm-svn: 108805
2010-07-20 03:06:07 +00:00
Owen Anderson
3502f9a91b Separate PassInfo into two classes: a constructor-free superclass (StaticPassInfo) and a constructor-ful subclass (PassInfo).
llvm-svn: 108794
2010-07-20 01:19:58 +00:00
Duncan Sands
f7b98e2b1e Convert some tab stops into spaces.
llvm-svn: 108130
2010-07-12 08:16:59 +00:00
Devang Patel
0c927a80fe Use ValueMap instead of DenseMap.
The ValueMapper used by various cloning utility maps MDNodes also.

llvm-svn: 106706
2010-06-24 00:33:28 +00:00
Nick Lewycky
2874312841 Remove accidentally committed cruft.
llvm-svn: 101230
2010-04-14 04:46:11 +00:00
Nick Lewycky
396b2fc686 Bugpoint no longer uses exceptions.
llvm-svn: 101228
2010-04-14 04:40:31 +00:00
Nick Lewycky
096fd1e0a6 Remove use of exceptions from bugpoint. No deliberate functionality change!
llvm-svn: 101013
2010-04-12 05:08:25 +00:00
Nick Lewycky
87bd8ff991 Remove dead argument and clean whitespace. No functionality change.
llvm-svn: 100954
2010-04-10 23:18:13 +00:00
Jeffrey Yasskin
94ecd53a3a Free all Constants in ~LLVMConstantImpl. We avoid assertion failures
by dropping all references from all constants that can use other
constants before trying to destroy any of them.

I also had to free bugpoint's Module in ~BugDriver().

llvm-svn: 99160
2010-03-22 05:23:37 +00:00
Jeffrey Yasskin
16289314f6 Bugpoint's default memory limit (100MB) was too low for valgrind, so
this patch raises the default to 800MB when valgrind's active.  800
was chosen semi-arbitrarily.

llvm-svn: 98905
2010-03-19 00:09:28 +00:00
Benjamin Kramer
9a590500ea Make LLVMContext and LLVMContextImpl classes instead of structs.
llvm-svn: 78690
2009-08-11 17:45:13 +00:00
Dan Gohman
ba72f59923 Fix FindExecutable to use sys::Path::GetMainExecutable instead of
just argv[0]. And remove the code for searching the current
working directory and for searching PATH; the point of FindExecutable
is not to find whatever version of the executable can be found by
searching around, but to find an executable that accompanies the
current executable.

Update the tools to use sys::Program::FindProgramByName when they
want PATH searching.

llvm-svn: 78240
2009-08-05 20:21:17 +00:00
Owen Anderson
cf2c39dc30 Factor some of the constants+context related code out into a separate header, to make LLVMContextImpl.h
not hideous.  Also, fix some MSVC compile errors.

llvm-svn: 78115
2009-08-04 22:41:48 +00:00
Dan Gohman
6abbc537f4 Convert more tools code from cerr and cout to errs() and outs().
llvm-svn: 76070
2009-07-16 15:30:09 +00:00