projects
/
llvm
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3c10eaa
)
[MachineCombiner][NFC] Prevent dereferencing past-the-end object in an MRI container
author
Gerolf Hoflehner
<ghoflehner@apple.com>
Thu, 10 Jan 2019 21:53:13 +0000
(21:53 +0000)
committer
Gerolf Hoflehner
<ghoflehner@apple.com>
Thu, 10 Jan 2019 21:53:13 +0000
(21:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350896
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/CodeGen/MachineCombiner.cpp
patch
|
blob
|
history
diff --git
a/lib/CodeGen/MachineCombiner.cpp
b/lib/CodeGen/MachineCombiner.cpp
index 0c6efff7bb40ea8ada12b4944895c92235e23301..f51b482e20e33f5302a9c924ca6f44e76f83a280 100644
(file)
--- a/
lib/CodeGen/MachineCombiner.cpp
+++ b/
lib/CodeGen/MachineCombiner.cpp
@@
-231,6
+231,8
@@
unsigned MachineCombiner::getLatency(MachineInstr *Root, MachineInstr *NewRoot,
// Get the first instruction that uses MO
MachineRegisterInfo::reg_iterator RI = MRI->reg_begin(MO.getReg());
RI++;
+ if (RI == MRI->reg_end())
+ continue;
MachineInstr *UseMO = RI->getParent();
unsigned LatencyOp = 0;
if (UseMO && BlockTrace.isDepInTrace(*Root, *UseMO)) {