[PATCH] D62766: [Attributor] Deduce "nosync" function attribute.

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 07:41:58 PDT 2019


arsenm added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:352-355
+      /// isvolatile is 4th argument in these intrinsics.
+      Value *Arg = II->getOperand(3);
+      if (Arg->getType()->isIntegerTy(1) &&
+          cast<ConstantInt>(Arg)->getValue() == 1)
----------------
It would be clearer to cast to MemIntrinsic and check isVolatile


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:366-379
+bool AANoSyncFunction::isVolatile(Instruction *I) {
+  switch (I->getOpcode()) {
+  case Instruction::AtomicRMW:
+    return cast<AtomicRMWInst>(I)->isVolatile();
+  case Instruction::Store:
+    return cast<StoreInst>(I)->isVolatile();
+  case Instruction::Load:
----------------
I'm pretty sure this is repeated in several passes, and incomplete. Target intrinsics can also be considered volatile, as there is a hook to get the memory properties for them


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62766/new/

https://reviews.llvm.org/D62766





More information about the llvm-commits mailing list