realize that instructions who match intrinsics that read memory read memory.
Also, instructions with any nodes that are SDNPMayLoad also read memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45817 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/InstrInfoEmitter.cpp b/utils/TableGen/InstrInfoEmitter.cpp
index 1c1973f..f4b9179 100644
--- a/utils/TableGen/InstrInfoEmitter.cpp
+++ b/utils/TableGen/InstrInfoEmitter.cpp
@@ -174,12 +174,21 @@
const SDNodeInfo &OpInfo = CDP.getSDNodeInfo(N->getOperator());
// If node writes to memory, it obviously stores to memory.
- if (OpInfo.hasProperty(SDNPMayStore)) {
+ if (OpInfo.hasProperty(SDNPMayStore))
mayStore = true;
- } else if (const CodeGenIntrinsic *IntInfo = N->getIntrinsicInfo(CDP)) {
+
+ // If it reads memory, remember this.
+ if (OpInfo.hasProperty(SDNPMayLoad))
+ mayLoad = true;
+
+ if (const CodeGenIntrinsic *IntInfo = N->getIntrinsicInfo(CDP)) {
// If this is an intrinsic, analyze it.
- if (IntInfo->ModRef >= CodeGenIntrinsic::WriteArgMem)
+ if (IntInfo->ModRef >= CodeGenIntrinsic::WriteArgMem) {
mayStore = true;// Intrinsics that can write to memory are 'mayStore'.
+ }
+
+ if (IntInfo->ModRef >= CodeGenIntrinsic::ReadArgMem)
+ mayLoad = true;// These may also load memory.
}
}