[PATCH] D152468: [DebugInfo][RemoveDIs] Use iterators over instruction pointers when using IRBuilder in various passes

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 8 14:18:06 PDT 2023


jmorse created this revision.
Herald added subscribers: pmatos, asb, foad, ChuanqiXu, ThomasRaoux, kerbowa, pengfei, dmgreen, hiraditya, jgravelle-google, sbc100, jvesely, dschuff, arsenm.
Herald added a project: All.
jmorse requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, aheejin.
Herald added a reviewer: zuban32.
Herald added a reviewer: mpaszkowski.
Herald added a project: LLVM.

This patch adds a two-argument SetInsertPoint method to IRBuilder that takes a block/iterator instead of an instruction. The patch also updates a variety of call sites to pass around iterators instead of instruction pointers. The motivating reason for doing this is given here [0], we'd like to pass around more information about the position of debug-info in the iterator object. That necessitates passing iterators around most of the time.

The set of changes in this patch are all NFC, and cover all uses of IRBuilder that are involved in stage2clang and a couple of other large C++ codebases I have to hand. It's not all the uses of SetInsertPoint, but should give an idea of how invasive the changes we want to make are. (In my opinion: not invasive).

No tests because this is all NFC; I do have various LLVM-IR inputs that are sensitive to these changes, but the exact test strategy and what order to land patches in is up for discussion. I'll elaborate in D151419 <https://reviews.llvm.org/D151419>, and not add reviewers here yet.

[0] https://discourse.llvm.org/t/rfc-instruction-api-changes-needed-to-eliminate-debug-intrinsics-from-ir/68939


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152468

Files:
  llvm/include/llvm/IR/IRBuilder.h
  llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
  llvm/lib/Analysis/MemoryBuiltins.cpp
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/CodeGen/ExpandMemCmp.cpp
  llvm/lib/CodeGen/WasmEHPrepare.cpp
  llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp
  llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
  llvm/lib/Target/ARM/MVETailPredication.cpp
  llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp
  llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
  llvm/lib/Target/X86/X86LowerAMXIntrinsics.cpp
  llvm/lib/Transforms/Coroutines/CoroFrame.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
  llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
  llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  llvm/lib/Transforms/Scalar/LoopBoundSplit.cpp
  llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
  llvm/lib/Transforms/Utils/InlineFunction.cpp
  llvm/lib/Transforms/Utils/LCSSA.cpp
  llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp
  llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152468.529722.patch
Type: text/x-patch
Size: 39086 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230608/fe1ccf22/attachment-0001.bin>


More information about the llvm-commits mailing list