[PATCH] D138496: [OMPIRBuilder] Add OpenMPDefaultSimdAlignment field to TargetMachine class

Dominik Adamski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 03:26:00 PST 2022


domada added a comment.

@jsjodin thanks for your remark. Let me add some more information to this patch.

Currently clang emits information about preferred simd alignment only for X86, WebAssembly and PPC targets.

If we generate code for one of these targets then we expand `#pragma omp simd aligned(aligned_var)` into `call void @llvm.assume(i1 true) [ "align"(ptr aligned_var, i64 alignment_size) ]` LLVM IR instruction . For other architectures (for example ARM) simd alignment is always set to 0 and the alignment assumption is not generated. I am not sure if it is ok, that we do not generate alignment assumptions for other architectures. That's why I raised this question during the last Flang-OpenMP meetings and I did not receive a clear answer.

Your code looks elegant but in my opinion it will generate different code for ARM architecture where the vector alignment is set to 64 ( https://github.com/llvm-mirror/clang/blob/master/lib/Basic/Targets/ARM.cpp#L311 ), but simd default alignment is set to 0.


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

https://reviews.llvm.org/D138496



More information about the llvm-commits mailing list