Joerg Sonnenberger via llvm-dev
2021-Oct-28 21:07 UTC
[llvm-dev] how to disable cmov generation?
On Thu, Oct 28, 2021 at 04:41:56PM +0200, Marc via llvm-dev wrote:> Hi, > > 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. Joerg
>> 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