[LLVMbugs] [Bug 13957] New: nonnull attribute not used for dce

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 27 12:11:48 PDT 2012


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

             Bug #: 13957
           Summary: nonnull attribute not used for dce
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: htam at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


__attribute__((nonnull(1))) int foo(int* x) {
    return x == NULL;
}

Clang -O3 produces this code:
define i32 @foo(i32* %x) nounwind uwtable readnone ssp {
entry:
  %cmp.i = icmp eq i32* %x, null
  %conv.i = zext i1 %cmp.i to i32
  ret i32 %conv.i
}

It should produce this:
define i32 @foo(i32* nocapture %x) nounwind uwtable readnone ssp {
entry:
  ret i32 0
}

I'm at r164778.

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