about jne issue, LLVM does it intentionally.
Check line 1521
Check line 1521
I'm dubious about the whole thing though. Seems like it may day from when branching "down" vs. "up" mattered to branch prediction.
https://github.com/llvm/llvm-project/blob/535df472b04208d6ae...
https://reviews.llvm.org/D29856
added the comment.
If I remove the check for `OptForSize` and `PredTBB == MBB`, we can optimize OP's report, but seem to regress basic tests like llvm/test/CodeGen/X86/conditional-tailcall.ll, literally flipping the branches incorrectly IIUC.