[llvm] [LoopIdiom] Don't convert `memset.inline` into `memset` (PR #227650)
Ömer Sinan Ağacan via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 30 04:13:14 PDT 2026
================
@@ -1096,6 +1099,10 @@ bool LoopIdiomRecognize::processLoopStridedStore(
Value *StoredVal, Instruction *TheStore,
SmallPtrSetImpl<Instruction *> &Stores, const SCEVAddRecExpr *Ev,
const SCEV *BECount, bool IsNegStride, bool IsLoopMemset) {
+ // The same check as in `processLoopStoreOfLoopLoad`, see the comments there.
+ if (auto *MSI = dyn_cast<MemSetInst>(TheStore); MSI && MSI->isForceInlined())
+ return false;
+
----------------
osa1 wrote:
This branch is not taken currently because of the other guard I added in this PR. we could convert it into an assert.
The reasons why I added this:
- There are a bunch of calls to this function, and it's hard to ensure that it'll never be passed an `memset.inline`.
- To be consistent with the same function for `memcpy`, which also has the same problem. (the guard there also doesn't run at all)
I'll convert both of them into asserts.
https://github.com/llvm/llvm-project/pull/227650
More information about the llvm-commits
mailing list