hi, the current release_20 branch seems to miscompile the following reduced testcase (not target architecture specific): #define UInt16 unsigned short #define UInt8 unsigned char UInt8 foo(UInt16 a) { return (UInt8)(((a >> 10) & 1) << 1); } it - misleadingly - optimizes the expression to something like (undef & 2). I guess the problem is related to the DAG combiner but I haven't done a thorough analysis yet. a quick search didn't bring up existing bug reports. is this a known problem? anybody else seeing this? - dietmar
On Wed, 30 May 2007, Dietmar Ebner wrote:> the current release_20 branch seems to miscompile the following reduced > testcase (not target architecture specific): > > #define UInt16 unsigned short > #define UInt8 unsigned char > UInt8 foo(UInt16 a) { > return (UInt8)(((a >> 10) & 1) << 1); > } > > it - misleadingly - optimizes the expression to something like (undef & > 2). I guess the problem is related to the DAG combiner but I haven't > done a thorough analysis yet. > > a quick search didn't bring up existing bug reports. is this a known > problem? anybody else seeing this?Verified, I filed this bug, I'm investigating. Thanks! http://llvm.org/bugs/show_bug.cgi?id=1473 -Chris -- http://nondot.org/sabre/ http://llvm.org/
hi, On Wed, 2007-05-30 at 09:31 -0700, Chris Lattner wrote:> On Wed, 30 May 2007, Dietmar Ebner wrote: > > the current release_20 branch seems to miscompile the following > reduced > > testcase (not target architecture specific): > > > > #define UInt16 unsigned short > > #define UInt8 unsigned char > > UInt8 foo(UInt16 a) { > > return (UInt8)(((a >> 10) & 1) << 1); > > } > Verified, I filed this bug, I'm investigating. Thanks! > > http://llvm.org/bugs/show_bug.cgi?id=1473thanks a lot for the quick fix! it solves the problem for me. - dietmar