<div><div dir="auto">Block %2 is the block that starts with the instruction %3 in your example. If a basic block doesn’t have an explicit name provided it is given the next available number. The unnamed arguments took %0 and %1 so the first basic block which is unnamed took %2</div></div><div dir="auto"><br></div><div dir="auto">If you use a debug build of the complete or pass -fno-discard-value-names to clang there will be a lot more things named instead of just numbers.</div><div><br><div class="gmail_quote"><div dir="ltr">On Sat, Jan 19, 2019 at 12:00 PM Peng Yu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I see "; preds = %2" in the following example. But I don't see where<br>
the %2 block is mentioned. Do you know where the %2 block is<br>
mentioned? Thanks.<br>
<br>
==> main.c <==<br>
/* vim: set noexpandtab tabstop=2: */<br>
#include <stdio.h><br>
<br>
int i;<br>
<br>
struct {<br>
  int x;<br>
  int y;<br>
} a[10];<br>
<br>
void print() {<br>
  puts("Hello World!");<br>
}<br>
<br>
int main(int argc, char *argv[]) {<br>
  ++i;<br>
  if(i) {<br>
    ++a[0].x;<br>
    print();<br>
    printf("%d\n", i);<br>
    printf("%d\n", a[0].x);<br>
  }<br>
  return 0;<br>
}<br>
<br>
==> main.exe.0.0.preopt.ll <==<br>
; ModuleID = '/Users/pengy/mrrdir/test/mac/llvm/langref/main.exe.0.0.preopt.bc'<br>
source_filename = "ld-temp.o"<br>
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"<br>
target triple = "x86_64-pc-linux-gnu"<br>
<br>
%struct.anon = type { i32, i32 }<br>
<br>
@.str = private unnamed_addr constant [13 x i8] c"Hello World!\00", align 1<br>
@i = common dso_local global i32 0, align 4, !dbg !0<br>
@a = common dso_local global [10 x %struct.anon] zeroinitializer,<br>
align 16, !dbg !6<br>
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1<br>
<br>
; Function Attrs: noinline nounwind optnone uwtable<br>
define dso_local void @print() #0 !dbg !20 {<br>
  %1 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x<br>
i8]* @.str, i32 0, i32 0)), !dbg !23<br>
  ret void, !dbg !24<br>
}<br>
<br>
declare i32 @puts(i8*) #1<br>
<br>
; Function Attrs: noinline nounwind optnone uwtable<br>
define dso_local i32 @main(i32, i8**) #0 !dbg !25 {<br>
  %3 = alloca i32, align 4<br>
  %4 = alloca i32, align 4<br>
  %5 = alloca i8**, align 8<br>
  store i32 0, i32* %3, align 4<br>
  store i32 %0, i32* %4, align 4<br>
  call void @llvm.dbg.declare(metadata i32* %4, metadata !31, metadata<br>
!DIExpression()), !dbg !32<br>
  store i8** %1, i8*** %5, align 8<br>
  call void @llvm.dbg.declare(metadata i8*** %5, metadata !33,<br>
metadata !DIExpression()), !dbg !34<br>
  %6 = load i32, i32* @i, align 4, !dbg !35<br>
  %7 = add nsw i32 %6, 1, !dbg !35<br>
  store i32 %7, i32* @i, align 4, !dbg !35<br>
  %8 = load i32, i32* @i, align 4, !dbg !36<br>
  %9 = icmp ne i32 %8, 0, !dbg !36<br>
  br i1 %9, label %10, label %17, !dbg !38<br>
<br>
; <label>:10:                                     ; preds = %2<br>
  %11 = load i32, i32* getelementptr inbounds ([10 x %struct.anon],<br>
[10 x %struct.anon]* @a, i64 0, i64 0, i32 0), align 16, !dbg !39<br>
  %12 = add nsw i32 %11, 1, !dbg !39<br>
  store i32 %12, i32* getelementptr inbounds ([10 x %struct.anon], [10<br>
x %struct.anon]* @a, i64 0, i64 0, i32 0), align 16, !dbg !39<br>
  call void @print(), !dbg !41<br>
  %13 = load i32, i32* @i, align 4, !dbg !42<br>
  %14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x<br>
