[PATCH] D119777: [X86] Introduce x86-cmov-converter-force-all

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 15 16:02:25 PST 2022


Amir added a comment.

In D119777#3324555 <https://reviews.llvm.org/D119777#3324555>, @craig.topper wrote:

> In D119777#3324438 <https://reviews.llvm.org/D119777#3324438>, @Amir wrote:
>
>> In D119777#3322778 <https://reviews.llvm.org/D119777#3322778>, @pengfei wrote:
>>
>>> In D119777#3322012 <https://reviews.llvm.org/D119777#3322012>, @skan wrote:
>>>
>>>> Could you point out the document for `-fno-if-conversion2`?
>>>
>>> It guess it's in https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
>>
>> Yes, it's there, as `-fif-conversion2`
>
> The description for -fif-conversion2 reads as if it is enabling an optimization pass and that -fno-if-conversion2 just doesn't run that optimization pass. It doesn't read like -fno-if-conversion2 would expand cmovs. Is my understanding correct?

Yes, it's correct. My understanding is that GCC handles cmov's the opposite way compared to LLVM:

- GCC's IR has if-then-else constructs and cmov's are inserted by if-conversion pass (https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/ifcvt.cc;hb=3d8d8e34f796fefda53be9a6cec7c6c950856a14#l5782).
- In LLVM, select is lowered into cmov which is expanded into if-then-else by X86CmovConversion pass.

The two approaches are not equivalent, but to keep cmov opportunities until after the compiler, one would need `-fno-if-conversion2` in GCC and `-x86-cmov-converter-force-all` in LLVM.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119777/new/

https://reviews.llvm.org/D119777



More information about the llvm-commits mailing list