aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineVerifier.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2017-02-17 18:50:15 +0000
committerTim Northover <tnorthover@apple.com>2017-02-17 18:50:15 +0000
commit88634996c7eee18a5e4517069db052815530e4b9 (patch)
tree53c9e64c9fd2cf082b788824fcb95b2338c4aa2f /llvm/lib/CodeGen/MachineVerifier.cpp
parentab0f3b43e3212fae8ce04c75f0d341f6400ce121 (diff)
downloadllvm-88634996c7eee18a5e4517069db052815530e4b9.zip
llvm-88634996c7eee18a5e4517069db052815530e4b9.tar.gz
llvm-88634996c7eee18a5e4517069db052815530e4b9.tar.bz2
GlobalISel: verify that generic loads & stores have a mem operand.
The mem operand is used by GlobalISel to convey atomic constraints so dropping it is invalid. llvm-svn: 295476
Diffstat (limited to 'llvm/lib/CodeGen/MachineVerifier.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineVerifier.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index 74709dc..15694cb 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/lib/CodeGen/MachineVerifier.cpp
@@ -908,6 +908,14 @@ void MachineVerifier::visitMachineInstrBefore(const MachineInstr *MI) {
}
}
+ // Generic loads and stores must have a single MachineMemOperand
+ // describing that access.
+ if ((MI->getOpcode() == TargetOpcode::G_LOAD ||
+ MI->getOpcode() == TargetOpcode::G_STORE) &&
+ !MI->hasOneMemOperand())
+ report("Generic instruction accessing memory must have one mem operand",
+ MI);
+
StringRef ErrorInfo;
if (!TII->verifyInstruction(*MI, ErrorInfo))
report(ErrorInfo.data(), MI);