[LLVMbugs] [Bug 9355] New: missing DCE for certain constant expressions?
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Mar 1 10:09:45 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=9355
Summary: missing DCE for certain constant expressions?
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: pageexec at freemail.hu
CC: llvmbugs at cs.uiuc.edu
cloning comment 10 from bug 9322 per Ted's request:
example in linux/include/linux/bitops.h (code's compiled with -O2):
static inline unsigned long hweight_long(unsigned long w)
{
return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
}
on i386 this should not evaluate hweight64 as that'll result in warnings like
this:
In file included from lib/halfmd4.c:1:
In file included from include/linux/kernel.h:17:
include/linux/bitops.h:49:41: warning: shift count >= width of type
return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
^~~~~~~~~~~~
as the macro breaks down to this:
include/asm-generic/bitops/const_hweight.h:27:49: note: instantiated from:
#define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) :
__arch_hweight64(w))
^
include/asm-generic/bitops/const_hweight.h:19:54: note: instantiated from:
#define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >>
32))
--
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