From: Rong Xu Date: Mon, 24 Oct 2016 16:50:12 +0000 (+0000) Subject: Check the number of Args in LibCallsShrinkWrap. X-Git-Tag: llvmorg-4.0.0-rc1~6439 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b05bac940da334e10dee66f4d1d88c53014bcf5d;p=platform%2Fupstream%2Fllvm.git Check the number of Args in LibCallsShrinkWrap. Some library fucntions can have no argument. llvm-svn: 284989 --- diff --git a/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp b/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp index cf56a58..c992498 100644 --- a/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp +++ b/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp @@ -317,6 +317,8 @@ void LibCallsShrinkWrap::checkCandidate(CallInst &CI) { if (!TLI.getLibFunc(*Callee, Func) || !TLI.has(Func)) return; + if (CI.getNumArgOperands() == 0) + return; // TODO: Handle long double in other formats. Type *ArgType = CI.getArgOperand(0)->getType(); if (!(ArgType->isFloatTy() || ArgType->isDoubleTy() ||