[llvm] [CHERI] Refine LoopIdiomRecognize handling of non-integral pointers. (PR #189402)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 09:43:20 PDT 2026


================
@@ -472,9 +472,10 @@ LoopIdiomRecognize::isLegalStore(StoreInst *SI) {
   Value *StorePtr = SI->getPointerOperand();
 
   // Don't convert stores of non-integral pointer types to memsets (which stores
-  // integers).
-  if (DL->isNonIntegralPointerType(StoredVal->getType()->getScalarType()))
-    return LegalStoreKind::None;
+  // integers), except for null pointers which are an exception.
+  bool NonIntegralPtrStore =
+      DL->isNonIntegralPointerType(StoredVal->getType()->getScalarType()) &&
----------------
arichardson wrote:

We should stop using this helper eventually. I think the condition where these stores are problematic is "external state || unstable"?

https://github.com/llvm/llvm-project/pull/189402


More information about the llvm-commits mailing list