[LLVMbugs] [Bug 10103] New: enum type translation functions generate a lot of code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 8 15:46:43 PDT 2011


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

           Summary: enum type translation functions generate a lot of code
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jmuizelaar at mozilla.com
                CC: llvmbugs at cs.uiuc.edu


The following code compiles to a jump table instead of a simpler version that
uses the fact that the enum values are the same:

enum bar {
        MROUND, MSQUARE, MBUTT, MTRI, MERROR
};

enum foo { FROUND, FSQUARE, FBUTT, FTRI, FERROR} ;

enum foo t(enum bar m) {
        switch (m) {
                case MROUND:
                        return FROUND;
                case MSQUARE:
                        return FSQUARE;
                case MBUTT:
                        return FBUTT;
                case MTRI:
                        return FTRI;
                default:
                case MERROR:
                        return FERROR;
        }
}

-- 
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