summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorMax Kazantsev <max.kazantsev@azul.com>2018-08-15 05:55:43 +0000
committerMax Kazantsev <max.kazantsev@azul.com>2018-08-15 05:55:43 +0000
commit530b8d1c3d6a316b1e7c33471a38bc4d7dfb56dd (patch)
tree990e1367a3e312731d101bc692f3ed608105ee5d /llvm/lib/Transforms/Scalar
parentdf58dd84182a78ac48e1199ca95e9ecbab9db1ea (diff)
downloadbcm5719-llvm-530b8d1c3d6a316b1e7c33471a38bc4d7dfb56dd.tar.gz
bcm5719-llvm-530b8d1c3d6a316b1e7c33471a38bc4d7dfb56dd.zip
[NFC] Refactoring of LoopSafetyInfo, step 1
Turn structure into class, encapsulate methods, add clarifying comments. Differential Revision: https://reviews.llvm.org/D50693 Reviewed By: reames llvm-svn: 339752
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp4
-rw-r--r--llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp4
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnswitch.cpp2
3 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 890c449eb7e..878afe17cc4 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -261,7 +261,7 @@ bool LoopInvariantCodeMotion::runOnLoop(
// Compute loop safety information.
LoopSafetyInfo SafetyInfo;
- computeLoopSafetyInfo(&SafetyInfo, L);
+ SafetyInfo.computeLoopSafetyInfo(L);
// We want to visit all of the instructions in this loop... that are not parts
// of our subloops (they have already had their invariants hoisted out of
@@ -1310,7 +1310,7 @@ bool llvm::promoteLoopAccessesToScalars(
const DataLayout &MDL = Preheader->getModule()->getDataLayout();
bool IsKnownThreadLocalObject = false;
- if (SafetyInfo->MayThrow) {
+ if (SafetyInfo->anyBlockMayThrow()) {
// If a loop can throw, we have to insert a store along each unwind edge.
// That said, we can't actually make the unwind edge explicit. Therefore,
// we have to prove that the store is dead along the unwind edge. We do
diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index 653948717fb..880cbc3db88 100644
--- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -320,8 +320,8 @@ bool LoopIdiomRecognize::runOnCountableLoop() {
// The following transforms hoist stores/memsets into the loop pre-header.
// Give up if the loop has instructions may throw.
LoopSafetyInfo SafetyInfo;
- computeLoopSafetyInfo(&SafetyInfo, CurLoop);
- if (SafetyInfo.MayThrow)
+ SafetyInfo.computeLoopSafetyInfo(CurLoop);
+ if (SafetyInfo.anyBlockMayThrow())
return MadeChange;
// Scan all the blocks in the loop that are not in subloops.
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
index 6aad077ff19..45889bfe20f 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -520,7 +520,7 @@ bool LoopUnswitch::runOnLoop(Loop *L, LPPassManager &LPM_Ref) {
SanitizeMemory = F->hasFnAttribute(Attribute::SanitizeMemory);
if (SanitizeMemory)
- computeLoopSafetyInfo(&SafetyInfo, L);
+ SafetyInfo.computeLoopSafetyInfo(L);
bool Changed = false;
do {
OpenPOWER on IntegriCloud