LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Namespaces | Functions
InstCombinePHI.cpp File Reference
#include "InstCombine.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/IR/DataLayout.h"
Include dependency graph for InstCombinePHI.cpp:

Go to the source code of this file.

Classes

struct  llvm::DenseMapInfo< LoweredPHIRecord >
 

Namespaces

 llvm
 List of target independent CodeGen pass IDs.
 

Functions

static bool isSafeAndProfitableToSinkLoad (LoadInst *L)
 
static bool DeadPHICycle (PHINode *PN, SmallPtrSet< PHINode *, 16 > &PotentiallyDeadPHIs)
 
static bool PHIsEqualValue (PHINode *PN, Value *NonPhiInVal, SmallPtrSet< PHINode *, 16 > &ValueEqualPHIs)
 

Function Documentation

static bool DeadPHICycle ( PHINode PN,
SmallPtrSet< PHINode *, 16 > &  PotentiallyDeadPHIs 
)
static

DeadPHICycle - Return true if this PHI node is only used by a PHI node cycle that is dead.

Definition at line 508 of file InstCombinePHI.cpp.

References llvm::Value::hasOneUse(), llvm::SmallPtrSet< PtrType, SmallSize >::insert(), llvm::SmallPtrSetImpl::size(), llvm::Instruction::use_back(), and llvm::Value::use_empty().

Referenced by llvm::InstCombiner::visitPHINode().

static bool isSafeAndProfitableToSinkLoad ( LoadInst L)
static

isSafeAndProfitableToSinkLoad - Return true if we know that it is safe to sink the load out of the block that defines it. This means that it must be obvious the value of the load is not changed from the point of the load to the end of the block it is in.

Finally, it is safe, but not profitable, to sink a load targeting a non-address-taken alloca. Doing so will cause us to not promote the alloca to a register.

Definition at line 247 of file InstCombinePHI.cpp.

References llvm::BasicBlock::end(), llvm::User::getOperand(), llvm::Instruction::getParent(), and llvm::GetElementPtrInst::hasAllConstantIndices().

static bool PHIsEqualValue ( PHINode PN,
Value NonPhiInVal,
SmallPtrSet< PHINode *, 16 > &  ValueEqualPHIs 
)
static

PHIsEqualValue - Return true if this phi node is always equal to NonPhiInVal. This happens with mutually cyclic phi nodes like: z = some value; x = phi (y, z); y = phi (x, z)

Definition at line 530 of file InstCombinePHI.cpp.

References llvm::PHINode::getIncomingValue(), llvm::PHINode::getNumIncomingValues(), llvm::SmallPtrSet< PtrType, SmallSize >::insert(), and llvm::SmallPtrSetImpl::size().

Referenced by llvm::InstCombiner::visitPHINode().