================
@@ -51,86 +59,66 @@ char NVPTXLowerAlloca::ID = 1;
 INITIALIZE_PASS(NVPTXLowerAlloca, "nvptx-lower-alloca", "Lower Alloca", false,
                 false)
 
-// 
=============================================================================
-// Main function for this pass.
-// 
=============================================================================
-bool NVPTXLowerAlloca::runOnFunction(Function &F) {
-  if (skipFunction(F))
-    return false;
+bool NVPTXLowerAlloca::runOnModule(Module &M) {
+  bool Changed = changeDataLayout(M);
+  for (auto &F : M)
+    Changed |= lowerFunctionAllocas(F);
+  return Changed;
+}
 
-  bool Changed = false;
+bool NVPTXLowerAlloca::lowerFunctionAllocas(Function &F) {
+  SmallVector<AllocaInst *, 16> Allocas;
   for (auto &BB : F)
-    for (auto &I : BB) {
-      if (auto allocaInst = dyn_cast<AllocaInst>(&I)) {
-        Changed = true;
+    for (auto &I : BB)
----------------
AlexMaclean wrote:

Nit: use `instructions(F)`

https://github.com/llvm/llvm-project/pull/154814
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to