[LLVMbugs] [Bug 494] [llvmgcc] Signed divide generated for pointer difference

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Jan 2 13:17:05 PST 2005


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=494

sabre at nondot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |1.5



------- Additional Comments From sabre at nondot.org  2005-01-02 15:17 -------
Fixed.  Patch here: 
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20041227/022878.html 
 
Testcase here: 
CFrontend/2005-01-02-PointerDifference.c.tr 
 
The example in the bug is now compiled to: 
 
int %Diff(int* %P, int* %Q) { 
        %tmp.1 = cast int* %P to int            ; <int> [#uses=1] 
        %tmp.3 = cast int* %Q to int            ; <int> [#uses=1] 
        %tmp.4 = sub int %tmp.1, %tmp.3         ; <int> [#uses=1] 
        %tmp.5 = shr int %tmp.4, ubyte 2                ; <int> [#uses=1] 
        ret int %tmp.5 
} 
 
This patch only implements it for the power of two case.  To do more will 
require the eventual extension of the LLVM IR to support "exact" integer 
divisions. 
 
-Chris 



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




More information about the llvm-bugs mailing list