llvm::CastInst::isNoopCast

A no-op cast is one that can be effected without changing any bits. It implies that the source and destination types are the same size. The DataLayout argument is to determine the pointer size when examining casts involving Integer and Pointer types. They are no-op casts if the integer is the same size as the pointer. However, pointer size varies with platform. Note that a precondition of this method is that the cast is legal - i.e. the instruction formed with these operands would verify.

Synopsis

Declared in <llvm/IR/InstrTypes.h>

static
bool
isNoopCast(
    Instruction::CastOps Opcode,
    Type* SrcTy,
    Type* DstTy,
    DataLayout const& DL);

Parameters

NameDescription
SrcTyThe instances of the Type class are immutable: once they are created, they are never changed. Also note that only one instance of a particular type is ever created. Thus seeing if two types are equal is a matter of doing a trivial pointer comparison. To enforce that no two equal instances are created, Type instances can only be created via static factory methods in class Type and in derived classes. Once allocated, Types are never free'd.
DstTyThe instances of the Type class are immutable: once they are created, they are never changed. Also note that only one instance of a particular type is ever created. Thus seeing if two types are equal is a matter of doing a trivial pointer comparison. To enforce that no two equal instances are created, Type instances can only be created via static factory methods in class Type and in derived classes. Once allocated, Types are never free'd.
DLA parsed version of the target data layout string in and methods for querying it.