llvm::CastInst::isNoopCast

Return true if a cast changes no bits.

Synopsis

Declared in <llvm/IR/InstrTypes.h>

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

Description

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.

Return Value

True if the cast changes no bits.

Parameters

NameDescription
OpcodeThe cast opcode.
SrcTyThe source type.
DstTyThe destination type.
DLThe data layout used to size pointer types.