[llvm] [LoopPeel] Ignore assume intrinsics for the mayWriteToMemory check in peelToTurnInvariantLoadsDereferenceable. (PR #171547)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 10 23:11:45 PST 2025
================
@@ -447,7 +447,10 @@ static unsigned peelToTurnInvariantLoadsDereferenceable(Loop &L,
const DataLayout &DL = L.getHeader()->getDataLayout();
for (BasicBlock *BB : L.blocks()) {
for (Instruction &I : *BB) {
- if (I.mayWriteToMemory())
+ // Don't consider llvm.assume as writing to memory.
+ if (I.mayWriteToMemory() &&
+ !(isa<IntrinsicInst>(I) &&
+ cast<IntrinsicInst>(I).getIntrinsicID() == Intrinsic::assume))
----------------
nikic wrote:
Ah, if the motivation is to hoist invariant loads, the writing check makes sense. In that case it should be fine to generalize the assume case to inaccessiblemem, because that can never alias with loads.
https://github.com/llvm/llvm-project/pull/171547
More information about the llvm-commits
mailing list