[llvm-dev] LLVM Block is not the basic block

Muhui Jiang via llvm-dev llvm-dev at lists.llvm.org
Tue May 29 05:40:23 PDT 2018


Hi

Sorry, that the previous email is sent out before I complete it due to my
mistake. Please read this

I am using the LLVM function pass to help me to do code analysis. However,
I found that the block LLVM identified will ignore the function call.

For example, the below IR should not be a basic block.


  %call17 = call i32* @__errno_location() #14, !dbg !1384
  %18 = load i32, i32* %call17, align 4, !dbg !1384
  %19 = load i8*, i8** %dest_dirname, align 4, !dbg !1386
  call void (i32, i32, i8*, ...) @error(i32 1, i32 %18, i8* getelementptr
inbounds ([3 x i8], [3 x i8]* @.str.389, i32 0, i    32 0), i8* %19), !dbg
!1387
  br label %if.end18, !dbg !1388

The corresponding binary i s below

.text:0001A530                 BL      __errno_location
.text:0001A534                 LDR     R1, [R0]        ; errnum
.text:0001A538                 LDR     R3, [SP,#0x100+var_100]
.text:0001A53C                 LDR     R2, =aS_1       ; "%s"
.text:0001A540                 MOV     R0, #1          ; status
.text:0001A544                 BL      error
.text:0001A548                 B       loc_1A54C

Here you can see it obviously should not be a basic block because you
called two functions! So the control flow graph LLVM generated is also not
the real control flow graph, right? Do anyone know why or give me some
suggestions?

Regards
Muhui


2018-05-29 20:35 GMT+08:00 Muhui Jiang <jiangmuhui at gmail.com>:

> Hi
>
> I am using the LLVM function pass to help me to do code analysis. I use
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180529/bd6a4873/attachment.html>


More information about the llvm-dev mailing list