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

omar ahmed via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 23 09:15:27 PDT 2020


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

In D76550#1936241 <https://reviews.llvm.org/D76550#1936241>, @gchatelet wrote:

> If you always deal with defined alignment there is no need to use `MaybeAlign`.
>  Use `Align` in `createReplacementValues` (it will get rid of the extra if check).
>
> Now, `LoadInst::setAlignment` takes a `MaybeAlign` but `Align` implicitly casts to `MaybeAlign` so you can safely pass in an `Align` (I'll optimize this case by providing `setAlignment` overloads later).
>
> Then if you get raw alignment values that can be `0` but you assume that `0` means `1` use `assumeAligned` <https://github.com/llvm/llvm-project/blob/ccf49b9ef012bab44b1f1322223e8b2e5ca89bad/llvm/include/llvm/Support/Alignment.h#L114>.
>  Unfortunately the naming in this context is awkward (but that's how the API is supposed to be used) `assumeAligned(AlignAA.getAssumedAlign())`.
>
> It will become better over time when `AlignAA` deals with `Align`/`MaybeAlign` directly.


I will try that thank you :)



================
Comment at: llvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll:5
 
+; XFAIL: *
 define internal i32 @test(i32* %X, i32* %Y) {
----------------
jdoerfert wrote:
> Please update the test accordingly (or wait for D76588 to pass so you can probably just run the test update script).
Okay sry :) the problem I have in this test that it is not consistent to a certain value in alignment it sometimes gives alignment of 4 to the loads and sometimes it gives no alignment which I change to normal alignment (value of 1 ) , I will try to look further in this behaviour :) , but what could possibly result in that 


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