[llvm] [CodeGen] Use first EHLabel as a stop gate for live range shrinking (PR #114195)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 31 10:38:17 PDT 2024
================
@@ -135,6 +137,13 @@ bool LiveRangeShrink::runOnMachineFunction(MachineFunction &MF) {
continue;
if (MI.mayStore())
SawStore = true;
+ if (IsEHPad && !SawEHLabel && MI.isEHLabel() && Next != MBB.end()) {
+ // If MI is the first EHLabel of an EHPad, it should become a
+ // barrier for code motion. IOM is rebuild from the next instruction
+ // to prevent later instructions from being moved before this MI.
+ SawEHLabel = true;
+ BuildInstOrderMap(Next, IOM);
----------------
MuellerMP wrote:
Ah yes - I think I get what you were hinting at now =)
So i cant SkipPHIsLabelsAndDebug in every case since we will miss the optimization in the [original test](https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/X86/lrshrink.ll) which relies on moving uses of phis to their defs.
But we should be able to utilize the skip in the EHPad case since the assumption of ehlabels being the first non phi should still hold.
https://github.com/llvm/llvm-project/pull/114195
More information about the llvm-commits
mailing list