Check the number of Args in LibCallsShrinkWrap.
authorRong Xu <xur@google.com>
Mon, 24 Oct 2016 16:50:12 +0000 (16:50 +0000)
committerRong Xu <xur@google.com>
Mon, 24 Oct 2016 16:50:12 +0000 (16:50 +0000)
Some library fucntions can have no argument.

llvm-svn: 284989

llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp

index cf56a58..c992498 100644 (file)
@@ -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() ||