[llvm] [SROA] Optimize reloaded values in allocas that escape into readonly nocapture calls. (PR #116645)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 1 05:24:20 PST 2024
================
@@ -5454,6 +5475,79 @@ void SROA::clobberUse(Use &U) {
}
}
+/// A basic LoadAndStorePromoter that does not remove store nodes.
+class BasicLoadAndStorePromoter : public LoadAndStorePromoter {
+public:
+ BasicLoadAndStorePromoter(ArrayRef<const Instruction *> Insts, SSAUpdater &S,
+ Type *ZeroType)
+ : LoadAndStorePromoter(Insts, S), ZeroType(ZeroType) {}
+ bool shouldDelete(Instruction *I) const override {
+ return !isa<StoreInst>(I) && !isa<AllocaInst>(I);
+ }
+
+ Value *getValueToUseForAlloca(Instruction *I) const override {
+ return Constant::getNullValue(ZeroType);
----------------
davemgreen wrote:
I thought we were trying to remove uses of undef?
https://github.com/llvm/llvm-project/pull/116645
More information about the llvm-commits
mailing list