[PATCH] D78418: [Local] Simplify the alignment limits in getOrEnforceKnownAlignment. NFCI
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 18 01:35:49 PDT 2020
craig.topper created this revision.
craig.topper added reviewers: efriedma, spatel.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
We previously clamped the trailing zero count to 31 bits. And
then clamped the final alignment to MaximumAlignment which is
1 << 29.
This patch simplifies this to just clamp the trailing zero to
29 using MaxAlignmentExponent.
I was looking into changin this function to use Align/MaybeAlign
and noticed this.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78418
Files:
llvm/lib/Transforms/Utils/Local.cpp
Index: llvm/lib/Transforms/Utils/Local.cpp
===================================================================
--- llvm/lib/Transforms/Utils/Local.cpp
+++ llvm/lib/Transforms/Utils/Local.cpp
@@ -1215,13 +1215,11 @@
// Avoid trouble with ridiculously large TrailZ values, such as
// those computed from a null pointer.
- TrailZ = std::min(TrailZ, unsigned(sizeof(unsigned) * CHAR_BIT - 1));
+ // LLVM doesn't support alignments larger than (1 << MaxAlignmentExponent).
+ TrailZ = std::min(TrailZ, Value::MaxAlignmentExponent);
unsigned Align = 1u << std::min(Known.getBitWidth() - 1, TrailZ);
- // LLVM doesn't support alignments larger than this currently.
- Align = std::min(Align, +Value::MaximumAlignment);
-
if (PrefAlign > Align)
Align = enforceKnownAlignment(V, Align, PrefAlign, DL);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78418.258492.patch
Type: text/x-patch
Size: 821 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200418/eb3e4c42/attachment.bin>
More information about the llvm-commits
mailing list