diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index b3eb75ea8a8..a04e56916f8 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -703,7 +703,10 @@ static Value *rewriteGEPAsOffset(Value *Start, Value *Base, continue; if (auto *CI = dyn_cast<CastInst>(Val)) { - NewInsts[CI] = NewInsts[CI->getOperand(0)]; + // Don't get rid of the intermediate variable here; the store can grow + // the map which will invalidate the reference to the input value. + Value *V = NewInsts[CI->getOperand(0)]; + NewInsts[CI] = V; continue; } if (auto *GEP = dyn_cast<GEPOperator>(Val)) { |

