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 9238631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:48:24+00:00 2026-06-18T07:48:24+00:00

The LLVM language specifies integer types as iN, where N is the bit-width of

  • 0

The LLVM language specifies integer types as iN, where N is the bit-width of the integer, and ranges from 1 to 2^23-1 (According to: http://llvm.org/docs/LangRef.html#integer-type)

I have 2 questions:

  1. When compiling a C program down to LLVM IR level, what types may be lowered to i1, i2, i3, etc? It seems like the types i8, i16, i32, i64 must be enough, so I was wondering what all the other nearly 8 million integer types are for.

  2. Is it true that both signed and unsigned integer types are lowered to i32? What is the reason for that, and why does it not apply to something like 32-bit float (which is represented as f32 in LLVM)?

  • 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-06-18T07:48:25+00:00Added an answer on June 18, 2026 at 7:48 am

    First of all, be aware both arbitrary-sized integers and no distinction between signed and unsigned integers are modifications added to LLVM 2.0. Earlier versions had only a few integer types, with a signed/unsigned distinction.

    Now, to your questions:

    1. LLVM, though designed with C/C++ in mind, is not specific to these languages. Having more possible integer types gives you more flexibility. You don’t have to use these types, of course – and I’m guessing that, as you’ve mentioned, any C/C++ frontend to LLVM (i.e. Clang) would probably only generate i1, i8, i16, i32 and i64.

      Edit: apparently I’m mistaken and Clang does use some other integer types as well, see Jens’s comment below.

    2. Yes, LLVM does not make a distinction between signed and unsigned integer type, so both will be lowered to i32. The operations on the unsigned integer, though, will be translated according to the original type; e.g. a division between unsigned integers will be udiv while between signed will be sdiv. Because integers are represented as two’s complement, though, many operations (e.g. add) don’t care about signed/unsigned and so only have a single version.

      As for why no distinction was made in LLVM between signed and unsigned, read the details on this enhancement request – in short, having both signed and unsigned versions led to a large IR bloat and was detrimental to some optimizations, so it was dropped.

      Finally, you ask about why no f32 – the answer is that I don’t know, maybe it was deemed to be less useful than arbitrarily-sized integers. However, notice that f32 is not really descriptive – if you want arbitrary floating-point types you need to at least specify the size of the base number and the size of the exponent, something like f23e8 instead of float and f52e11 instead of double. That’s a bit cumbersome if you ask me, though I guess float and double could have been made synonymous with those.

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

Sidebar

Related Questions

http://clang.llvm.org/docs/BlockLanguageSpec.txt Looks really cool. However, I don't understand it. I don't see examples it.
I've building clang/llvm frequently on various systems following the Getting Started instructions (http://clang.llvm.org/get_started.html). The
I am generating LLVM IR (.ll files) from a source language. This language doesn't
I recently discover the LLVM (low level virtual machine) project, and from what I
What does C++ add to C? What features of the language are the Clang/LLVM
I am writing a LLVM code generator for the language Timber, the current compiler
I'm implementing a simple lazy functional language with LLVM as its backend in Haskell.
I'm evaluating different possibilities for a custom VM, and I left out LLVM from
Summary: llvm-ld has been removed from the LLVM 3.2 release . I am trying
I am trying to use llvm to implement a simple, dumb c-like language. And

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.