[llvm-dev] simplify CFG Pass in llvm
Jajoo, Malhar via llvm-dev
llvm-dev at lists.llvm.org
Fri Jun 16 09:24:40 PDT 2017
I was trying to run the simplify CFG Pass in LLVM , and delete an unreachable basic block ("continuation" below ) after running one of my own IR transforms , but I keep getting the
error -
While deleting: i8* %g
Use still stuck around after Def is destroyed: store i8 0, i8* %g
I am well aware of what that means, but isn't the whole purpose of the "simplifyCFGPass" to delete the unreachable basic blocks for us ? Why must it then throw this error ? I would assume it should simply be able to manage all the use-def dependencies and delete the instructions in the unreachable "continuation" basic block below.
Following is the relevant IR
entry:
%a3 = alloca i32
store i32 %a, i32* %a3
%a4 = load i32, i32* %a3
%ifcond = icmp ne i32 %a4, 0
br i1 %ifcond, label %then, label %else
then: ; preds = %entry
%gclone1 = alloca i32
store i32 0, i32* %gclone1
ret i5 0
else: ; preds = %entry
%gclone4 = alloca i64
store i64 0, i64* %gclone4
ret i5 0
continuation: ; No predecessors!
%iftmp = phi i32 [ 32, %then ], [ 64, %else ], !range !0
%datasize = alloca i32
store i32 %iftmp, i32* %datasize
%g = alloca i8 ---------------------> Issue
store i8 0, i8* %g ---------------------> Issue
ret i5 0
}
Can someone please explain why this error crops up ? Isn't the API supposed to handle this ?
Thanks,
Malhar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170616/2f72155b/attachment.html>
More information about the llvm-dev
mailing list