[llvm] [LoopIdiom] Don't generate `wcslen` when the pointer passed is not known to be aligned (PR #229074)

Ömer Sinan Ağacan via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 11 01:21:32 PDT 2026


================
@@ -6422,6 +6422,11 @@ uint32_t ScalarEvolution::getMinTrailingZeros(const SCEV *S,
                   (unsigned)getTypeSizeInBits(S->getType()));
 }
 
+Align ScalarEvolution::getAlign(const SCEV *S, const Instruction *CtxI) {
+  return Align(1ULL << std::min(getMinTrailingZeros(S, CtxI),
+                                Value::MaxAlignmentExponent));
+}
----------------
osa1 wrote:

New API suggested for this in https://github.com/llvm/llvm-project/pull/230920/.

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


More information about the llvm-commits mailing list