]> granicus.if.org Git - llvm/commitdiff
[PowerPC] fix up in sign-/zero-extension elimination
authorHiroshi Inoue <inouehrs@jp.ibm.com>
Mon, 16 Oct 2017 12:11:15 +0000 (12:11 +0000)
committerHiroshi Inoue <inouehrs@jp.ibm.com>
Mon, 16 Oct 2017 12:11:15 +0000 (12:11 +0000)
This patch fixes a potential problem in my previous commit (https://reviews.llvm.org/rL315888) by adding a null check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315900 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCInstrInfo.cpp

index 9da20d9bc6f5c11e4b92de4a441b8c29e82da6d7..b4da2d65596b03c446d4021a98cb99da93685264 100644 (file)
@@ -2256,6 +2256,8 @@ PPCInstrInfo::isSignOrZeroExtended(const MachineInstr &MI, bool SignExt,
           if (CallMI.isCall() && CallMI.getOperand(0).isGlobal()) {
             const Function *CalleeFn =
               dyn_cast<Function>(CallMI.getOperand(0).getGlobal());
+            if (!CalleeFn)
+              return false;
             const IntegerType *IntTy =
               dyn_cast<IntegerType>(CalleeFn->getReturnType());
             const AttributeSet &Attrs =