LLVM 20.0.0git
|
#include "InstCombineInternal.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Transforms/InstCombine/InstCombiner.h"
#include "llvm/Transforms/Utils/Local.h"
#include <optional>
Go to the source code of this file.
Classes | |
struct | llvm::DenseMapInfo< LoweredPHIRecord > |
Namespaces | |
namespace | llvm |
This is an optimization pass for GlobalISel generic memory operations. | |
Macros | |
#define | DEBUG_TYPE "instcombine" |
Functions | |
STATISTIC (NumPHIsOfInsertValues, "Number of phi-of-insertvalue turned into insertvalue-of-phis") | |
STATISTIC (NumPHIsOfExtractValues, "Number of phi-of-extractvalue turned into extractvalue-of-phi") | |
STATISTIC (NumPHICSEs, "Number of PHI's that got CSE'd") | |
static bool | isSafeAndProfitableToSinkLoad (LoadInst *L) |
Return true if we know that it is safe to sink the load out of the block that defines it. | |
static bool | isDeadPHICycle (PHINode *PN, SmallPtrSetImpl< PHINode * > &PotentiallyDeadPHIs) |
Return true if this PHI node is only used by a PHI node cycle that is dead. | |
static bool | PHIsEqualValue (PHINode *PN, Value *&NonPhiInVal, SmallPtrSetImpl< PHINode * > &ValueEqualPHIs) |
Return true if this phi node is always equal to NonPhiInVal. | |
static ConstantInt * | getAnyNonZeroConstInt (PHINode &PN) |
Return an existing non-zero constant if this phi node has one, otherwise return constant 1. | |
static Value * | simplifyUsingControlFlow (InstCombiner &Self, PHINode &PN, const DominatorTree &DT) |
static Value * | foldDependentIVs (PHINode &PN, IRBuilderBase &Builder) |
Variables | |
static cl::opt< unsigned > | MaxNumPhis ("instcombine-max-num-phis", cl::init(512), cl::desc("Maximum number phis to handle in intptr/ptrint folding")) |
#define DEBUG_TYPE "instcombine" |
Definition at line 28 of file InstCombinePHI.cpp.
|
static |
Definition at line 1389 of file InstCombinePHI.cpp.
References assert(), llvm::IRBuilderBase::CreateBinOp(), llvm::IRBuilderBase::CreateGEP(), GEP, llvm::ConstantExpr::getBinOpIdentity(), llvm::BasicBlock::getFirstInsertionPt(), llvm::PHINode::getIncomingValue(), llvm::Constant::getNullValue(), llvm::PHINode::getNumIncomingValues(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::Value::getType(), llvm::PatternMatch::m_BinOp(), llvm::PatternMatch::m_c_BinOp(), llvm::PatternMatch::m_GEP(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::match(), llvm::matchSimpleRecurrence(), and llvm::IRBuilderBase::SetInsertPoint().
|
static |
Return an existing non-zero constant if this phi node has one, otherwise return constant 1.
Definition at line 1030 of file InstCombinePHI.cpp.
References assert(), llvm::Value::getType(), and llvm::User::operands().
Referenced by llvm::InstCombinerImpl::visitPHINode().
|
static |
Return true if this PHI node is only used by a PHI node cycle that is dead.
Definition at line 980 of file InstCombinePHI.cpp.
References llvm::Value::hasOneUse(), llvm::SmallPtrSetImpl< PtrType >::insert(), isDeadPHICycle(), llvm::SmallPtrSetImplBase::size(), llvm::Value::use_empty(), and llvm::Instruction::user_back().
Referenced by isDeadPHICycle(), and llvm::InstCombinerImpl::visitPHINode().
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 624 of file InstCombinePHI.cpp.
References GEP.
Referenced by llvm::InstCombinerImpl::foldPHIArgLoadIntoPHI().
|
static |
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 1002 of file InstCombinePHI.cpp.
References llvm::PHINode::incoming_values(), llvm::SmallPtrSetImpl< PtrType >::insert(), PHIsEqualValue(), and llvm::SmallPtrSetImplBase::size().
Referenced by PHIsEqualValue().
|
static |
Definition at line 1286 of file InstCombinePHI.cpp.
References llvm::all_of(), llvm::PHINode::blocks(), llvm::InstCombiner::Builder, llvm::CallingConv::C, Cond, llvm::IRBuilderBase::CreateNot(), llvm::DominatorTree::dominates(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::BasicBlock::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::DomTreeNodeBase< NodeT >::getBlock(), llvm::Value::getContext(), llvm::ConstantInt::getFalse(), llvm::BasicBlock::getFirstInsertionPt(), llvm::DomTreeNodeBase< NodeT >::getIDom(), llvm::DominatorTreeBase< NodeT, IsPostDom >::getNode(), llvm::ConstantExpr::getNot(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::ConstantInt::getTrue(), llvm::Value::getType(), llvm::PHINode::incoming_values(), llvm::DominatorTree::isReachableFromEntry(), llvm::User::operands(), llvm::IRBuilderBase::SetInsertPoint(), and llvm::zip().
STATISTIC | ( | NumPHIsOfExtractValues | , |
"Number of phi-of-extractvalue turned into extractvalue-of-phi" | |||
) |
STATISTIC | ( | NumPHIsOfInsertValues | , |
"Number of phi-of-insertvalue turned into insertvalue-of-phis" | |||
) |
|
static |
Referenced by llvm::InstCombinerImpl::foldIntegerTypedPHI().