[llvm] 98eaacd - Assert we've found both vector types. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 05:37:42 PDT 2020


Author: Simon Pilgrim
Date: 2020-09-14T13:24:17+01:00
New Revision: 98eaacd73d40eb28d5fa86bc3cfc9371581ee0cb

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

LOG: Assert we've found both vector types. NFCI.

Fixes clang static analyzer warning about potential null dereferences.

Added: 
    

Modified: 
    llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp b/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp
index d8008320696c..f36b34115703 100644
--- a/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp
+++ b/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp
@@ -1062,6 +1062,7 @@ static Value *CheckAndCreateOffsetAdd(Value *X, Value *Y, Value *GEP,
     FixSummands(YElType, X);
     XElType = cast<FixedVectorType>(X->getType());
   }
+  assert(XElType && YElType && "Unknown vector types");
   // Check that the summands are of compatible types
   if (XElType != YElType) {
     LLVM_DEBUG(dbgs() << "masked gathers/scatters: incompatible gep offsets\n");


        


More information about the llvm-commits mailing list