[llvm-commits] [llvm] r99400 - in /llvm/trunk: lib/CodeGen/LiveIntervalAnalysis.cpp test/CodeGen/Generic/2010-03-24-liveintervalleak.ll

Török Edwin edwintorok at gmail.com
Wed Mar 24 13:58:48 PDT 2010


On 03/24/2010 10:24 PM, Bob Wilson wrote:
> This breaks MultiSource/Applications/ClamAV/clamscan.

I didn't think that my attempt to fix a bug in ClamAV would introduce a
bug in compiling ClamAV :)

> I'm going to revert it for now.

OK.

Could you give me some more details on which configuration this breaks?
Did it happen when running the test-suite with llvm-gcc or clang?
Did llc crash, or did valgrind show an error?

If I apply my patch on top of llvm 2.7 I only get these unrelated
invalid reads from valgrind (when running test-suite with clang)

==6908== Memcheck, a memory error detector

==6908== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.

==6908== Using Valgrind-3.5.0-Debian and LibVEX; rerun with -h for
copyright info
==6908== Command: /home/edwin/llvm2.7/llvm-2.7/Release/bin/llc
-asm-verbose=false -O3 Output/clamscan.llvm.bc -o Output/clamscan.llc.s
-info-output-file=/home/edwin/llvm2.7/llvm-2.7/projects/llvm-test/MultiSource/Applications/ClamAV/Output/clamscan.llc.s.info
-stats -time-passes

==6908==

==6908== Invalid read of size 1

==6908==    at 0x7A7A54: void
std::__insertion_sort<llvm::StringRef*>(llvm::StringRef*,
llvm::StringRef*) (in /home/edwin/llvm2.7/llvm-2.7/Release/bin/llc)


==6908==    by 0x79225B:
llvm::X86TargetLowering::ExpandInlineAsm(llvm::CallInst*) const (in
/home/edwin/llvm2.7/llvm-2.7/Release/bin/llc)


==6908==    by 0xA8BABD: (anonymous
namespace)::CodeGenPrepare::runOnFunction(llvm::Function&) (in
/home/edwin/llvm2.7/llvm-2.7/Release/bin/llc)


==6908==    by 0xBFDBB5:
llvm::FPPassManager::runOnFunction(llvm::Function&) (in
/home/edwin/llvm2.7/llvm-2.7/Release/bin/llc)
==6908==    by 0xBFDD90:
llvm::FunctionPassManagerImpl::run(llvm::Function&) (in
/home/edwin/llvm2.7/llvm-2.7/Release/bin/llc)
==6908==    by 0xBFDFBD: llvm::FunctionPassManager::run(llvm::Function&)
(in /home/edwin/llvm2.7/llvm-2.7/Release/bin/llc)
==6908==    by 0x52A113: main (in
/home/edwin/llvm2.7/llvm-2.7/Release/bin/llc)

==6908==  Address 0x7954db8 is 24 bytes inside a block of size 58 free'd

==6908==    at 0x4A06ACE: operator delete(void*)
(vg_replace_malloc.c:346)

==6908==    by 0x3CD5AA8948: std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::~basic_string() (in
/usr/lib/libstdc++.so.6.0.13)

==6908==    by 0x79286A:
llvm::X86TargetLowering::ExpandInlineAsm(llvm::CallInst*) const (in
/home/edwin/llvm2.7/llvm-2.7/Release/bin/llc)


==6908==    by 0xA8BABD: (anonymous
namespace)::CodeGenPrepare::runOnFunction(llvm::Function&) (in
/home/edwin/llvm2.7/llvm-2.7/Release/bin/llc)


==6908==    by 0xBFDBB5:
llvm::FPPassManager::runOnFunction(llvm::Function&) (in
/home/edwin/llvm2.7/llvm-2.7/Release/bin/llc)
==6908==    by 0xBFDD90:
llvm::FunctionPassManagerImpl::run(llvm::Function&) (in
/home/edwin/llvm2.7/llvm-2.7/Release/bin/llc)
==6908==    by 0xBFDFBD: llvm::FunctionPassManager::run(llvm::Function&)
(in /home/edwin/llvm2.7/llvm-2.7/Release/bin/llc)
==6908==    by 0x52A113: main (in
/home/edwin/llvm2.7/llvm-2.7/Release/bin/llc)

==6908==

> 
> On Mar 24, 2010, at 6:50 AM, Torok Edwin wrote:
> 
>> Author: edwin
>> Date: Wed Mar 24 08:50:36 2010
>> New Revision: 99400
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=99400&view=rev
>> Log:
>> Fix memory leak in liveintervals: the destructor for VNInfos must be called,
>> otherwise the SmallVector it contains doesn't free its memory.
>> In most cases LiveIntervalAnalysis could get away by not calling the destructor,
>> because VNInfos are bumpptr-allocated, and smallvectors usually don't grow.
>> However when the SmallVector does grow it always leaks.


Best regards,
--Edwin




More information about the llvm-commits mailing list