[LLVMbugs] [Bug 5229] New: llvm-gcc generates ton of duplicate landing pads

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Oct 17 14:55:11 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=5229

           Summary: llvm-gcc generates ton of duplicate landing pads
           Product: tools
           Version: 2.2
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: code-quality
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: clattner at apple.com
                CC: llvmbugs at cs.uiuc.edu


Consider this testcase: 

struct A
{
  bool foo(int*) const;
} a;

struct B {};

struct B1 : B
{
  bool (A::*pmf)(int*) const;
  const A* pa;

  B1() : pmf(&A::foo), pa(&a) {}
  bool operator()() const { return (pa->*pmf)(new int); }
};

struct B2 : B
{
  B1 b1;

  B2(const B1& _b1) : b1(_b1) {}
  bool operator()() const { return b1(); }
};

template<int> struct C
{
  void bar(B2 b2) { while (b2()) ; }
  C() { bar(B2(B1())); }
};

void baz(int i){
  switch(i) {
    case 0: new C<0>;
    case 1: new C<1>;
    case 2: new C<2>;
  }
}

Compiled with llvm-gcc, it produces a ton of identical landing pads:

lpad:                                             ; preds = %.noexc,
%_ZNK2B2clEv.exit.i.i
  %eh_ptr = tail call i8* @llvm.eh.exception()    ; <i8*> [#uses=2]
  %upgraded.eh_select14 = tail call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8*
%eh_ptr, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ;
<i32> [#uses=0]
  tail call void @_ZdlPv(i8* %0) nounwind
  br label %Unwind

lpad15:                                           ; preds = %.noexc11,
%_ZNK2B2clEv.exit.i.i10
  %eh_ptr16 = tail call i8* @llvm.eh.exception()  ; <i8*> [#uses=2]
  %upgraded.eh_select18 = tail call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8*
%eh_ptr16, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ;
<i32> [#uses=0]
  tail call void @_ZdlPv(i8* %4) nounwind
  br label %Unwind

lpad19:                                           ; preds = %.noexc7,
%_ZNK2B2clEv.exit.i.i6
  %eh_ptr20 = tail call i8* @llvm.eh.exception()  ; <i8*> [#uses=2]
  %upgraded.eh_select22 = tail call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8*
%eh_ptr20, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ;
<i32> [#uses=0]
  tail call void @_ZdlPv(i8* %8) nounwind
  br label %Unwind

This is bad.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list