[llvm] 44d63b7 - Revert "[Local] Simplify the alignment limits in getOrEnforceKnownAlignment. NFCI"

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 18 13:24:03 PDT 2020


Author: Craig Topper
Date: 2020-04-18T13:23:29-07:00
New Revision: 44d63b7528e4142bda9f3daba9c11cb460cb7d77

URL: https://github.com/llvm/llvm-project/commit/44d63b7528e4142bda9f3daba9c11cb460cb7d77
DIFF: https://github.com/llvm/llvm-project/commit/44d63b7528e4142bda9f3daba9c11cb460cb7d77.diff

LOG: Revert "[Local] Simplify the alignment limits in getOrEnforceKnownAlignment. NFCI"

This reverts commit e00cfe254d99629ec344031adfe1878a84f3b0b3.

Seems to be causing a linker error on the build bots.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/Local.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index b013b4681087..b9dff8c02ce4 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1215,11 +1215,13 @@ unsigned llvm::getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign,
 
   // Avoid trouble with ridiculously large TrailZ values, such as
   // those computed from a null pointer.
-  // LLVM doesn't support alignments larger than (1 << MaxAlignmentExponent).
-  TrailZ = std::min(TrailZ, Value::MaxAlignmentExponent);
+  TrailZ = std::min(TrailZ, unsigned(sizeof(unsigned) * CHAR_BIT - 1));
 
   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);
 


        


More information about the llvm-commits mailing list