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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:49:28+00:00 2026-05-31T16:49:28+00:00

Sometimes I found the label identifier in llvm IR is started with comma ‘;’,

  • 0

Sometimes I found the label identifier in llvm IR is started with comma ‘;’, such as
; <label> 6
however as I kown, the comma is used for comments. So how can llvm retrive the label info in comments? Am I missing something?
One simple test is followed.
the C source file:

#include <stdio.h>

int main()
{
 int a;
 scanf("%d", &a);
 if ( a > 3)
  a *= 2;
 return 0;
}

the llvm IR code generated by http://llvm.org/demo/index.cgi (same as clang -c -emit-llvm main.c) is following:

; ModuleID = '/tmp/webcompile/_13654_0.bc'

@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1

define i32 @main() nounwind uwtable {
  %a = alloca i32, align 4
  %1 = call i32 (i8*, ...)* @__isoc99_scanf(i8* getelementptr inbounds ([3 x i8]* @.str, i64 0, i64 0), i32* %a) nounwind
  %2 = load i32* %a, align 4, !tbaa !0
  %3 = icmp sgt i32 %2, 3
  br i1 %3, label %4, label %6

; <label>:4                                       ; preds = %0
  %5 = shl nsw i32 %2, 1
  store i32 %5, i32* %a, align 4, !tbaa !0
  br label %6

; <label>:6                                       ; preds = %4, %0
  ret i32 0
}
  • 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-31T16:49:30+00:00Added an answer on May 31, 2026 at 4:49 pm

    In LLVM IR a block does not need an explicit label. Instructions are the same way which leads to the %1, %2, %3. LLVM assigns numbers to unnamed instructions and blocks in increasing order. The br i1 %3... terminates the first block and the last used number label is 3 so the next block gets labelled as 4. That block ends with the next br instruction and the last used number is 5 so the next and final block is labelled with 6. At first it might seem weird that blocks and instructions share the same namespace, but remember that blocks are values too.

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

Sidebar

Related Questions

I found the [] operator is sometimes confusing when it is used agains SimpleXMLElement
I found sometimes browser can't get cookies from my website, so I use curl
I have been reading about Quicksort and found that sometimes it' s referred to
I'm teaching myself some basic scraping and I've found that sometimes the URL's that
I sometimes use the feature 'Reconcile Offline Work...' found in Perforce's P4V IDE to
I found that using Smarty with PHP, sometimes extra time will need to be
Sometimes I see header files of the form. #include <sys/sysinfo.h> // I found this
Has anyone else found VIM's syntax highlighting of Javascript sub-optimal? I'm finding that sometimes
I am using Connector in J2ME and found that sometimes it take a very
i found a code but sometimes have error : StringBuilder strHeaders = new StringBuilder();

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.