[PATCH] D27283: Fix invalid addrspacecast due to combining alloca with global var

David Majnemer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 30 16:15:18 PST 2016


majnemer added a comment.

Please use `auto *` instead of `auto` when dealing with pointer types.



================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:240-241
+  auto NT = dyn_cast<PointerType>(V->getType());
+  assert (PT && NT && PT != NT &&
+          PT->getElementType() == NT->getElementType() && "Invalid usage");
+
----------------
Formatting.


================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:243
+
+  for (auto U: I.users()) {
+    DEBUG(llvm::dbgs() << "Found pointer user: " << *U << '\n');
----------------
Please format this appropriately.


================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:244
+  for (auto U: I.users()) {
+    DEBUG(llvm::dbgs() << "Found pointer user: " << *U << '\n');
+    if (auto LT = dyn_cast<LoadInst>(&*U)) {
----------------
Don't use `llvm::` here.


================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:268-269
+        NewI->takeName(BC);
+    } else
+      return false;
+  }
----------------
Please brace this.


================
Comment at: test/Transforms/InstCombine/memcpy-addrspace.ll:66
+declare i32 @foo(i32* %x)
\ No newline at end of file

----------------
Please fix.


https://reviews.llvm.org/D27283





More information about the llvm-commits mailing list