[llvm] [NVPTX] Add NVPTXIncreaseAligmentPass to improve vectorization (PR #144958)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 24 11:25:58 PDT 2025


================
@@ -0,0 +1,131 @@
+//===-- NVPTXIncreaseAlignment.cpp - Increase alignment for local arrays --===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// A simple pass that looks at local memory arrays that are statically
+// sized and sets an appropriate alignment for them. This enables vectorization
----------------
AlexMaclean wrote:

>  I think it's the former, as 'increase' implies that it's already set, which is not necessarily the case. 

The way I think about it, alignment _is_ always set to something, it might be 1 indicating no special requirements, but every alloca always has an alignment (This is consistent with [llvm::AllocaInst::getAlign](https://llvm.org/doxygen/classllvm_1_1AllocaInst.html#a42438d0a43720a6571c9138224481754)). This pass may then increase this alignment but it will never decrease it as that could be incorrect. I think the current name conveys this constraint on the pass behavior. I'll update the comment here.   

https://github.com/llvm/llvm-project/pull/144958


More information about the llvm-commits mailing list