[PATCH] D94248: [NFC][FuncAttrs] Add comment on why we look for noreturn calls

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 7 11:01:44 PST 2021


aeubanks created this revision.
aeubanks added a reviewer: reames.
Herald added a subscriber: hiraditya.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Followup to https://reviews.llvm.org/D93946.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94248

Files:
  llvm/lib/Transforms/IPO/FunctionAttrs.cpp


Index: llvm/lib/Transforms/IPO/FunctionAttrs.cpp
===================================================================
--- llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -1398,6 +1398,11 @@
 
 // A basic block can only return if it terminates with a ReturnInst and does not
 // contain calls to noreturn functions.
+// If we could assume that something like SimplifyCFG would always run before
+// FunctionAttrs and replace code after instructions that don't return with
+// unreachable, we would only need to look at the terminator. However, that's
+// not always true; for example the new PM's CGSCC pipeline first runs
+// FunctionAttrs, then function simplification passes.
 static bool basicBlockCanReturn(BasicBlock &BB) {
   if (!isa<ReturnInst>(BB.getTerminator()))
     return false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94248.315186.patch
Type: text/x-patch
Size: 835 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210107/32588e4b/attachment.bin>


More information about the llvm-commits mailing list