LLVM 22.0.0git
ConstantFolding.cpp File Reference
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/TargetFolder.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/Config/config.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/ConstantFold.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.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/IntrinsicsAArch64.h"
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include "llvm/IR/IntrinsicsARM.h"
#include "llvm/IR/IntrinsicsNVPTX.h"
#include "llvm/IR/IntrinsicsWebAssembly.h"
#include "llvm/IR/IntrinsicsX86.h"
#include "llvm/IR/NVVMIntrinsicUtils.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
#include <cerrno>
#include <cfenv>
#include <cmath>
#include <cstdint>

Go to the source code of this file.

Functions

ConstantgetConstantAtOffset (Constant *Base, APInt Offset, const DataLayout &DL)
 If this Offset points exactly to the start of an aggregate element, return that element, otherwise return nullptr.
static ConstantFPflushDenormalConstant (Type *Ty, const APFloat &APF, DenormalMode::DenormalModeKind Mode)
static DenormalMode getInstrDenormalMode (const Instruction *CtxI, Type *Ty)
 Return the denormal mode that can be assumed when executing a floating point operation at CtxI.
static ConstantFPflushDenormalConstantFP (ConstantFP *CFP, const Instruction *Inst, bool IsOutput)

Variables

static cl::opt< boolDisableFPCallFolding ("disable-fp-call-folding", cl::desc("Disable constant-folding of FP intrinsics and libcalls."), cl::init(false), cl::Hidden)

Function Documentation

◆ flushDenormalConstant()

◆ flushDenormalConstantFP()

◆ getConstantAtOffset()

Constant * getConstantAtOffset ( Constant * Base,
APInt Offset,
const DataLayout & DL )

If this Offset points exactly to the start of an aggregate element, return that element, otherwise return nullptr.

Definition at line 687 of file ConstantFolding.cpp.

References llvm::sampleprof::Base, llvm::CallingConv::C, DL, llvm::drop_begin(), llvm::isa(), and llvm::Offset.

Referenced by llvm::ConstantFoldLoadFromConst().

◆ getInstrDenormalMode()

DenormalMode getInstrDenormalMode ( const Instruction * CtxI,
Type * Ty )
static

Return the denormal mode that can be assumed when executing a floating point operation at CtxI.

Definition at line 1353 of file ConstantFolding.cpp.

References llvm::Function::getDenormalMode(), llvm::DenormalMode::getDynamic(), llvm::Instruction::getFunction(), and llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent().

Referenced by flushDenormalConstantFP(), and llvm::FlushFPConstant().

Variable Documentation

◆ DisableFPCallFolding

cl::opt< bool > DisableFPCallFolding("disable-fp-call-folding", cl::desc("Disable constant-folding of FP intrinsics and libcalls."), cl::init(false), cl::Hidden) ( "disable-fp-call-folding" ,
cl::desc("Disable constant-folding of FP intrinsics and libcalls.") ,
cl::init(false) ,
cl::Hidden  )
static