OSDN Git Service

[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 9da20d9..b4da2d6 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 =