diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-08-17 14:16:37 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-08-17 14:16:37 +0000 |
commit | 823573a38137191678bf1c7194048ab51d39f33c (patch) | |
tree | 472061a6fb24c4bf3255ff53fb6d2a77bb9cbd47 /lib | |
parent | 4e81d40545b01e0ce486b4de72282e66b91f48e9 (diff) |
Guard MemoryBuiltins against self-looping GEPs, which can occur in unreachable code due to constant propagation.
Fixes PR13621.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162098 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/MemoryBuiltins.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Analysis/MemoryBuiltins.cpp b/lib/Analysis/MemoryBuiltins.cpp index c0cc27b6ec..e77d2ff9e4 100644 --- a/lib/Analysis/MemoryBuiltins.cpp +++ b/lib/Analysis/MemoryBuiltins.cpp @@ -473,6 +473,10 @@ ObjectSizeOffsetVisitor::visitExtractValueInst(ExtractValueInst&) { } SizeOffsetType ObjectSizeOffsetVisitor::visitGEPOperator(GEPOperator &GEP) { + // Ignore self-referencing GEPs, they can occur in unreachable code. + if (&GEP == GEP.getPointerOperand()) + return unknown(); + SizeOffsetType PtrData = compute(GEP.getPointerOperand()); if (!bothKnown(PtrData) || !GEP.hasAllConstantIndices()) return unknown(); |