[PATCH] D129025: [SimplifyCFG] Skip hoisting common instructions that return token type

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 4 14:28:06 PDT 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1477
+  if (isa<PHINode>(I1) || !I1->isIdenticalToWhenDefined(I2) ||
+      I1->getType()->isTokenTy() || I2->getType()->isTokenTy())
     return false;
----------------
ychen wrote:
> nikic wrote:
> > Ugh, I could have sworn I left a comment here, but apparently I didn't: This check shouldn't be here, it should be in the do/while loop below. Otherwise you'll only check that the first instruction doesn't return a token type, but may still hoist it if it's a later instruction.
> Ah, thanks for the remainder. After giving it another thought, I'm curious if the check should be in `isIdenticalToWhenDefined` to say that `any two token-returning instructions are distinct`? WDYT?
I think isIdenticalToWhenDefined() is a too generic API for this check. I don't think there's anything generally wrong with merging token-returning calls -- the problem here is that we want to either hoist both the token-producing and token-consuming calls, or neither, and the simplest way to do that is to never hoist them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129025



More information about the llvm-commits mailing list