[PATCH] D53390: [DebugInfo][Dexter] Unreachable line stepped onto after SimplifyCFG.
Carlos Alberto Enciso via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 5 04:23:01 PST 2018
CarlosAlbertoEnciso added inline comments.
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1379
+ Instruction *InsertPt = BIParent->size() > 1
+ ? BIParent->getTerminator()->getPrevNode()
+ : BIParent->getTerminator();
----------------
vsk wrote:
> A bit nitty-gritty, but: Can the instruction before the terminator be a debug info intrinsic?
>
> If so, I think the line location you pick be different if you switch from -gline-tables-only versus -g.
Thanks for your review.
Changing the test case to:
```
int main() {
volatile int foo = 0;
int beards = 0;
bool cond = foo == 4;
if (cond)
beards = 8;
else
beards = 4;
volatile bool tmp;
volatile bool *face = &tmp;
*face = cond;
return beards;
}
```
The IR will look like:
```
...
%foo.0. = load volatile i32, i32* %foo, align 4, !dbg !28, !tbaa !23
%cmp = icmp eq i32 %foo.0., 4, !dbg !28
%frombool = zext i1 %cmp to i8, !dbg !28
call void @llvm.dbg.value(metadata i8 %frombool, metadata !16, metadata !DIExpression()), !dbg !28
br i1 %cmp, label %if.then, label %if.else, !dbg !29
if.then: ; preds = %entry
call void @llvm.dbg.value(metadata i32 8, metadata !15, metadata !DIExpression()), !dbg !27
br label %if.end, !dbg !30
if.else: ; preds = %entry
call void @llvm.dbg.value(metadata i32 4, metadata !15, metadata !DIExpression()), !dbg !27
br label %if.end
if.end: ; preds = %if.else, %if.then
...
```
The instruction before the terminator is a debug info intrinsic.
https://reviews.llvm.org/D53390
More information about the llvm-commits
mailing list