LLVM
15.0.0git
|
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumeBundleQueries.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/DomTreeUpdater.h"
#include "llvm/Analysis/EHPersonalities.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Analysis/MemorySSAUpdater.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/ConstantRange.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/GlobalObject.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Use.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <iterator>
#include <map>
#include <utility>
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "local" |
Typedefs | |
using | PredBlockVector = SmallVector< BasicBlock *, 16 > |
using | IncomingValueMap = DenseMap< BasicBlock *, Value * > |
using | DbgValReplacement = Optional< DIExpression * > |
A replacement for a dbg.value expression. More... | |
Functions | |
STATISTIC (NumRemoved, "Number of unreachable basic blocks removed") | |
STATISTIC (NumPHICSEs, "Number of PHI's that got CSE'd") | |
static bool | areAllUsesEqual (Instruction *I) |
areAllUsesEqual - Check whether the uses of a value are all the same. More... | |
static bool | simplifyAndDCEInstruction (Instruction *I, SmallSetVector< Instruction *, 16 > &WorkList, const DataLayout &DL, const TargetLibraryInfo *TLI) |
static bool | CanMergeValues (Value *First, Value *Second) |
Return true if we can choose one of these values to use in place of the other. More... | |
static bool | CanPropagatePredecessorsForPHIs (BasicBlock *BB, BasicBlock *Succ) |
Return true if we can fold BB, an almost-empty BB ending in an unconditional branch to Succ, into Succ. More... | |
static Value * | selectIncomingValueForBlock (Value *OldVal, BasicBlock *BB, IncomingValueMap &IncomingValues) |
Determines the value to use as the phi node input for a block. More... | |
static void | gatherIncomingValuesToPhi (PHINode *PN, IncomingValueMap &IncomingValues) |
Create a map from block to value for the operands of a given phi. More... | |
static void | replaceUndefValuesInPhi (PHINode *PN, const IncomingValueMap &IncomingValues) |
Replace the incoming undef values to a phi with the values from a block-to-value map. More... | |
static void | redirectValuesFromPredecessorsToPhi (BasicBlock *BB, const PredBlockVector &BBPreds, PHINode *PN) |
Replace a value flowing from a block to a phi with potentially multiple instances of that value flowing from the block's predecessors to the phi. More... | |
static bool | EliminateDuplicatePHINodesNaiveImpl (BasicBlock *BB) |
static bool | EliminateDuplicatePHINodesSetBasedImpl (BasicBlock *BB) |
static Align | tryEnforceAlignment (Value *V, Align PrefAlign, const DataLayout &DL) |
If the specified pointer points to an object that we control, try to modify the object's alignment to PrefAlign. More... | |
static bool | PhiHasDebugValue (DILocalVariable *DIVar, DIExpression *DIExpr, PHINode *APN) |
===------------------------------------------------------------------—===// Dbg Intrinsic utilities More... | |
static bool | valueCoversEntireFragment (Type *ValTy, DbgVariableIntrinsic *DII) |
Check if the alloc size of ValTy is large enough to cover the variable (or fragment of the variable) described by DII . More... | |
static DebugLoc | getDebugValueLoc (DbgVariableIntrinsic *DII, Instruction *Src) |
Produce a DebugLoc to use for each dbg.declare/inst pair that are promoted to a dbg.value. More... | |
static bool | isArray (AllocaInst *AI) |
Determine whether this alloca is either a VLA or an array. More... | |
static bool | isStructure (AllocaInst *AI) |
Determine whether this alloca is a structure. More... | |
static void | replaceOneDbgValueForAlloca (DbgValueInst *DVI, Value *NewAddress, DIBuilder &Builder, int Offset) |
Value * | getSalvageOpsForGEP (GetElementPtrInst *GEP, const DataLayout &DL, uint64_t CurrentLocOps, SmallVectorImpl< uint64_t > &Opcodes, SmallVectorImpl< Value * > &AdditionalValues) |
uint64_t | getDwarfOpForBinOp (Instruction::BinaryOps Opcode) |
Value * | getSalvageOpsForBinOp (BinaryOperator *BI, uint64_t CurrentLocOps, SmallVectorImpl< uint64_t > &Opcodes, SmallVectorImpl< Value * > &AdditionalValues) |
static bool | rewriteDebugUsers (Instruction &From, Value &To, Instruction &DomPoint, DominatorTree &DT, function_ref< DbgValReplacement(DbgVariableIntrinsic &DII)> RewriteExpr) |
Point debug users of From to To using exprs given by RewriteExpr , possibly moving/undefing users to prevent use-before-def. More... | |
static bool | isBitCastSemanticsPreserving (const DataLayout &DL, Type *FromTy, Type *ToTy) |
Check if a bitcast between a value of type FromTy to type ToTy would losslessly preserve the bits and semantics of the value. More... | |
static bool | markAliveBlocks (Function &F, SmallPtrSetImpl< BasicBlock * > &Reachable, DomTreeUpdater *DTU=nullptr) |
template<typename RootType , typename DominatesFn > | |
static unsigned | replaceDominatedUsesWith (Value *From, Value *To, const RootType &Root, const DominatesFn &Dominates) |
static const Optional< BitPart > & | collectBitParts (Value *V, bool MatchBSwaps, bool MatchBitReversals, std::map< Value *, Optional< BitPart >> &BPS, int Depth, bool &FoundRoot) |
Analyze the specified subexpression and see if it is capable of providing pieces of a bswap or bitreverse. More... | |
static bool | bitTransformIsCorrectForBSwap (unsigned From, unsigned To, unsigned BitWidth) |
static bool | bitTransformIsCorrectForBitReverse (unsigned From, unsigned To, unsigned BitWidth) |
Variables | |
static cl::opt< bool > | PHICSEDebugHash ("phicse-debug-hash", cl::init(false), cl::Hidden, cl::desc("Perform extra assertion checking to verify that PHINodes's hash " "function is well-behaved w.r.t. its isEqual predicate")) |
static cl::opt< unsigned > | PHICSENumPHISmallSize ("phicse-num-phi-smallsize", cl::init(32), cl::Hidden, cl::desc("When the basic block contains not more than this number of PHI nodes, " "perform a (faster!) exhaustive search instead of set-driven one.")) |
static const unsigned | BitPartRecursionMaxDepth = 48 |
using DbgValReplacement = Optional<DIExpression *> |
using IncomingValueMap = DenseMap<BasicBlock *, Value *> |
using PredBlockVector = SmallVector<BasicBlock *, 16> |
|
static |
areAllUsesEqual - Check whether the uses of a value are all the same.
This is similar to Instruction::hasOneUse() except this will also return true when there are no uses or multiple uses that all refer to the same value.
Definition at line 608 of file Local.cpp.
References I.
Referenced by llvm::RecursivelyDeleteDeadPHINode().
|
static |
Definition at line 3151 of file Local.cpp.
References llvm::BitWidth, and From.
Referenced by llvm::recognizeBSwapOrBitReverseIdiom().
|
static |
Definition at line 3140 of file Local.cpp.
References llvm::BitWidth, and From.
Referenced by llvm::recognizeBSwapOrBitReverseIdiom().
Return true if we can choose one of these values to use in place of the other.
Note that we will always choose the non-undef value to keep.
Definition at line 832 of file Local.cpp.
References First.
Referenced by CanPropagatePredecessorsForPHIs().
|
static |
Return true if we can fold BB, an almost-empty BB ending in an unconditional branch to Succ, into Succ.
Assumption: Succ is the single successor for BB.
Definition at line 840 of file Local.cpp.
References assert(), BB, llvm::BasicBlock::begin(), CanMergeValues(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::dbgs(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::PHINode::getIncomingValueForBlock(), llvm::Value::getName(), llvm::PHINode::getNumIncomingValues(), llvm::Instruction::getParent(), llvm::BasicBlock::getSinglePredecessor(), I, LLVM_DEBUG, llvm::pred_begin(), llvm::pred_end(), and llvm::succ_begin().
Referenced by llvm::TryToSimplifyUncondBranchFromEmptyBlock().
|
static |
Analyze the specified subexpression and see if it is capable of providing pieces of a bswap or bitreverse.
The subexpression provides a potential piece of a bswap or bitreverse if it can be proved that each non-zero bit in the output of the expression came from a corresponding bit in some other value. This function is recursive, and the end result is a mapping of bitnumber to bitnumber. It is the caller's responsibility to validate that the bitnumber to bitnumber mapping is correct for a bswap or bitreverse.
For example, if the current subexpression if "(shl i32 %X, 24)" then we know that the expression deposits the low byte of X into the high byte of the result and that all other bits are zero. This expression is accepted and a BitPart is returned with Provider set to X and Provenance[24-31] set to [0-7].
For vector types, all analysis is performed at the per-element level. No cross-element analysis is supported (shuffle/insertion/reduction), and all constant masks must be splatted across all elements.
To avoid revisiting values, the BitPart results are memoized into the provided map. To avoid unnecessary copying of BitParts, BitParts are constructed in-place in the BPS
map. Because of this BPS
needs to store BitParts objects, not pointers. As we need the concept of a nullptr BitParts (Value has been analyzed and the analysis failed), we an Optional type instead to provide the same functionality.
Because we pass around references into BPS
, we must use a container that does not invalidate internal references (std::map instead of DenseMap).
Definition at line 2920 of file Local.cpp.
References B, BitPartRecursionMaxDepth, llvm::BitWidth, llvm::APInt::countPopulation(), llvm::dbgs(), llvm::Depth, for, getIntrinsicID(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::APInt::getZExtValue(), I, LHS, LLVM_DEBUG, llvm::PatternMatch::m_And(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_BitReverse(), llvm::PatternMatch::m_BSwap(), llvm::PatternMatch::m_FShl(), llvm::PatternMatch::m_FShr(), llvm::PatternMatch::m_LogicalShift(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_Trunc(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_ZExt(), llvm::PatternMatch::match(), llvm::None, P, RHS, llvm::APInt::uge(), X, and Y.
Referenced by llvm::recognizeBSwapOrBitReverseIdiom().
|
static |
Definition at line 1183 of file Local.cpp.
References BB, llvm::Instruction::eraseFromParent(), I, llvm::Instruction::isIdenticalToWhenDefined(), and llvm::Value::replaceAllUsesWith().
Referenced by llvm::EliminateDuplicatePHINodes().
|
static |
Definition at line 1215 of file Local.cpp.
References assert(), BB, llvm::PHINode::block_begin(), llvm::PHINode::block_end(), llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::clear(), getHashValueImpl(), llvm::hash_combine(), llvm::hash_combine_range(), I, llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::insert(), llvm::isEqual(), isEqualImpl(), isSentinel(), LHS, PHICSEDebugHash, PHICSENumPHISmallSize, llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::reserve(), RHS, llvm::User::value_op_begin(), and llvm::User::value_op_end().
Referenced by llvm::EliminateDuplicatePHINodes().
|
static |
Create a map from block to value for the operands of a given phi.
Create a map from block to value for each non-undef value flowing into PN
.
PN | The phi we are collecting the map for. |
IncomingValues | [out] The map from block to value for this phi. |
Definition at line 937 of file Local.cpp.
References BB, llvm::numbers::e, llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::PHINode::getNumIncomingValues(), i, and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert().
Referenced by redirectValuesFromPredecessorsToPhi().
|
static |
Produce a DebugLoc to use for each dbg.declare/inst pair that are promoted to a dbg.value.
Because no machine insts can come from debug intrinsics, only the scope and inlinedAt is significant. Zero line numbers are used in case this DebugLoc leaks into any adjacent instructions.
Definition at line 1441 of file Local.cpp.
References llvm::MDNode::get(), llvm::Value::getContext(), llvm::Instruction::getDebugLoc(), llvm::DebugLoc::getInlinedAt(), and llvm::DebugLoc::getScope().
Referenced by llvm::ConvertDebugDeclareToDebugValue(), and llvm::LowerDbgDeclare().
uint64_t getDwarfOpForBinOp | ( | Instruction::BinaryOps | Opcode | ) |
Definition at line 1842 of file Local.cpp.
References llvm::MCID::Add, and Mul.
Referenced by getSalvageOpsForBinOp().
Value* getSalvageOpsForBinOp | ( | BinaryOperator * | BI, |
uint64_t | CurrentLocOps, | ||
SmallVectorImpl< uint64_t > & | Opcodes, | ||
SmallVectorImpl< Value * > & | AdditionalValues | ||
) |
Definition at line 1872 of file Local.cpp.
References llvm::MCID::Add, llvm::SmallVectorImpl< T >::append(), llvm::DIExpression::appendOffset(), llvm::dwarf::DW_OP_LLVM_arg, getDwarfOpForBinOp(), llvm::BinaryOperator::getOpcode(), and llvm::User::getOperand().
Referenced by llvm::salvageDebugInfoImpl().
Value* getSalvageOpsForGEP | ( | GetElementPtrInst * | GEP, |
const DataLayout & | DL, | ||
uint64_t | CurrentLocOps, | ||
SmallVectorImpl< uint64_t > & | Opcodes, | ||
SmallVectorImpl< Value * > & | AdditionalValues | ||
) |
Definition at line 1816 of file Local.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::DIExpression::appendOffset(), assert(), llvm::BitWidth, DL, llvm::dwarf::DW_OP_LLVM_arg, llvm::MapVector< KeyT, ValueT, MapType, VectorType >::empty(), GEP, llvm::APInt::getSExtValue(), and llvm::SmallVectorImpl< T >::insert().
Referenced by llvm::salvageDebugInfoImpl().
|
static |
Determine whether this alloca is either a VLA or an array.
Definition at line 1539 of file Local.cpp.
References llvm::AllocaInst::getAllocatedType(), llvm::AllocaInst::isArrayAllocation(), and llvm::Type::isArrayTy().
Referenced by llvm::LowerDbgDeclare().
|
static |
Check if a bitcast between a value of type FromTy
to type ToTy
would losslessly preserve the bits and semantics of the value.
This predicate is symmetric, i.e swapping FromTy
and ToTy
should give the same result.
Note that Type::canLosslesslyBitCastTo is not suitable here because it allows semantically unequivalent bitcasts, such as <2 x i64> -> <4 x i32>, and also does not allow lossless pointer <-> integer conversions.
Definition at line 2025 of file Local.cpp.
References DL, and llvm::Type::isIntOrPtrTy().
Referenced by llvm::replaceAllDbgUsesWith().
|
static |
Determine whether this alloca is a structure.
Definition at line 1545 of file Local.cpp.
References llvm::AllocaInst::getAllocatedType(), and llvm::Type::isStructTy().
Referenced by llvm::LowerDbgDeclare().
|
static |
Definition at line 2250 of file Local.cpp.
References BB, Callee, llvm::canSimplifyInvokeNoUnwind(), llvm::changeToCall(), llvm::changeToUnreachable(), llvm::ConstantFoldTerminator(), llvm::BasicBlock::Create(), llvm::BranchInst::Create(), llvm::DominatorTreeBase< BasicBlock, false >::Delete, E, F, llvm::BasicBlock::getFirstNonPHI(), llvm::Value::getName(), llvm::hash_combine_range(), I, llvm::DominatorTreeBase< BasicBlock, false >::Insert, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::isEqual(), LHS, llvm::PatternMatch::m_CombineOr(), llvm::PatternMatch::m_Undef(), llvm::PatternMatch::m_Zero(), llvm::PatternMatch::match(), llvm::NullPointerIsDefined(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::BasicBlock::removePredecessor(), RHS, SI, llvm::Successor, llvm::successors(), llvm::MCID::Terminator, llvm::User::value_op_begin(), and llvm::User::value_op_end().
Referenced by llvm::removeUnreachableBlocks().
|
static |
===------------------------------------------------------------------—===// Dbg Intrinsic utilities
See if there is a dbg.value intrinsic for DIVar for the PHI node.
Definition at line 1386 of file Local.cpp.
References assert(), llvm::findDbgValues(), and llvm::is_contained().
Referenced by llvm::ConvertDebugDeclareToDebugValue().
|
static |
Replace a value flowing from a block to a phi with potentially multiple instances of that value flowing from the block's predecessors to the phi.
BB | The block with the value flowing into the phi. |
BBPreds | The predecessors of BB. |
PN | The phi that we are updating. |
Definition at line 997 of file Local.cpp.
References llvm::PHINode::addIncoming(), assert(), BB, llvm::numbers::e, gatherIncomingValuesToPhi(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::PHINode::getNumIncomingValues(), getParent(), i, llvm::PHINode::removeIncomingValue(), replaceUndefValuesInPhi(), and selectIncomingValueForBlock().
Referenced by llvm::TryToSimplifyUncondBranchFromEmptyBlock().
|
static |
Definition at line 2700 of file Local.cpp.
References assert(), llvm::dbgs(), From, llvm::Value::getType(), LLVM_DEBUG, and llvm::make_early_inc_range().
Referenced by llvm::replaceDominatedUsesWith().
|
static |
Definition at line 1705 of file Local.cpp.
References assert(), Builder, llvm::Instruction::eraseFromParent(), llvm::Instruction::getDebugLoc(), llvm::DbgVariableIntrinsic::getExpression(), llvm::DbgVariableIntrinsic::getVariable(), and llvm::DIExpression::prepend().
Referenced by llvm::replaceDbgValueForAlloca().
|
static |
Replace the incoming undef values to a phi with the values from a block-to-value map.
PN | The phi we are replacing the undefs in. |
IncomingValues | A map from block to value. |
Definition at line 953 of file Local.cpp.
References BB, llvm::count_if(), llvm::numbers::e, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::UndefValue::get(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::PHINode::getNumIncomingValues(), llvm::Value::getType(), i, and llvm::PHINode::setIncomingValue().
Referenced by redirectValuesFromPredecessorsToPhi().
|
static |
Point debug users of From
to To
using exprs given by RewriteExpr
, possibly moving/undefing users to prevent use-before-def.
Returns true if changes are made.
Definition at line 1963 of file Local.cpp.
References llvm::SmallPtrSetImpl< PtrType >::count(), llvm::dbgs(), llvm::DominatorTree::dominates(), llvm::SmallPtrSetImplBase::empty(), llvm::findDbgUsers(), From, llvm::Instruction::getNextNonDebugInstruction(), llvm::SmallPtrSetImpl< PtrType >::insert(), LLVM_DEBUG, llvm::Instruction::moveAfter(), llvm::DbgVariableIntrinsic::replaceVariableLocationOp(), llvm::salvageDebugInfo(), llvm::DbgVariableIntrinsic::setExpression(), and Users.
Referenced by llvm::replaceAllDbgUsesWith().
|
static |
Determines the value to use as the phi node input for a block.
Select between OldVal
any value that we know flows from BB
to a particular phi on the basis of which one (if either) is not undef. Update IncomingValues based on the selected value.
OldVal | The value we are considering selecting. |
BB | The block that the value flows in from. |
IncomingValues | A map from block-to-value for other phi inputs that we have examined. |
Definition at line 912 of file Local.cpp.
References assert(), BB, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert().
Referenced by redirectValuesFromPredecessorsToPhi().
|
static |
Definition at line 649 of file Local.cpp.
References DL, llvm::numbers::e, i, I, llvm::SetVector< T, SmallVector< T, N >, SmallDenseSet< T, N > >::insert(), llvm::isInstructionTriviallyDead(), llvm::salvageDebugInfo(), llvm::SimplifyInstruction(), and llvm::Value::use_empty().
Referenced by llvm::SimplifyInstructionsInBlock().
|
static |
If the specified pointer points to an object that we control, try to modify the object's alignment to PrefAlign.
Returns a minimum known alignment of the value after the operation, which may be lower than PrefAlign.
Increating value alignment isn't often possible though. If alignment is important, a more reliable approach is to simply align all global variables and allocation instructions to their preferred alignment from the beginning.
Definition at line 1314 of file Local.cpp.
References Align, DL, and llvm::Value::stripPointerCasts().
Referenced by llvm::getOrEnforceKnownAlignment().
|
static |
Check if the alloc size of ValTy
is large enough to cover the variable (or fragment of the variable) described by DII
.
This is primarily intended as a helper for the different ConvertDebugDeclareToDebugValue functions. The dbg.declare/dbg.addr that is converted describes an alloca'd variable, so we need to use the alloc size of the value when doing the comparison. E.g. an i1 value will be identified as covering an n-bit fragment, if the store size of i1 is at least n bits.
Definition at line 1411 of file Local.cpp.
References assert(), DL, llvm::Module::getDataLayout(), llvm::TypeSize::getFixedSize(), llvm::DbgVariableIntrinsic::getFragmentSizeInBits(), llvm::Instruction::getModule(), llvm::DbgVariableIntrinsic::getNumVariableLocationOps(), llvm::DbgVariableIntrinsic::getVariableLocationOp(), llvm::DbgVariableIntrinsic::isAddressOfVariable(), llvm::LinearPolySize< TypeSize >::isKnownGE(), and llvm::LinearPolySize< LeafTy >::isScalable().
Referenced by llvm::ConvertDebugDeclareToDebugValue().
|
static |
Definition at line 112 of file Local.cpp.
Referenced by collectBitParts().
|
static |
Referenced by llvm::EliminateDuplicatePHINodes(), and EliminateDuplicatePHINodesSetBasedImpl().
|
static |
Referenced by llvm::EliminateDuplicatePHINodes(), and EliminateDuplicatePHINodesSetBasedImpl().