[PATCH] D103186: [Attributor] Fix AAExecutionDomain returning true on invalid states

Joseph Huber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 26 10:26:50 PDT 2021


jhuber6 created this revision.
jhuber6 added a reviewer: jdoerfert.
Herald added subscribers: okura, kuter, uenoku, hiraditya.
Herald added a reviewer: uenoku.
Herald added a reviewer: homerdin.
jhuber6 requested review of this revision.
Herald added a reviewer: sstefan1.
Herald added a reviewer: baziotis.
Herald added subscribers: llvm-commits, bbn.
Herald added a project: LLVM.

This patch fixes a problem with the `AAExecutionDomain` attributor not
checking if it is in a valid state. This can cause it to incorrectly
return that a block is executed in a single threaded context after the
attributor failed for any reason.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103186

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


Index: llvm/lib/Transforms/IPO/OpenMPOpt.cpp
===================================================================
--- llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -2319,7 +2319,7 @@
   }
 
   bool isSingleThreadExecution(const BasicBlock &BB) const override {
-    return SingleThreadedBBs.contains(&BB);
+    return isValidState() && SingleThreadedBBs.contains(&BB);
   }
 
   /// Set of basic blocks that are executed by a single thread.
@@ -2339,7 +2339,8 @@
     const auto &ExecutionDomainAA = A.getAAFor<AAExecutionDomain>(
         *this, IRPosition::function(*ACS.getInstruction()->getFunction()),
         DepClassTy::REQUIRED);
-    return ExecutionDomainAA.isSingleThreadExecution(*ACS.getInstruction());
+    return ACS.isDirectCall() &&
+           ExecutionDomainAA.isSingleThreadExecution(*ACS.getInstruction());
   };
 
   if (!A.checkForAllCallSites(PredForCallSite, *this,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103186.348013.patch
Type: text/x-patch
Size: 928 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210526/804c3f69/attachment.bin>


More information about the llvm-commits mailing list