From b05bac940da334e10dee66f4d1d88c53014bcf5d Mon Sep 17 00:00:00 2001 From: Rong Xu Date: Mon, 24 Oct 2016 16:50:12 +0000 Subject: [PATCH] Check the number of Args in LibCallsShrinkWrap. Some library fucntions can have no argument. llvm-svn: 284989 --- llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp | 2 ++ 1 file changed, 2 insertions(+) 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() || -- 2.7.4