[llvm] f494f89 - [LAA] Fix latent missing check bug when mixing scalable and non-scalabe strides

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 20 11:57:07 PDT 2022


Author: Philip Reames
Date: 2022-07-20T11:56:45-07:00
New Revision: f494f89b2a88f9de48781f43e7be2386809c7db5

URL: https://github.com/llvm/llvm-project/commit/f494f89b2a88f9de48781f43e7be2386809c7db5
DIFF: https://github.com/llvm/llvm-project/commit/f494f89b2a88f9de48781f43e7be2386809c7db5.diff

LOG: [LAA] Fix latent missing check bug when mixing scalable and non-scalabe strides

Noticed via inspection; to my knowledge, impossible to hit today.  In theory, we could have a fixed stride check be analyzed, then a scalable one.  With the old code, the scalable one would be silently dropped, and the runtime guard would go ahead with only the fixed one.  This would be a miscompile.

Added: 
    

Modified: 
    llvm/lib/Analysis/LoopAccessAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index f7f0dc4dcb1d..0bc2e761d080 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -293,8 +293,10 @@ void RuntimePointerChecking::tryToCreateDiffCheck(
       DC.getInstructionsForAccess(Sink->PointerValue, Sink->IsWritePtr);
   Type *SrcTy = getLoadStoreType(SrcInsts[0]);
   Type *DstTy = getLoadStoreType(SinkInsts[0]);
-  if (isa<ScalableVectorType>(SrcTy) || isa<ScalableVectorType>(DstTy))
+  if (isa<ScalableVectorType>(SrcTy) || isa<ScalableVectorType>(DstTy)) {
+    CanUseDiffCheck = false;
     return;
+  }
   unsigned AllocSize =
       std::max(DL.getTypeAllocSize(SrcTy), DL.getTypeAllocSize(DstTy));
   IntegerType *IntTy =


        


More information about the llvm-commits mailing list