[all-commits] [llvm/llvm-project] 3d08ad: [ExtendLifetimes] Implement llvm.fake.use to exten...

Stephen Tozer via All-commits all-commits at lists.llvm.org
Thu Aug 29 09:53:54 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3d08ade7bd32f0296e0ca3a13640cc95fa89229a
      https://github.com/llvm/llvm-project/commit/3d08ade7bd32f0296e0ca3a13640cc95fa89229a
  Author: Stephen Tozer <stephen.tozer at sony.com>
  Date:   2024-08-29 (Thu, 29 Aug 2024)

  Changed paths:
    M llvm/docs/LangRef.rst
    M llvm/include/llvm/Analysis/PtrUseVisitor.h
    M llvm/include/llvm/CodeGen/ISDOpcodes.h
    M llvm/include/llvm/CodeGen/MachineInstr.h
    M llvm/include/llvm/CodeGen/Passes.h
    M llvm/include/llvm/CodeGen/SelectionDAGISel.h
    M llvm/include/llvm/IR/Intrinsics.td
    M llvm/include/llvm/InitializePasses.h
    M llvm/include/llvm/Passes/MachinePassRegistry.def
    M llvm/include/llvm/Support/TargetOpcodes.def
    M llvm/include/llvm/Target/Target.td
    M llvm/lib/CodeGen/Analysis.cpp
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    M llvm/lib/CodeGen/CMakeLists.txt
    M llvm/lib/CodeGen/CodeGen.cpp
    M llvm/lib/CodeGen/CodeGenPrepare.cpp
    M llvm/lib/CodeGen/DeadMachineInstructionElim.cpp
    M llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
    M llvm/lib/CodeGen/GlobalISel/Utils.cpp
    M llvm/lib/CodeGen/MachineCSE.cpp
    M llvm/lib/CodeGen/MachineScheduler.cpp
    M llvm/lib/CodeGen/MachineSink.cpp
    A llvm/lib/CodeGen/RemoveLoadsIntoFakeUses.cpp
    M llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
    M llvm/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
    M llvm/lib/CodeGen/TargetPassConfig.cpp
    M llvm/lib/IR/Instruction.cpp
    M llvm/lib/IR/Verifier.cpp
    M llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
    M llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp
    M llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
    M llvm/lib/Target/X86/X86FloatingPoint.cpp
    M llvm/lib/Transforms/Scalar/SROA.cpp
    M llvm/lib/Transforms/Utils/CloneFunction.cpp
    M llvm/lib/Transforms/Utils/Local.cpp
    M llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
    M llvm/test/Analysis/ScalarEvolution/flags-from-poison-dbg.ll
    M llvm/test/CodeGen/AArch64/O0-pipeline.ll
    M llvm/test/CodeGen/AArch64/O3-pipeline.ll
    M llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
    M llvm/test/CodeGen/ARM/O3-pipeline.ll
    M llvm/test/CodeGen/LoongArch/O0-pipeline.ll
    M llvm/test/CodeGen/LoongArch/opt-pipeline.ll
    A llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
    M llvm/test/CodeGen/PowerPC/O0-pipeline.ll
    M llvm/test/CodeGen/PowerPC/O3-pipeline.ll
    M llvm/test/CodeGen/RISCV/O0-pipeline.ll
    M llvm/test/CodeGen/RISCV/O3-pipeline.ll
    M llvm/test/CodeGen/X86/O0-pipeline.ll
    A llvm/test/CodeGen/X86/fake-use-hpfloat.ll
    A llvm/test/CodeGen/X86/fake-use-ld.ll
    A llvm/test/CodeGen/X86/fake-use-scheduler.mir
    A llvm/test/CodeGen/X86/fake-use-simple-tail-call.ll
    A llvm/test/CodeGen/X86/fake-use-suppress-load.ll
    A llvm/test/CodeGen/X86/fake-use-tailcall.ll
    A llvm/test/CodeGen/X86/fake-use-vector.ll
    A llvm/test/CodeGen/X86/fake-use-vector2.ll
    A llvm/test/CodeGen/X86/fake-use-zero-length.ll
    M llvm/test/CodeGen/X86/opt-pipeline.ll
    A llvm/test/DebugInfo/AArch64/fake-use-global-isel.ll
    A llvm/test/DebugInfo/Inputs/check-fake-use.py
    A llvm/test/DebugInfo/X86/fake-use.ll
    M llvm/test/TableGen/GlobalISelCombinerEmitter/match-table.td
    A llvm/test/Transforms/CodeGenPrepare/X86/fake-use-phi.ll
    A llvm/test/Transforms/CodeGenPrepare/X86/fake-use-split-ret.ll
    A llvm/test/Transforms/GVN/fake-use-constprop.ll
    A llvm/test/Transforms/SROA/fake-use-escape.ll
    A llvm/test/Transforms/SROA/fake-use-sroa.ll
    M llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn

  Log Message:
  -----------
  [ExtendLifetimes] Implement llvm.fake.use to extend variable lifetimes (#86149)

This patch is part of a set of patches that add an `-fextend-lifetimes`
flag to clang, which extends the lifetimes of local variables and
parameters for improved debuggability. In addition to that flag, the
patch series adds a pragma to selectively disable `-fextend-lifetimes`,
and an `-fextend-this-ptr` flag which functions as `-fextend-lifetimes`
for this pointers only. All changes and tests in these patches were
written by Wolfgang Pieb (@wolfy1961), while Stephen Tozer (@SLTozer)
has handled review and merging. The extend lifetimes flag is intended to
eventually be set on by `-Og`, as discussed in the RFC
here:

https://discourse.llvm.org/t/rfc-redefine-og-o1-and-add-a-new-level-of-og/72850

This patch implements a new intrinsic instruction in LLVM,
`llvm.fake.use` in IR and `FAKE_USE` in MIR, that takes a single operand
and has no effect other than "using" its operand, to ensure that its
operand remains live until after the fake use. This patch does not emit
fake uses anywhere; the next patch in this sequence causes them to be
emitted from the clang frontend, such that for each variable (or this) a
fake.use operand is inserted at the end of that variable's scope, using
that variable's value. This patch covers everything post-frontend, which
is largely just the basic plumbing for a new intrinsic/instruction,
along with a few steps to preserve the fake uses through optimizations
(such as moving them ahead of a tail call or translating them through
SROA).

Co-authored-by: Stephen Tozer <stephen.tozer at sony.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list