[LLVMbugs] [Bug 1996] New: llvm doesn't optmize out loads of undef

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Feb 8 18:39:38 PST 2008


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

           Summary: llvm doesn't optmize out loads of undef
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu


define i32 @b() {
entry:
        %b = alloca i32         ; <i32*> [#uses=3]
        %tmp2 = load i32* %b, align 8           ; <i32> [#uses=1]
        %tmp3 = or i32 %tmp2, 11                ; <i32> [#uses=1]
        %tmp4 = and i32 %tmp3, -5               ; <i32> [#uses=1]
        store i32 %tmp4, i32* %b, align 8
        %call = call i32 (...)* @a( i32* %b )           ; <i32> [#uses=0]
        ret i32 undef
}

declare i32 @a(...)

run through opt -std-compile-opts, doesn't change.  The load should get
optimized to undef because it is easy to prove that nothing has been stored
into that location.

This bug affects bitfields.  Original C code:

struct s {unsigned a : 4, b : 4;};
int a();
int b() {
  struct s b;
  b.a = 11;
  a(&b);
}


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