[LLVMbugs] [Bug 1602] New: Mid-level optimizer doesn't "devirtualize" simple reference

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Aug 8 21:03:19 PDT 2007


           Summary: Mid-level optimizer doesn't "devirtualize" simple
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: code-quality, regression
          Severity: enhancement
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sabre at nondot.org
                CC: llvmbugs at cs.uiuc.edu

On this simple C++ ptr-to-method example, the optimizer gets confused by the
ptrtoint inttoptr stuff:

  struct S { virtual void f(); };
  typedef void (S::*P)(void);
  const P p = &S::f; 
 void g(S s) {

This generates atrocious code like:

define void @_Z1g1S(%struct.S* %s) {
        br i1 icmp eq (i32 and (i32 ptrtoint (void (%struct.S*)* inttoptr (i64
1 to void (%struct.S*)*) to i32), i32 1), i32 0), label %cond_next, label

This is optimized away at the codegen level, but the mid-level optimizer should
also eliminate this stuff.


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