无法从命令行安全禁用O1 / O2 / O3 opt管道中的特定传递。自定义或定制LLVM通道的选择管道的替代方法有哪些?
我正在写通行证以概述代码的特定区域,并且我需要减少概述函数的输入和输出的数量。 在某些情况下,opt工具会引发一些(不变的)GEP指令(例如,从循环体内)。 O1 / O2 / O3标志会发生这种情况。我不希望这样做,因为它为我概述的功能创建了更多的输入/输出。我更喜欢在概述的功能中完成GEP。
Pass Arguments: -targetlibinfo -tti -targetpassconfig -tbaa -scoped-noalias
-assumption-cache-tracker -profile-summary-info -forceattrs -inferattrs
-ipsccp -called-value-propagation -globalopt -domtree -mem2reg -deadargelim
-domtree -basicaa -aa -loops -lazy-branch-prob -lazy-block-freq
-opt-remark-emitter -instcombine -simplifycfg -basiccg -globals-aa -prune-eh
-always-inline -functionattrs -domtree -sroa -basicaa -aa -memoryssa -early-cse-memssa
-speculative-execution -basicaa -aa -lazy-value-info -jump-threading -correlated-propagation
-simplifycfg -domtree -basicaa -aa -loops -lazy-branch-prob -lazy-block-freq
-opt-remark-emitter -instcombine -libcalls-shrinkwrap -loops -branch-prob -block-freq
-lazy-branch-prob -lazy-block-freq -opt-remark-emitter -pgo-memop-opt -basicaa -aa
-loops -lazy-branch-prob -lazy-block-freq -opt-remark-emitter -tailcallelim -simplifycfg
-reassociate -domtree -loops -loop-simplify -lcssa-verification -lcssa -basicaa -aa
-scalar-evolution -loop-rotate -licm -loop-unswitch -simplifycfg -domtree -basicaa -aa -loops
-lazy-branch-prob -lazy-block-freq -opt-remark-emitter -instcombine -loop-simplify -lcssa-verification -lcssa -scalar-evolution -indvars
-loop-idiom -loop-deletion -loop-unroll -phi-values -memdep -memcpyopt -sccp -demanded-bits -bdce -basicaa -aa -lazy-branch-prob
-lazy-block-freq -opt-remark-emitter -instcombine -lazy-value-info -jump-threading -correlated-propagation -basicaa -aa -phi-values
-memdep -dse -loops -loop-simplify -lcssa-verification -lcssa -basicaa -aa -scalar-evolution -licm -postdomtree -adce -simplifycfg
-domtree -basicaa -aa -loops -lazy-branch-prob -lazy-block-freq -opt-remark-emitter -instcombine -barrier -basiccg -rpo-functionattrs
-globalopt -globaldce -basiccg -globals-aa -float2int -domtree -loops -loop-simplify -lcssa-verification -lcssa -basicaa -aa -scalar-evolution
-loop-rotate -loop-accesses -lazy-branch-prob -lazy-block-freq -opt-remark-emitter -loop-distribute -branch-prob -block-freq -scalar-evolution
-basicaa -aa -loop-accesses -demanded-bits -lazy-branch-prob -lazy-block-freq -opt-remark-emitter -loop-vectorize -loop-simplify -scalar-evolution
-aa -loop-accesses -loop-load-elim -basicaa -aa -lazy-branch-prob -lazy-block-freq -opt-remark-emitter -instcombine -simplifycfg -domtree
-basicaa -aa -loops -lazy-branch-prob -lazy-block-freq -opt-remark-emitter -instcombine -loop-simplify -lcssa-verification -lcssa
-scalar-evolution -loop-unroll -lazy-branch-prob -lazy-block-freq -opt-remark-emitter -instcombine -loop-simplify -lcssa-verification
-lcssa -scalar-evolution -licm -alignment-from-assumptions -strip-dead-prototypes -domtree -loops -branch-prob -block-freq -loop-simplify
-lcssa-verification -lcssa -basicaa -aa -scalar-evolution -branch-prob -block-freq -loop-sink -lazy-branch-prob -lazy-block-freq
-opt-remark-emitter -instsimplify -div-rem-pairs -simplifycfg -domtree -sroa -verify -print-module
我认为我需要的是
我可以在通行定义中仅将所需的通行证(O1管道的子集)添加为getAnalysisUsage()中的AddRequired,并使opt在启用O0标志的情况下运行我的通行证吗?这样行吗?我可以尝试一下。
答案 0 :(得分:0)
根据2018年夏季的this线程,没有通用的方法可以禁用来自clang的特定通行证:
某些通行证支持将其禁用的选项,例如 -fno-vectorize和-fno-unroll-loops,但是没有常规选项。 由于禁用任意选项通常没有用,因此有些 需要手工。
该线程中的原始发布者似乎正在开发补丁来启用此行为,但据我所知它从未降落。