[PATCH] D126644: [llvm/CodeGen] Add ExpandLargeDivRem pass

Matthias Gehre via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 00:44:54 PDT 2022


mgehre-amd added a comment.

In D126644#3582347 <https://reviews.llvm.org/D126644#3582347>, @arsenm wrote:

> Another problem is this will miss divisions embedded in constant expressions

Good point. I wasn't able to create a reproducer from C to a sdiv constant expression, but there is a C++ reproducer: https://godbolt.org/z/v5Tsh8n9x.
My hypothesis is that there is no C/C++ code that creates an sdiv/udiv/srem/urem constant expression in a global variable initializers.
So it would be sufficient to walk the ConstantExpr operands of all instructions, looking for sdiv etc that needs to be converted, and
then uses something like replaceConstantUsesInFunction() to turn them into instructions. Does that sound sensible?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126644



More information about the llvm-commits mailing list