From: Peizhao Ou Date: Wed, 7 Mar 2018 20:21:46 +0000 (-0800) Subject: Adds cast to 64-bit integers and set fake conditional branch insert point to proper... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=edc7ba5cabb73ad0375a10e60b187b6cd41ccf31;p=oota-llvm.git Adds cast to 64-bit integers and set fake conditional branch insert point to proper phi position --- diff --git a/lib/CodeGen/CodeGenPrepare.cpp b/lib/CodeGen/CodeGenPrepare.cpp index 5f22c14f90f..5b1f8a064be 100644 --- a/lib/CodeGen/CodeGenPrepare.cpp +++ b/lib/CodeGen/CodeGenPrepare.cpp @@ -791,19 +791,20 @@ void TaintRelaxedLoads(Instruction* UsageInst, Instruction* InsertPoint) { auto* BB = UsageInst->getParent(); if (InsertPoint == nullptr) { InsertPoint = UsageInst->getNextNode(); - while (dyn_cast(InsertPoint)) { - InsertPoint = InsertPoint->getNextNode(); - } + } + // Insert instructions after PHI nodes. + while (dyn_cast(InsertPoint)) { + InsertPoint = InsertPoint->getNextNode(); } // First thing is to cast 'UsageInst' to an integer type if necessary. Value* AndTarget = nullptr; - if (IntegerType::classof(UsageInst->getType())) { + Type* TargetIntegerType = + IntegerType::get(UsageInst->getContext(), + BB->getModule()->getDataLayout().getPointerSizeInBits()); + if (UsageInst->getType() == TargetIntegerType) { AndTarget = UsageInst; } else { - Type* TargetIntegerType = IntegerType::get( - UsageInst->getContext(), - BB->getModule()->getDataLayout().getPointerSizeInBits()); - IRBuilder Builder(UsageInst->getNextNode()); + IRBuilder Builder(InsertPoint); AndTarget = createCast(Builder, UsageInst, TargetIntegerType); }