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

Matthias Gehre via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 17 03:45:36 PDT 2022


mgehre-amd added inline comments.


================
Comment at: llvm/lib/CodeGen/ExpandLargeDivRem.cpp:218
+static bool runImpl(Function &F) {
+  SmallVector<Instruction *, 4> Replace;
+
----------------
arsenm wrote:
> You shouldn't need to pre-accumulate the instructions, just use make_early_inc_range on the instruction iterator?
I tried, but it crashed. I think that's because we not only remove the current instruction but also insert new basic blocks, which confuses `make_early_inc_range (instructions(F))`.


================
Comment at: llvm/lib/CodeGen/ExpandLargeDivRem.cpp:227
+      if (!isa<IntegerType>(I.getType()) ||
+          I.getType()->getIntegerBitWidth() <= ExpandDivRemBits)
+        continue;
----------------
arsenm wrote:
> Since this is ultimately a workaround for SelectionDAG, ideally this would be a TargetLowering control
I'm not sure how I would wire TargetLowering into the pass - I didn't find other passes using it.
Would TargetTransformInfo also work for you?


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