i8], [4 x i8]* @.str.1, i32 0, i32 0), i32 %13), !dbg !43<br>
  %15 = load i32, i32* getelementptr inbounds ([10 x %struct.anon],<br>
[10 x %struct.anon]* @a, i64 0, i64 0, i32 0), align 16, !dbg !44<br>
  %16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x<br>
i8], [4 x i8]* @.str.1, i32 0, i32 0), i32 %15), !dbg !45<br>
  br label %17, !dbg !46<br>
<br>
; <label>:17:                                     ; preds = %10, %2<br>
  ret i32 0, !dbg !47<br>
}<br>
<br>
; Function Attrs: nounwind readnone speculatable<br>
declare void @llvm.dbg.declare(metadata, metadata, metadata) #2<br>
<br>
declare i32 @printf(i8*, ...) #1<br>
<br>
attributes #0 = { noinline nounwind optnone uwtable<br>
"correctly-rounded-divide-sqrt-fp-math"="false"<br>
"disable-tail-calls"="false" "less-precise-fpmad"="false"<br>
"no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"<br>
"no-infs-fp-math"="false" "no-jump-tables"="false"<br>
"no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false"<br>
"no-trapping-math"="false" "stack-protector-buffer-size"="8"<br>
"target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87"<br>
"unsafe-fp-math"="false" "use-soft-float"="false" }<br>
attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false"<br>
"disable-tail-calls"="false" "less-precise-fpmad"="false"<br>
"no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"<br>
"no-infs-fp-math"="false" "no-nans-fp-math"="false"<br>
"no-signed-zeros-fp-math"="false" "no-trapping-math"="false"<br>
"stack-protector-buffer-size"="8" "target-cpu"="x86-64"<br>
"target-features"="+fxsr,+mmx,+sse,+sse2,+x87"<br>
"unsafe-fp-math"="false" "use-soft-float"="false" }<br>
attributes #2 = { nounwind readnone speculatable }<br>
<br>
!<a href="http://llvm.dbg.cu" rel="noreferrer" target="_blank">llvm.dbg.cu</a> = !{!2}<br>
!llvm.ident = !{!16}<br>
!llvm.module.flags = !{!17, !18, !19}<br>
<br>
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())<br>
!1 = distinct !DIGlobalVariable(name: "i", scope: !2, file: !3, line:<br>
4, type: !12, isLocal: false, isDefinition: true)<br>
!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3,<br>
producer: "clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)",<br>
isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums:<br>
!4, globals: !5)<br>
!3 = !DIFile(filename: "main.c", directory:<br>
"/root/mrrdir/test/mac/llvm/langref")<br>
!4 = !{}<br>
!5 = !{!0, !6}<br>
!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())<br>
!7 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line:<br>
9, type: !8, isLocal: false, isDefinition: true)<br>
!8 = !DICompositeType(tag: DW_TAG_array_type, baseType: !9, size: 640,<br>
elements: !14)<br>
!9 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !3,<br>
line: 6, size: 64, elements: !10)<br>
!10 = !{!11, !13}<br>
!11 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !9, file:<br>
!3, line: 7, baseType: !12, size: 32)<br>
!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)<br>
!13 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !9, file:<br>
!3, line: 8, baseType: !12, size: 32, offset: 32)<br>
!14 = !{!15}<br>
!15 = !DISubrange(count: 10)<br>
!16 = !{!"clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)"}<br>
!17 = !{i32 2, !"Dwarf Version", i32 4}<br>
!18 = !{i32 2, !"Debug Info Version", i32 3}<br>
!19 = !{i32 1, !"wchar_size", i32 4}<br>
!20 = distinct !DISubprogram(name: "print", scope: !3, file: !3, line:<br>
11, type: !21, isLocal: false, isDefinition: true, scopeLine: 11,<br>
isOptimized: false, unit: !2, retainedNodes: !4)<br>
!21 = !DISubroutineType(types: !22)<br>
!22 = !{null}<br>
!23 = !DILocation(line: 12, column: 3, scope: !20)<br>
!24 = !DILocation(line: 13, column: 1, scope: !20)<br>
!25 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line:<br>
15, type: !26, isLocal: false, isDefinition: true, scopeLine: 15,<br>
flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes:<br>
!4)<br>
!26 = !DISubroutineType(types: !27)<br>
!27 = !{!12, !12, !28}<br>
!28 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !29, size: 64)<br>
!29 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !30, size: 64)<br>
!30 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)<br>
!31 = !DILocalVariable(name: "argc", arg: 1, scope: !25, file: !3,<br>
line: 15, type: !12)<br>
!32 = !DILocation(line: 15, column: 14, scope: !25)<br>
!33 = !DILocalVariable(name: "argv", arg: 2, scope: !25, file: !3,<br>
line: 15, type: !28)<br>
!34 = !DILocation(line: 15, column: 26, scope: !25)<br>
!35 = !DILocation(line: 16, column: 3, scope: !25)<br>
!36 = !DILocation(line: 17, column: 6, scope: !37)<br>
!37 = distinct !DILexicalBlock(scope: !25, file: !3, line: 17, column: 6)<br>
!38 = !DILocation(line: 17, column: 6, scope: !25)<br>
!39 = !DILocation(line: 18, column: 5, scope: !40)<br>
!40 = distinct !DILexicalBlock(scope: !37, file: !3, line: 17, column: 9)<br>
!41 = !DILocation(line: 19, column: 5, scope: !40)<br>
!42 = !DILocation(line: 20, column: 20, scope: !40)<br>
!43 = !DILocation(line: 20, column: 5, scope: !40)<br>
!44 = !DILocation(line: 21, column: 25, scope: !40)<br>
!45 = !DILocation(line: 21, column: 5, scope: !40)<br>
!46 = !DILocation(line: 22, column: 3, scope: !40)<br>
!47 = !DILocation(line: 23, column: 3, scope: !25)<br>
<br>
On Sat, Jan 19, 2019 at 1:02 AM Bhatu <<a href="mailto:CS12B1010@iith.ac.in" target="_blank">CS12B1010@iith.ac.in</a>> wrote:<br>
><br>
> It's a list of all the predecessor basic blocks for this particular basic block.<br>
><br>
> On Sat, Jan 19, 2019 at 12:27 PM Peng Yu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> I see things like this. What does it mean? Is it documented somewhere? Thanks.<br>
>><br>
>> ; preds = %for.body<br>
>><br>
>> <a href="https://llvm.org/docs/LangRef.html" rel="noreferrer" target="_blank">https://llvm.org/docs/LangRef.html</a><br>
>><br>
>> ; <label>:91:                                     ; preds = %88<br>
>>   %92 = load i8**, i8*** @glob_complete_word.matches, align 8, !dbg !99798<br>
>>   %93 = load i32, i32* @glob_complete_word.ind, align 4, !dbg !99799<br>
>>   %94 = sext i32 %93 to i64, !dbg !99798<br>
>>   %95 = getelementptr inbounds i8*, i8** %92, i64 %94, !dbg !99798<br>
>>   %96 = load i8*, i8** %95, align 8, !dbg !99798<br>
>>   br label %98, !dbg !99797<br>
>><br>
>> ; <label>:97:                                     ; preds = %88<br>
>>   br label %98, !dbg !99797<br>
>><br>
>><br>
>> --<br>
>> Regards,<br>
>> Peng<br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
><br>
><br>
><br>
> --<br>
> Regards<br>
> Bhatu<br>
<br>
<br>
<br>
-- <br>
Regards,<br>
Peng<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div>