[PATCH] D34905: Modify constraints in `llvm::canReplaceOperandWithVariable`

Leo Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 6 11:33:54 PDT 2017


aoli added a comment.

Hi, I changed the `canReplaceOperandWithVariable` but I did not add test for sink-common-code.ll. because I found in SimplifyCFG.cpp `canSinkInstructions:` there is a check:

  for (auto *I : Insts) {
    // These instructions may change or break semantics if moved.
    if (isa<PHINode>(I) || I->isEHPad() || isa<AllocaInst>(I) ||
        I->getType()->isTokenTy())
      return false;

So it

  } will always return false for AllocaInst.

For GVN sink, alloca instruction is also blacklisted in `GVNSink::isInstructionBlacklisted`.

So the logic in `canReplaceOperandWithVariable` will never be reached.


https://reviews.llvm.org/D34905





More information about the llvm-commits mailing list