forked from OSchip/llvm-project
[CodeGen] Fix potential null pointer dereference. NFC.
ScalarEvolution::getSCEV dereferences its argument, s.t. passing nullptr leads to undefined behaviour. Check for nullptr before calling it instead of checking its argument afterwards. llvm-svn: 336350
This commit is contained in:
parent
8ac85d9a11
commit
9f305371d9
|
@ -160,11 +160,13 @@ static llvm::Value *getMemAccInstPointerOperand(Instruction *Inst) {
|
|||
|
||||
void ScopAnnotator::annotateSecondLevel(llvm::Instruction *Inst,
|
||||
llvm::Value *BasePtr) {
|
||||
auto *PtrSCEV = SE->getSCEV(getMemAccInstPointerOperand(Inst));
|
||||
Value *Ptr = getMemAccInstPointerOperand(Inst);
|
||||
if (!Ptr)
|
||||
return;
|
||||
|
||||
auto *PtrSCEV = SE->getSCEV(Ptr);
|
||||
auto *BasePtrSCEV = SE->getPointerBase(PtrSCEV);
|
||||
|
||||
if (!PtrSCEV)
|
||||
return;
|
||||
auto SecondLevelAliasScope = SecondLevelAliasScopeMap.lookup(PtrSCEV);
|
||||
auto SecondLevelOtherAliasScopeList =
|
||||
SecondLevelOtherAliasScopeListMap.lookup(PtrSCEV);
|
||||
|
|
Loading…
Reference in New Issue