[PATCH] D76550: [Attributor] Improve the alignment of the loads

omar ahmed via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 22 12:51:04 PDT 2020


omarahmed marked an inline comment as done.
omarahmed added a comment.





================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:5638-5642
+          // Whenever no alignment available for the load instruction we invoke
+          // the natural alignment.
+          createReplacementValues(MaybeAlign(AlignAA.getAssumedAlign() == 0
+                                                 ? 1
+                                                 : AlignAA.getAssumedAlign()),
----------------
lebedev.ri wrote:
> I'd suggest rephrasing this to explain what is going on, something like
> ```
> // Alignment of 0 is treated by MaybeAlign as no alignment,
> // but when no alignment is specified for the load instruction,
> // natural alignment is assumed. So we have to manually bump it to 1.
> createReplacementValues(MaybeAlign(std::max(1, AlignAA.getAssumedAlign()),
> ```
yes you are right we have to be more specific I will modify it sry :) also I forgot about the max function it is much cleaner :) 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76550/new/

https://reviews.llvm.org/D76550





More information about the llvm-commits mailing list