[llvm] [CodeGen] Correctly handle non-standard cases in RemoveLoadsIntoFakeUses (PR #111551)
Jeremy Morse via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 24 08:51:25 PST 2025
================
@@ -74,6 +77,10 @@ INITIALIZE_PASS_END(RemoveLoadsIntoFakeUses, DEBUG_TYPE,
"Remove Loads Into Fake Uses", false, false)
bool RemoveLoadsIntoFakeUses::runOnMachineFunction(MachineFunction &MF) {
+ // Skip this pass if we would use VarLoc-based LDV, as there may be DBG_VALUE
+ // instructions of the restored values that would become invalid.
+ if (debuginfoShouldUseDebugInstrRef(MF.getTarget().getTargetTriple()))
+ return false;
----------------
jmorse wrote:
I believe instead this should be using the "UseDebugInstrRef" field of MachineFunction -- observe the `MachineFunction::shouldUseDebugInstrRef` function, there are compositions of attributes and flags that mess up instruction referencing, thus it's enabled on a function-by-function basis.
Sad to say, but that'll mean we need a test too.
https://github.com/llvm/llvm-project/pull/111551
More information about the llvm-commits
mailing list