[llvm-commits] [llvm] r99160 - in /llvm/trunk: lib/VMCore/ConstantsContext.h lib/VMCore/LLVMContextImpl.cpp tools/bugpoint/BugDriver.cpp tools/bugpoint/BugDriver.h
Kalle Raiskila
kalle.raiskila at nokia.com
Mon Apr 26 03:01:08 PDT 2010
Hi,
sorry to drag up this old commit, but this makes bugpoint segfault for me.
The testcase I have causes a misscompilation only on SPU, and I cannot reproduce
this error on the other platforms (i.e. x86). I'd be happy to help to try to
track down this issue, in case you don't have a CellBE handy :) Or should I just
open a PR?
Last lines that bugpoint spews out are below.
kalle
*** Attempting to perform final cleanups: <llc>
Emitted bitcode to 'bugpoint-reduced-simplified.bc'
While deleting: [22 x float] %
Use still stuck around after Def is destroyed:@vconst = constant [22 x float]
[float 0 bugpoint 0x104c6e08
1 bugpoint 0x104c76f0
2 0x00100344 __kernel_sigtramp32 + 0
3 bugpoint 0x100ca954 llvm::raw_ostream::operator<<(char) + 100
4 bugpoint 0x103a8038
5 bugpoint 0x103a2f38
6 bugpoint 0x103a56e8
7 bugpoint 0x103a2c6c llvm::Value::print(llvm::raw_ostream&,
llvm::AssemblyAnnotationWriter*) const + 1516
8 bugpoint 0x10453ac8 llvm::Value::~Value() + 536
9 bugpoint 0x103c90e4 llvm::ConstantArray::~ConstantArray() + 148
10 bugpoint 0x1041488c llvm::LLVMContextImpl::~LLVMContextImpl() + 972
11 bugpoint 0x10411658 llvm::LLVMContext::~LLVMContext() + 56
12 bugpoint 0x10411d70 llvm::object_deleter<llvm::LLVMContext>::call(void*) + 48
13 bugpoint 0x104a0750 llvm::ManagedStaticBase::destroy() const + 96
14 bugpoint 0x104a07e4 llvm::llvm_shutdown() + 68
15 bugpoint 0x100d8e5c main + 396
16 libc.so.6 0x0fbfdb24
17 libc.so.6 0x0fbfdce0
Stack dump:
0. Program arguments: bugpoint mrfir-all.ll -run-llc -safe-run-cbe
--tool-args --march=cellspu
Segmentation fault
Jeffrey Yasskin skrev:
> Author: jyasskin
> Date: Mon Mar 22 00:23:37 2010
> New Revision: 99160
>
> URL: http://llvm.org/viewvc/llvm-project?rev=99160&view=rev
> Log:
> 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().
>
>
> Modified:
> llvm/trunk/lib/VMCore/ConstantsContext.h
> llvm/trunk/lib/VMCore/LLVMContextImpl.cpp
> llvm/trunk/tools/bugpoint/BugDriver.cpp
> llvm/trunk/tools/bugpoint/BugDriver.h
>
> Modified: llvm/trunk/lib/VMCore/ConstantsContext.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantsContext.h?rev=99160&r1=99159&r2=99160&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/ConstantsContext.h (original)
> +++ llvm/trunk/lib/VMCore/ConstantsContext.h Mon Mar 22 00:23:37 2010
> @@ -600,8 +600,8 @@
> void freeConstants() {
> for (typename MapTy::iterator I=Map.begin(), E=Map.end();
> I != E; ++I) {
> - if (I->second->use_empty())
> - delete I->second;
> + // Asserts that use_empty().
> + delete I->second;
> }
> }
>
>
> Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.cpp?rev=99160&r1=99159&r2=99160&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/LLVMContextImpl.cpp (original)
> +++ llvm/trunk/lib/VMCore/LLVMContextImpl.cpp Mon Mar 22 00:23:37 2010
> @@ -12,6 +12,7 @@
> //===----------------------------------------------------------------------===//
>
> #include "LLVMContextImpl.h"
> +#include <algorithm>
>
> LLVMContextImpl::LLVMContextImpl(LLVMContext &C)
> : TheTrueVal(0), TheFalseVal(0),
> @@ -34,10 +35,32 @@
> OpaqueTypes.insert(AlwaysOpaqueTy);
> }
>
> +namespace {
> +struct DropReferences {
> + // Takes the value_type of a ConstantUniqueMap's internal map, whose 'second'
> + // is a Constant*.
> + template<typename PairT>
> + void operator()(const PairT &P) {
> + P.second->dropAllReferences();
> + }
> +};
> +}
> +
> LLVMContextImpl::~LLVMContextImpl() {
> + std::for_each(ExprConstants.map_begin(), ExprConstants.map_end(),
> + DropReferences());
> + std::for_each(ArrayConstants.map_begin(), ArrayConstants.map_end(),
> + DropReferences());
> + std::for_each(StructConstants.map_begin(), StructConstants.map_end(),
> + DropReferences());
> + std::for_each(UnionConstants.map_begin(), UnionConstants.map_end(),
> + DropReferences());
> + std::for_each(VectorConstants.map_begin(), VectorConstants.map_end(),
> + DropReferences());
> ExprConstants.freeConstants();
> ArrayConstants.freeConstants();
> StructConstants.freeConstants();
> + UnionConstants.freeConstants();
> VectorConstants.freeConstants();
> AggZeroConstants.freeConstants();
> NullPtrConstants.freeConstants();
> @@ -45,13 +68,11 @@
> InlineAsms.freeConstants();
> for (IntMapTy::iterator I = IntConstants.begin(), E = IntConstants.end();
> I != E; ++I) {
> - if (I->second->use_empty())
> - delete I->second;
> + delete I->second;
> }
> for (FPMapTy::iterator I = FPConstants.begin(), E = FPConstants.end();
> I != E; ++I) {
> - if (I->second->use_empty())
> - delete I->second;
> + delete I->second;
> }
> AlwaysOpaqueTy->dropRef();
> for (OpaqueTypesTy::iterator I = OpaqueTypes.begin(), E = OpaqueTypes.end();
>
> Modified: llvm/trunk/tools/bugpoint/BugDriver.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/BugDriver.cpp?rev=99160&r1=99159&r2=99160&view=diff
> ==============================================================================
> --- llvm/trunk/tools/bugpoint/BugDriver.cpp (original)
> +++ llvm/trunk/tools/bugpoint/BugDriver.cpp Mon Mar 22 00:23:37 2010
> @@ -75,6 +75,10 @@
> run_as_child(as_child), run_find_bugs(find_bugs), Timeout(timeout),
> MemoryLimit(memlimit), UseValgrind(use_valgrind) {}
>
> +BugDriver::~BugDriver() {
> + delete Program;
> +}
> +
>
> /// ParseInputFile - Given a bitcode or assembly input filename, parse and
> /// return it, or return null if not possible.
>
> Modified: llvm/trunk/tools/bugpoint/BugDriver.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/BugDriver.h?rev=99160&r1=99159&r2=99160&view=diff
> ==============================================================================
> --- llvm/trunk/tools/bugpoint/BugDriver.h (original)
> +++ llvm/trunk/tools/bugpoint/BugDriver.h Mon Mar 22 00:23:37 2010
> @@ -65,6 +65,7 @@
> BugDriver(const char *toolname, bool as_child, bool find_bugs,
> unsigned timeout, unsigned memlimit, bool use_valgrind,
> LLVMContext& ctxt);
> + ~BugDriver();
>
> const char *getToolName() const { return ToolName; }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list