Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimplifyLibCalls miscompiles Python 2.5 #1679

Closed
asl opened this issue Apr 4, 2007 · 5 comments
Closed

SimplifyLibCalls miscompiles Python 2.5 #1679

asl opened this issue Apr 4, 2007 · 5 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla ipo Interprocedural optimizations miscompilation

Comments

@asl
Copy link
Collaborator

asl commented Apr 4, 2007

Bugzilla Link 1307
Resolution FIXED
Resolved on Feb 22, 2010 12:56
Version trunk
OS Linux
Attachments .ll File in question

Extended Description

Consider attached .ll file.

Running ./opt -simplify-libcalls will produce "bad" output. Resulting binary
just outputs "Bad HeadURL".

This breaks Python 2.5

@asl
Copy link
Collaborator Author

asl commented Apr 4, 2007

assigned to @lattner

@lattner
Copy link
Collaborator

lattner commented Apr 6, 2007

This is a miscompilation of the strchr optimizer:

  •   %tmp9 = call i8* @​strchr( i8* getelementptr ([82 x i8]* @​headurl, i32 0, i64 52), i32 47 )              ; 
    

<i8*> [#uses=3]

  •   %tmp11 = getelementptr i8* %tmp9, i32 1         ; <i8*> [#uses=1]
    
  •   %.strchr = getelementptr i8* getelementptr ([82 x i8]* @&#8203;headurl, i32 0, i64 52), i64 18         ; 
    

<i8*> [#uses=3]

  •   %tmp11 = getelementptr i8* %.strchr, i32 1              ; <i8*> [#uses=1]
    

it is turning (strchr(x+123, 47)) into strchr(x+4, 47) instead of strchr(x+123+4, 47)

This looks like a design flaw in getConstantStringLength, I'm working on it.

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 7, 2007

Is this done now?

@lattner
Copy link
Collaborator

lattner commented Apr 7, 2007

This specific one is, but there are other problems.

@lattner
Copy link
Collaborator

lattner commented Apr 8, 2007

This is now fixed, with many patches.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla ipo Interprocedural optimizations miscompilation
Projects
None yet
Development

No branches or pull requests

3 participants