[PATCH] D15599: [CodeGen] Fix a crash that occurs when attribute "naked" is attached to a c++ member function

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 12 13:47:27 PST 2016


hans added a subscriber: hans.
hans added a reviewer: rnk.
hans added a comment.

Just out of curiosity, where does this come up in practice?

It seems a little backward that we're first emitting a bunch of instructions, only to remove them later. It would be nice if for naked function we wouldn't emit them in the first place. But maybe that's not practical.

Anyway, this seems OK to me but I'd like to hear what Reid thinks too.


================
Comment at: lib/CodeGen/CodeGenFunction.cpp:1954
@@ +1953,3 @@
+  // Erase all allocas and their users.
+  for (auto I = EntryBB->begin(); &*I != &*AllocaInsertPt; ++I)
+    if (auto Alloca = dyn_cast<llvm::AllocaInst>(&*I))
----------------
would declaring I as llvm::Instruction* allow you to get rid off the "&*" stuff here and below? If so, same for "auto BB" further down.

================
Comment at: lib/CodeGen/CodeGenFunction.cpp:1972
@@ +1971,3 @@
+      ++BB;
+    else {
+      BB++->eraseFromParent();
----------------
i don't think there's any need for curlies around the else branch here, especially since there are none for the then-branch


http://reviews.llvm.org/D15599





More information about the cfe-commits mailing list