LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 1016 - Codegen wrong for: ptrtoint X* %y to bool
Summary: Codegen wrong for: ptrtoint X* %y to bool
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Common Code Generator Code (show other bugs)
Version: trunk
Hardware: All All
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords: miscompilation
Depends on:
Blocks:
 
Reported: 2006-11-27 18:55 PST by Reid Spencer
Modified: 2010-02-22 12:43 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments
bugpoint reduced test case (399 bytes, application/octet-stream)
2006-11-27 18:56 PST, Reid Spencer
Details
llvm assembly corresponding to reduced test case (1.43 KB, text/plain)
2006-11-27 18:57 PST, Reid Spencer
Details
generated x86 assembly code (832 bytes, text/plain)
2006-11-27 18:57 PST, Reid Spencer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Reid Spencer 2006-11-27 18:55:08 PST
For this code:
bb122:
  %tmp124 = ptrtoint %struct.TypHeader* %hdR to bool
  %i.3.in.in = select bool %tmp124, %struct.TypHeader* %hdR, %struct.TypHeader* %hdL
  %hdR_addr.0 = select bool %tmp124, %struct.TypHeader* %hdL, %struct.TypHeader*
%hdR

llc is generating:
.BB1_3: #bb122
        movl %eax, %ebx
        # TRUNCATE movb %bl, %bl
        testb %bl, %bl
        movl %eax, %edi
        cmovne %esi, %edi
        testb %bl, %bl
        cmovne %eax, %esi

It looks like the recent DAGCombiner changes missed a case for the select
instruction.

Test cases will be attached.
Comment 1 Reid Spencer 2006-11-27 18:56:23 PST
Created attachment 477 [details]
bugpoint reduced test case
Comment 2 Reid Spencer 2006-11-27 18:57:10 PST
Created attachment 478 [details]
llvm assembly corresponding to reduced test case
Comment 3 Reid Spencer 2006-11-27 18:57:59 PST
Created attachment 479 [details]
generated x86 assembly code
Comment 4 Chris Lattner 2006-11-27 19:04:18 PST
Fixed, patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20061127/040313.html

-Chris