[PATCH] D146350: [InstCombine] More aggressively try and fold irem/idiv/mul into selects.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 1 00:44:35 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:206
+             isSafeToSpeculativelyExecute(&I, Q->CxtI, Q->AC, Q->DT, TLI))
+      return false;
+  }
----------------
Is this code in here so the case where the div is always folded away is always handled, as we're at worst going to relax to poison there and not introduce UB?

If so, I think it might be more elegant to sink this check into FoldOpIntoSelect and use the isSafeToSpeculativelyExecute variant that accepts operands, so we can check the operation that we're actually going to introduce (and thus also skip the check if we're not going to introduce one).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146350



More information about the llvm-commits mailing list