diff options
| author | Anna Thomas <anna@azul.com> | 2016-06-24 12:38:45 +0000 |
|---|---|---|
| committer | Anna Thomas <anna@azul.com> | 2016-06-24 12:38:45 +0000 |
| commit | 671513553cd9b202872da27ebeb70548f3075d51 (patch) | |
| tree | e4d1b29b84dc8dcf453a21ae9a6e26127a72380e /llvm/lib | |
| parent | 3e2c30d4473e95b5891196051223e88b91d9f68e (diff) | |
| download | bcm5719-llvm-671513553cd9b202872da27ebeb70548f3075d51.tar.gz bcm5719-llvm-671513553cd9b202872da27ebeb70548f3075d51.zip | |
[LICM] Avoid repeating expensive call while promoting loads. NFC
Summary:
We can avoid repeating the check `isGuaranteedToExecute` when it's already called once while checking if the alignment can be widened for the load/store being hoisted.
The function is invariant for the same instruction `UI` in `isGuaranteedToExecute(*UI, DT, CurLoop, SafetyInfo);`
Reviewers: hfinkel, eli.friedman
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D21672
llvm-svn: 273671
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LICM.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index b67bd24ecb8..de1691d5052 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -945,15 +945,16 @@ bool llvm::promoteLoopAccessesToScalars( // instruction will be executed, update the alignment. // Larger is better, with the exception of 0 being the best alignment. unsigned InstAlignment = Store->getAlignment(); - if ((InstAlignment > Alignment || InstAlignment == 0) && Alignment != 0) + if ((InstAlignment > Alignment || InstAlignment == 0) && + Alignment != 0) { if (isGuaranteedToExecute(*UI, DT, CurLoop, SafetyInfo)) { GuaranteedToExecute = true; Alignment = InstAlignment; } - - if (!GuaranteedToExecute) + } else if (!GuaranteedToExecute) { GuaranteedToExecute = isGuaranteedToExecute(*UI, DT, CurLoop, SafetyInfo); + } if (!GuaranteedToExecute && !CanSpeculateLoad) { CanSpeculateLoad = isDereferenceableAndAlignedPointer( |

