From 22e9b8d4d4639701c9aec9f07c3f720db4fdfef7 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Mon, 24 Dec 2018 05:55:50 +0000 Subject: [PATCH] [LoopIdioms] More LocationSize::precise annotations; NFC Both of these places reference memset-like loops. Memset is precise. Trying to keep these patches super small so they're easily post-commit verifiable, as requested in D44748. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350044 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp | 3 ++- lib/Transforms/Scalar/LoopIdiomRecognize.cpp | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp b/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp index 702d68fad9b..985f41f3a7d 100644 --- a/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp +++ b/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp @@ -1975,7 +1975,8 @@ mayLoopAccessLocation(Value *Ptr, ModRefInfo Access, Loop *L, // If the loop iterates a fixed number of times, we can refine the access // size to be exactly the size of the memset, which is (BECount+1)*StoreSize if (const SCEVConstant *BECst = dyn_cast(BECount)) - AccessSize = (BECst->getValue()->getZExtValue() + 1) * StoreSize; + AccessSize = LocationSize::precise((BECst->getValue()->getZExtValue() + 1) * + StoreSize); // TODO: For this to be really effective, we have to dive into the pointer // operand in the store. Store to &A[i] of 100 will always return may alias diff --git a/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/lib/Transforms/Scalar/LoopIdiomRecognize.cpp index 241dbed30e1..a52235ae5d4 100644 --- a/lib/Transforms/Scalar/LoopIdiomRecognize.cpp +++ b/lib/Transforms/Scalar/LoopIdiomRecognize.cpp @@ -779,12 +779,13 @@ mayLoopAccessLocation(Value *Ptr, ModRefInfo Access, Loop *L, // Get the location that may be stored across the loop. Since the access is // strided positively through memory, we say that the modified location starts // at the pointer and has infinite size. - uint64_t AccessSize = MemoryLocation::UnknownSize; + LocationSize AccessSize = LocationSize::unknown(); // If the loop iterates a fixed number of times, we can refine the access size // to be exactly the size of the memset, which is (BECount+1)*StoreSize if (const SCEVConstant *BECst = dyn_cast(BECount)) - AccessSize = (BECst->getValue()->getZExtValue() + 1) * StoreSize; + AccessSize = LocationSize::precise((BECst->getValue()->getZExtValue() + 1) * + StoreSize); // TODO: For this to be really effective, we have to dive into the pointer // operand in the store. Store to &A[i] of 100 will always return may alias -- 2.50.1