I tried to disable the branch folding called from IfConversion, which is guarded by the command line flag IfCvtBranchFold defined in the IfConversion.cpp file. However, there are two calls to the BranchFolder::OptimizeFunction in the IfConversion pass, which one of them is not guarded by IfCvtBranchFold. I created a new command line flag guarding the two calls to OptimizeFunction just to check, and with the new flag the Branch Folding is not invoked.
Is this a bug? Shouldn’t the two calls to OptimizeFunction be guarded by IfCvtBranchFold?