[PATCH] D21672: [LICM] Avoid repeating expensive call while promoting loads. NFC
Anna Thomas via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 23 19:03:10 PDT 2016
anna created this revision.
anna added reviewers: hfinkel, eli.friedman.
anna added a subscriber: llvm-commits.
anna set the repository for this revision to rL LLVM.
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);`
Repository:
rL LLVM
http://reviews.llvm.org/D21672
Files:
lib/Transforms/Scalar/LICM.cpp
Index: lib/Transforms/Scalar/LICM.cpp
===================================================================
--- lib/Transforms/Scalar/LICM.cpp
+++ lib/Transforms/Scalar/LICM.cpp
@@ -945,13 +945,13 @@
// 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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21672.61751.patch
Type: text/x-patch
Size: 924 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160624/f6aec3cb/attachment.bin>
More information about the llvm-commits
mailing list