mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-14 15:25:25 +00:00
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
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user