[LLVMbugs] [Bug 3574] New: missed opt: ptrtoint(inttoptr (a -> b), c) -> sext

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Feb 13 09:23:58 PST 2009


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

           Summary: missed opt: ptrtoint(inttoptr (a -> b), c) -> sext
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: daniel at zuster.org
                CC: llvmbugs at cs.uiuc.edu


The following snippet should simplify to an sext on x86_64:
--
ddunbar at ozzy:CodeGen$ cat /tmp/t.ll
; ModuleID = '<stdin>'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "x86_64-apple-darwin10.0"
define i64 @f0(i32 %a0) nounwind {
       %t0 = inttoptr i32 %a0 to i8*
       %t1 = ptrtoint i8* %t0 to i64
       ret i64 %t1
}
ddunbar at ozzy:CodeGen$ llvm-as < /tmp/t.ll | opt -instcombine | llvm-dis
; ModuleID = '<stdin>'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "x86_64-apple-darwin10.0"

define i64 @f0(i32 %a0) nounwind {
        %t0 = inttoptr i32 %a0 to i8*           ; <i8*> [#uses=1]
        %t1 = ptrtoint i8* %t0 to i64           ; <i64> [#uses=1]
        ret i64 %t1
}
--


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