Reland '[InstructionCombining] Fixed null check after dereferencing warning. NFCI.'

This commit is contained in:
Dávid Bolvanský 2019-11-03 20:34:54 +01:00
parent 5b37c018d5
commit 058b5028de
1 changed files with 5 additions and 2 deletions

View File

@ -1724,8 +1724,11 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
// The first two arguments can vary for any GEP, the rest have to be
// static for struct slots
if (J > 1 && CurTy->isStructTy())
return nullptr;
if (J > 1) {
assert(CurTy && "No current type?");
if (CurTy->isStructTy())
return nullptr;
}
DI = J;
} else {