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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 09:46:39 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()) &&
----------------
nikic wrote:

I also think that unstable pointers should still be excluded fully here. Producing a memcpy for GC pointers is presumably not correct.

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


More information about the llvm-commits mailing list