[PATCH] D129396: [InstCombine] Add support for div, ldiv, lldiv, and imaxdiv folding
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 30 12:06:42 PDT 2022
efriedma added a comment.
There really isn't any reason to preserve the call to div() in the IR, even if we can't fold it. If you use the normal LLVM IR div/rem instructions, usually we can optimize them to a more efficient sequence. Worst-case, the backend will just generate a call to __divmodsi4(), which is basically the same thing as div().
Given that, the lowering would be a lot simpler to implement in clang because we wouldn't need to worry about the ABI stuff. (And there shouldn't be code in languages other than C using div().)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129396/new/
https://reviews.llvm.org/D129396
More information about the llvm-commits
mailing list