From cbc8b8259bd809dd1f067f27d8e74b3072c97a28 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Mon, 19 Mar 2012 11:36:00 -0700 Subject: [PATCH] Use LLVMIntAsType() in opt code instead of locally-defined equivalent. --- opt.cpp | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/opt.cpp b/opt.cpp index 777637da..f4adc6bd 100644 --- a/opt.cpp +++ b/opt.cpp @@ -1264,36 +1264,6 @@ lGetBasePtrAndOffsets(llvm::Value *ptrs, llvm::Value **offsets, } -static llvm::Value * -lGetZeroOffsetVector(llvm::Value *origVec) { - if (origVec->getType() == LLVMTypes::Int32VectorType) - return LLVMInt32Vector((int32_t)0); - else - return LLVMInt64Vector((int64_t)0); -} - - -#if 0 -static void -lPrint(llvm::Value *v, int indent = 0) { - if (llvm::isa(v)) - return; - - fprintf(stderr, "%*c", indent, ' '); - v->dump(); - - llvm::Instruction *inst = llvm::dyn_cast(v); - if (inst != NULL) { - for (int i = 0; i < (int)inst->getNumOperands(); ++i) { - llvm::Value *op = inst->getOperand(i); - if (llvm::isa(op) == false) - lPrint(op, indent+4); - } - } -} -#endif - - /** Given a vector expression in vec, separate it into a compile-time constant component and a variable component, returning the two parts in *constOffset and *variableOffset. (It should be the case that the sum @@ -1885,9 +1855,9 @@ DetectGSBaseOffsetsPass::runOnBasicBlock(llvm::BasicBlock &bb) { lExtractConstantOffset(offsetVector, &constOffset, &variableOffset, callInst); if (constOffset == NULL) - constOffset = lGetZeroOffsetVector(offsetVector); + constOffset = LLVMIntAsType(0, offsetVector->getType()); if (variableOffset == NULL) - variableOffset = lGetZeroOffsetVector(offsetVector); + variableOffset = LLVMIntAsType(0, offsetVector->getType()); // See if the varying component is scaled by 2, 4, or 8. If so, // extract that scale factor and rewrite variableOffset to remove