diff options
author | Dávid Bolvanský <david.bolvansky@gmail.com> | 2019-11-03 20:34:54 +0100 |
---|---|---|
committer | Dávid Bolvanský <david.bolvansky@gmail.com> | 2019-11-03 20:34:54 +0100 |
commit | 058b5028def7fe8b50bec9df33367e80353439a5 (patch) | |
tree | ad083256f4f4e92cb59b72cc60c6148fe56e480a /llvm/lib/Transforms | |
parent | 5b37c018d5c9add833f9a40b870345e2108614e6 (diff) | |
download | bcm5719-llvm-058b5028def7fe8b50bec9df33367e80353439a5.tar.gz bcm5719-llvm-058b5028def7fe8b50bec9df33367e80353439a5.zip |
Reland '[InstructionCombining] Fixed null check after dereferencing warning. NFCI.'
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index c4f9be0a15d..a3dfbfaf8dc 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -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 { |