songlh
2014-Apr-29 03:06 UTC
[LLVMdev] how to identify basic blocks added for switch instruction without default?
Hi, I just notice that front-end will add an extra block for switch instruction without default. How could I identify basic blocks added due to this reason? The added codes looks like: sw.default.i625: ; preds = %if.end512 tail call void @fancy_abort(i8* getelementptr inbounds ([38 x i8]* @.str, i64 0, i64 0), i32 3045, i8* getelementptr inbounds ([23 x i8]* @__FUNCTION__.compcode_to_comparison, i64 0, i64 0)) #7, !dbg !8046 unreachable, !dbg !8046 Could I get "unreachable" information from metadata? Thanks a lot! Best, Linhai
Jingyue Wu
2014-Apr-29 03:12 UTC
[LLVMdev] how to identify basic blocks added for switch instruction without default?
I suspect pattern matching "sw.default" will identify these blocks with a reasonable accuracy. The code in clang adding these blocks is in lib/CodeGen/CGStmt.cpp. Jingyue On Mon, Apr 28, 2014 at 8:06 PM, songlh <songlh at cs.wisc.edu> wrote:> Hi, > > I just notice that front-end will add an extra block for switch > instruction without default. How could I identify basic blocks added due to > this reason? > > The added codes looks like: > > sw.default.i625: ; preds = %if.end512 > tail call void @fancy_abort(i8* getelementptr inbounds ([38 x i8]* > @.str, i64 0, i64 0), i32 3045, i8* getelementptr inbounds ([23 x i8]* > @__FUNCTION__.compcode_to_comparison, i64 0, i64 0)) #7, !dbg !8046 > unreachable, !dbg !8046 > > Could I get "unreachable" information from metadata? > > Thanks a lot! > > Best, > > > Linhai > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140428/695aa901/attachment.html>
songlh
2014-Apr-29 05:02 UTC
[LLVMdev] how to identify basic blocks added for switch instruction without default?
Thanks a lot for the suggestion! Let me try the pattern matching firstly. Best Linhai On 2014-04-28 22:12, Jingyue Wu wrote:> I suspect pattern matching "sw.default" will identify these blocks > with a reasonable accuracy. The code in clang adding these blocks is > in lib/CodeGen/CGStmt.cpp. > > Jingyue > > On Mon, Apr 28, 2014 at 8:06 PM, songlh <songlh at cs.wisc.edu> wrote: > >> Hi, >> >> I just notice that front-end will add an extra block for >> switch instruction without default. How could I identify basic >> blocks added due to this reason? >> >> The added codes looks like: >> >> sw.default.i625: >> ; preds = %if.end512 >> tail call void @fancy_abort(i8* getelementptr inbounds ([38 x >> i8]* @.str, i64 0, i64 0), i32 3045, i8* getelementptr inbounds ([23 >> x i8]* @__FUNCTION__.compcode_to_comparison, i64 0, i64 0)) #7, !dbg >> !8046 >> unreachable, !dbg !8046 >> >> Could I get "unreachable" information from metadata? >> >> Thanks a lot! >> >> Best, >> >> >> >> Linhai >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu [1] >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev [2] > > > > Links: > ------ > [1] http://llvm.cs.uiuc.edu > [2] http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev