From 85eb4cf0d683868190fe68ad693ab5de422aace8 Mon Sep 17 00:00:00 2001 From: "james.brodman" Date: Tue, 29 Oct 2013 14:02:32 -0400 Subject: [PATCH] Fix logic that looks for shift builtins. --- opt.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/opt.cpp b/opt.cpp index bb788a8e..0cb14475 100644 --- a/opt.cpp +++ b/opt.cpp @@ -4930,8 +4930,6 @@ CreatePeepholePass() { return new PeepholePass; } -#include - /** Given an llvm::Value known to be an integer, return its value as an int64_t. */ @@ -4978,7 +4976,7 @@ ReplaceStdlibShiftPass::runOnBasicBlock(llvm::BasicBlock &bb) { if (llvm::CallInst *ci = llvm::dyn_cast(inst)) { llvm::Function *func = ci->getCalledFunction(); for (int i = 0; i < 6; i++) { - if (shifts[i] == func) { + if (shifts[i] && (shifts[i] == func)) { // we matched a call llvm::Value *shiftedVec = ci->getArgOperand(0); llvm::Value *shiftAmt = ci->getArgOperand(1);