Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add a clarifying a comment on CastInst::isNoopCast
I made exactly the mistake described, so document the precondition.  It would be better to have an assert, but there is (currently) no "castIsValid" with purely type arguments.
  • Loading branch information
preames committed Oct 7, 2020
1 parent 0328005 commit 42ffba0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llvm/include/llvm/IR/InstrTypes.h
Expand Up @@ -650,8 +650,8 @@ class CastInst : public UnaryInstruction {
/// 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.
/// Determine if the described cast is a no-op cast.
/// platform. Note that a precondition of this method is that the cast is
/// legal - i.e. the instruction formed with these operands would verify.
static bool isNoopCast(
Instruction::CastOps Opcode, ///< Opcode of cast
Type *SrcTy, ///< SrcTy of cast
Expand Down

0 comments on commit 42ffba0

Please sign in to comment.