Every bool constant in the phi becomes a trivial basic block in the assembly. select is generated by SpeculativelyExecuteBB() of simplifyCFG before function inlining and prevents jump-threading to further optimize the CFG. If I run the passes in the order of
-inline -instcombine -jump-threading -simplifycfg
then the problem is gone. instcombine can clean the code after inlining so that jump-threading can optimize the CFG.
Please let me know if you have any advice to solve this problem.