[llvm-dev] how to disable cmov generation?

Marc via llvm-dev llvm-dev at lists.llvm.org
Fri Oct 29 00:15:39 PDT 2021


>> sometimes llvm/clang generates conditional mov in the code wenn
>> optimization is enabled.
>>
>> Is there a way that I can tell the compiler not to generate cmov
>> instructions?
>
> Why do you want to do that? We intentionally don't have a flag for
> every single transformation.

I am the maintainer of the afl++ fuzzer, and we write our own llvm
plugins for instrumenting the binaries.
The problem with cmov is that it hides if () ...; else ... ;and
therefore we do not see edges.

For our gcc plugin we can avoid this by said -f... parameters.
For llvm we we are still looking for a solution thats why I write here.
Worst solution would be checking for iselect and adding phi nodes
accordingly. But that would be quite some work as that would need to be
done for several modules.

And such an -f option would also be beneficial for a whole range of
other fuzzers. Even libfuzzer (-fsanitize-coverage):
   0x0000000000423cfd <+269>:	cmp    cl,0x41
   0x0000000000423d00 <+272>:	cmove  ebp,r13d

Regards,
Marc

-- 
Marc Heuse
www.mh-sec.de

PGP: AF3D 1D4C D810 F0BB 977D  3807 C7EE D0A0 6BE9 F573


More information about the llvm-dev mailing list