Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6145463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:47:48+00:00 2026-05-23T18:47:48+00:00

I realize that LLVM has a long way to go, but theoretically, can the

  • 0

I realize that LLVM has a long way to go, but theoretically, can the optimizations that are in GCC/ICC/etc. for individual languages be applied to LLVM byte code? If so, does this mean that any language that compiles to LLVM byte code has the potential to be equally as fast? Or are language specific optimizations (before the LLVM bytecode stage) going to always play a large part in optimizing any specific program.

I don’t know much about compilers or optimizations (only enough to be dangerous), so I apologize if this question isn’t well defined.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:47:48+00:00Added an answer on May 23, 2026 at 6:47 pm

    In general, no.

    For example, in Haskell a common optimization is strictness analysis, which allows the compiler to determine which variables are always in head-normal form and therefore can be forced + inlined without changing program semantics. This is not possible with LLVM.

    Explanation: In Haskell, a function (Int, Int) -> Int is more or less equivalent to the type in C:

    typedef int (*returns_int)();
    struct pair { returns_int first, second};
    typedef struct pair *(*returns_pair)();
    
    int function(returns_pair arg);
    

    The compiler can analyze function and determine that it always evaluates its argument and always extracts the contents, transforming the function into this:

    int function(int x, int y); // note that it takes *two* arguments now
    

    This is well beyond the capability of LLVM. Maybe, in the future, with some really heavy interprocedural optimization… but realistically speaking, this will not happen in the foreseeable future.

    Example 2: There are Java VMs which can transform virtual function calls into direct function calls. However, this isn’t something that LLVM can do — because this transformation must be undone dynamically if another class is loaded which implements the same interface.

    In general, when you compile a program to LLVM you lose much of the semantic information about the original program. LLVM bytecode is capable of representing any code, but its type system is fairly limited — and your choice of type system affects what optimizations you can do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize that a SO user has formerly asked this question but it was
I realize that this question has been asked 100times but none that I have
I realize that this question has been asked and has been answered here but
I realize that this can be a matter of preference, but I have noticed
I do realize that I can do unless [1].empty? But I'm wondering if there
I realize that what counts as premature optimization has a subjective component, but this
I realize that this question may be a long shot, but I have to
I realize that tinyint is a single byte integer (by the way, is it
I realize that it can depend on certain things (and obviously how efficient the
I realize that what I am trying to do isn't safe. But I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.