[all-commits] [llvm/llvm-project] 9073b4: [PromoteMemToReg] Hoist removeIntrinsicUsers into ...
Marcin Radomski via All-commits
all-commits at lists.llvm.org
Tue Sep 22 01:48:57 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 9073b4d71e9d66c495df5f6ec42ab0279326f762
https://github.com/llvm/llvm-project/commit/9073b4d71e9d66c495df5f6ec42ab0279326f762
Author: Marcin Radomski <marcin at mradomski.pl>
Date: 2026-09-22 (Tue, 22 Sep 2026)
Changed paths:
M llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
M llvm/test/Transforms/Mem2Reg/ignore-droppable.ll
M llvm/test/Transforms/Mem2Reg/ignore-lifetime.ll
Log Message:
-----------
[PromoteMemToReg] Hoist removeIntrinsicUsers into a pre-pass before promotion (#224617)
Calling removeIntrinsicUsers(AI) inside the per-alloca promotion loop in
PromoteMem2Reg::run() inserts StoreInst(undef) instructions into basic
blocks after LargeBlockInfo (LBI) has already cached instruction indices
for those blocks during earlier iterations. Every subsequent
LBI.getInstructionIndex query on newly inserted StoreInst(undef)
instructions misses in LBI.InstNumbers and triggers a full O(|BB|) basic
block rescan, resulting in O(K * |BB|) compilation time blowup in
promoteSingleBlockAlloca when a basic block contains K scoped allocas.
Hoist removeIntrinsicUsers(AI) into a pre-pass loop over all Allocas
upfront in PromoteMem2Reg::run() before the main AllocaNum promotion
loop begins so all synthetic StoreInst(undef) instructions are inserted
prior to LBI caching.
Attached test verifies this PR doesn't change the behavior compared to
HEAD.
This improves the compile time of some CUDA kernels
(https://github.com/llvm/llvm-project/pull/191909#issuecomment-5569614846)
by ~9x.
Assisted-by: Gemini
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