MemCpyOptimizer.cpp - hasUndefContentsMSSA - Pass DataLayout by reference. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 7 Jun 2021 16:15:55 +0000 (17:15 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 8 Jun 2021 09:41:02 +0000 (10:41 +0100)
llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp

index 6cf317a..db8d40b 100644 (file)
@@ -1275,7 +1275,7 @@ static bool hasUndefContentsMSSA(MemorySSA *MSSA, AliasAnalysis *AA, Value *V,
       // The size also doesn't matter, as an out-of-bounds access would be UB.
       AllocaInst *Alloca = dyn_cast<AllocaInst>(getUnderlyingObject(V));
       if (getUnderlyingObject(II->getArgOperand(1)) == Alloca) {
-        DataLayout DL = Alloca->getModule()->getDataLayout();
+        const DataLayout &DL = Alloca->getModule()->getDataLayout();
         if (Optional<TypeSize> AllocaSize = Alloca->getAllocationSizeInBits(DL))
           if (*AllocaSize == LTSize->getValue() * 8)
             return true;