In sample profile, some branches may have profile missing due to profile inaccuracy. We want existing branch probability still valid after propagation.
Details
Diff Detail
Event Timeline
Note that this patch is dependent on D19674 which was reverted at rL268577.
I've been trying to locate the msan failure that caused the revert, but no luck so far: I don't see any problems running under valgrind. Trying to repro using msan directly now. If anyone can help spot the bug, I'd appreciate it.
I changed D19674 in order to avoid the msan bot failure; it seems unnecessarily ugly to me, but it's passing on that bot now. There's still an Apple internal bot issue that seems to be triggered by rL268767 , so it may need some other change.
For this patch, I'm wondering if we should be doing a one-off correction for a missing weight. Wouldn't it be better to fill in all of the missing info before we reach SimplifyCFG?
In sample profiler, we only annotate weights if we have profile for the branch. Yes, we can filling in missing weights like we do here, but those weights seem useless to other optimizations and it will unnecessarily increase IR size. Additionally, for case like this, if we assume that two branches should both (or none) have weights, we probably better assert instead of checking with "&&" condition, otherwise we may lose optimization opportunity without being notified.
I'll defer to David or Hal's better judgment on this. I don't know what the correct solution is.
Rebase the patch to resolve conflicts. Now this patch does not depend on http://reviews.llvm.org/D19674