[PATCH] D69086: [IR] Fix mayReadFromMemory() for writeonly calls

Yevgeny Rouban via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 23:53:28 PDT 2019


yrouban created this revision.
yrouban added reviewers: craig.topper, lattner, arsenm, apilipenko.
Herald added subscribers: hiraditya, wdng.
Herald added a project: LLVM.

Current implementation of //Instruction::mayReadFromMemory()// returns //!doesNotAccessMemory()// which is //!ReadNone//. This does not take into account that the //writeonly// attribute also indicates that the call does not read from memory.
The patch proposes to change the predicate to //!doesNotReadMemory()// that reflects the intended behavior.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69086

Files:
  llvm/lib/IR/Instruction.cpp


Index: llvm/lib/IR/Instruction.cpp
===================================================================
--- llvm/lib/IR/Instruction.cpp
+++ llvm/lib/IR/Instruction.cpp
@@ -524,7 +524,7 @@
   case Instruction::Call:
   case Instruction::Invoke:
   case Instruction::CallBr:
-    return !cast<CallBase>(this)->doesNotAccessMemory();
+    return !cast<CallBase>(this)->doesNotReadMemory();
   case Instruction::Store:
     return !cast<StoreInst>(this)->isUnordered();
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69086.225356.patch
Type: text/x-patch
Size: 470 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191017/cecdd6e0/attachment.bin>


More information about the llvm-commits mailing list