[PATCH] D42600: [CodeGen][Shrink-wrap]split restore point
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 14 11:15:31 PDT 2023
nickdesaulniers added a comment.
In D42600#4267396 <https://reviews.llvm.org/D42600#4267396>, @sushgokh wrote:
> @nickdesaulniers Does this look good ?
>
> --- a/llvm/lib/CodeGen/ShrinkWrap.cpp
> +++ b/llvm/lib/CodeGen/ShrinkWrap.cpp
> @@ -601,6 +601,16 @@ bool ShrinkWrap::postShrinkWrapping(bool HasCandidate, MachineFunction &MF,
> CleanPreds, TII, RS))
> return false;
>
> + // FIXME: Currently, we bail out of optimisation if any of the DirtyPreds has
> + // INLINEASM_BR instruction. Also, if restore pt block address is taken, we
> + // need to make suitable changes post restore point split
> + for (MachineBasicBlock *BB : DirtyPreds)
Rather than scan every instruction in the block, I think you can use
`MachineBasicBlock::isInlineAsmBrIndirectTarget()`
Perhaps we can do that before even adding such an MBB to DirtyPreds?
> + for (const MachineInstr &MI : *BB)
> + if (MI.getOpcode() == TargetOpcode::INLINEASM_BR)
> + for (const MachineOperand &MO : MI.operands())
> + if (MO.isMBB() && MO.getMBB() == InitRestore)
> + return false;
> +
>
> // Trying to reach out to the new save point which dominates all dirty blocks.
> MachineBasicBlock *NewSave =
> FindIDom<>(**DirtyPreds.begin(), DirtyPreds, *MDT, false);
>
>
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D42600/new/
https://reviews.llvm.org/D42600
More information about the llvm-commits
mailing list