Skip to content

llvm-g++ front-end outputing code that is not folded by irbuilder? #3649

@lattner

Description

@lattner
Bugzilla Link 3277
Resolution FIXED
Resolved on May 06, 2009 11:26
Version 1.0
OS All
CC @asl

Extended Description

On this testcase (Reduced from kc++):
class impl_abstract_phylum {
public:
virtual int subphylum(int) const;
virtual ~impl_abstract_phylum() { }
};
int impl_abstract_phylum::subphylum(int no) const {
return 0;
}

llvm-g++ -O0 is producing:

define linkonce void @​_ZN20impl_abstract_phylumD1Ev(%struct.impl_abstract_phylum* %this) nounwind {
entry:
...
br label %bb

bb: ; preds = %entry
%2 = trunc i32 0 to i8 ; [#uses=1]
%toBool = icmp ne i8 %2, 0 ; [#uses=1]
br i1 %toBool, label %bb1, label %bb2

bb1: ; preds = %bb
%3 = load %struct.impl_abstract_phylum** %this_addr, align 4
%4 = bitcast %struct.impl_abstract_phylum* %3 to i8* ; <i8*> [#uses=1]
call void @​_ZdlPv(i8* %4) nounwind
br label %bb2

This is curious for two reasons: 1) we're emitting obviously dead code, which slows down compilation at -O0. 2) IRbuilder should be folding the %2 truncate instruction!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillallvm-toolsAll llvm tools that do not have corresponding tagslow-compile

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions