lebedev.ri created this revision.
lebedev.ri added reviewers: efriedma, rjmccall, rsmith, erichkeane, 
aaron.ballman, nikic.
lebedev.ri added a project: LLVM.
lebedev.ri requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Same idea as D99790 <https://reviews.llvm.org/D99790>.

As it is being noted in D99249 <https://reviews.llvm.org/D99249>, lack of 
alignment information on this has been preventing LICM from happening.
For some time now, lack of alignment attribute does *not* imply natural 
alignment, but an alignment of 1.

This causes quite a bit of clang tests to tail:

  Testing Time: 167.48s
    Unsupported      :    69
    Passed           : 27038
    Expectedly Failed:    29
    Failed           :   370
  FAILED: tools/clang/test/CMakeFiles/check-clang 

so before i go mad updating each one of them,
is this generally correct, or are we not allowed to do this?
Are there some further preconditions missing?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99791

Files:
  clang/lib/CodeGen/CGCall.cpp


Index: clang/lib/CodeGen/CGCall.cpp
===================================================================
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -2445,6 +2445,15 @@
       }
     }
 
+    if (const auto *PtrTy = ParamType->getAs<PointerType>()) {
+      QualType PTy = PtrTy->getPointeeType();
+      if (PTy->isObjectType()) {
+        llvm::Align Alignment =
+            getNaturalPointeeTypeAlignment(ParamType).getAsAlign();
+        Attrs.addAlignmentAttr(Alignment);
+      }
+    }
+
     switch (FI.getExtParameterInfo(ArgNo).getABI()) {
     case ParameterABI::Ordinary:
       break;


Index: clang/lib/CodeGen/CGCall.cpp
===================================================================
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -2445,6 +2445,15 @@
       }
     }
 
+    if (const auto *PtrTy = ParamType->getAs<PointerType>()) {
+      QualType PTy = PtrTy->getPointeeType();
+      if (PTy->isObjectType()) {
+        llvm::Align Alignment =
+            getNaturalPointeeTypeAlignment(ParamType).getAsAlign();
+        Attrs.addAlignmentAttr(Alignment);
+      }
+    }
+
     switch (FI.getExtParameterInfo(ArgNo).getABI()) {
     case ParameterABI::Ordinary:
       break;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to