Fix build with LLVM 3.1

This commit is contained in:
Matt Pharr
2013-08-06 17:55:37 -07:00
parent cd9afe946c
commit 5e5d42b918

View File

@@ -4556,6 +4556,8 @@ PeepholePass::PeepholePass()
: BasicBlockPass(ID) { : BasicBlockPass(ID) {
} }
#ifndef LLVM_3_1
using namespace llvm::PatternMatch; using namespace llvm::PatternMatch;
template<typename Op_t, unsigned Opcode> template<typename Op_t, unsigned Opcode>
@@ -4706,6 +4708,7 @@ inline SDiv2_match<V>
m_SDiv2(const V &v) { m_SDiv2(const V &v) {
return SDiv2_match<V>(v); return SDiv2_match<V>(v);
} }
// Returns true if the given function has a call to an intrinsic function // Returns true if the given function has a call to an intrinsic function
// in its definition. // in its definition.
static bool static bool
@@ -4874,6 +4877,7 @@ lMatchAvgDownInt16(llvm::Value *inst) {
} }
return NULL; return NULL;
} }
#endif // !LLVM_3_1
bool bool
PeepholePass::runOnBasicBlock(llvm::BasicBlock &bb) { PeepholePass::runOnBasicBlock(llvm::BasicBlock &bb) {
@@ -4885,6 +4889,7 @@ PeepholePass::runOnBasicBlock(llvm::BasicBlock &bb) {
llvm::Instruction *inst = &*iter; llvm::Instruction *inst = &*iter;
llvm::Instruction *builtinCall = NULL; llvm::Instruction *builtinCall = NULL;
#ifndef LLVM_3_1
if (!builtinCall) if (!builtinCall)
builtinCall = lMatchAvgUpUInt8(inst); builtinCall = lMatchAvgUpUInt8(inst);
if (!builtinCall) if (!builtinCall)
@@ -4901,7 +4906,7 @@ PeepholePass::runOnBasicBlock(llvm::BasicBlock &bb) {
builtinCall = lMatchAvgDownInt8(inst); builtinCall = lMatchAvgDownInt8(inst);
if (!builtinCall) if (!builtinCall)
builtinCall = lMatchAvgDownInt16(inst); builtinCall = lMatchAvgDownInt16(inst);
#endif // LLVM_3_1
if (builtinCall != NULL) { if (builtinCall != NULL) {
llvm::ReplaceInstWithInst(inst, builtinCall); llvm::ReplaceInstWithInst(inst, builtinCall);
modifiedAny = true; modifiedAny = true;