From: Hiroshi Inoue Date: Mon, 16 Oct 2017 12:11:15 +0000 (+0000) Subject: [PowerPC] fix up in sign-/zero-extension elimination X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=41bfb49b40cfa3a33bdfe9073a6342edaab98868;p=llvm [PowerPC] fix up in sign-/zero-extension elimination 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 --- diff --git a/lib/Target/PowerPC/PPCInstrInfo.cpp b/lib/Target/PowerPC/PPCInstrInfo.cpp index 9da20d9bc6f..b4da2d65596 100644 --- a/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -2256,6 +2256,8 @@ PPCInstrInfo::isSignOrZeroExtended(const MachineInstr &MI, bool SignExt, if (CallMI.isCall() && CallMI.getOperand(0).isGlobal()) { const Function *CalleeFn = dyn_cast(CallMI.getOperand(0).getGlobal()); + if (!CalleeFn) + return false; const IntegerType *IntTy = dyn_cast(CalleeFn->getReturnType()); const AttributeSet &Attrs =