[all-commits] [llvm/llvm-project] d87b9b: Allow invokable sub-classes of IntrinsicInst

Philip Reames via All-commits all-commits at lists.llvm.org
Tue Apr 20 15:06:14 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d87b9b81ccb95217181ce75515c6c68bbb408ca4
      https://github.com/llvm/llvm-project/commit/d87b9b81ccb95217181ce75515c6c68bbb408ca4
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-04-20 (Tue, 20 Apr 2021)

  Changed paths:
    M llvm/include/llvm/IR/InstVisitor.h
    M llvm/include/llvm/IR/IntrinsicInst.h
    M llvm/lib/Analysis/TypeMetadataUtils.cpp
    M llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
    M llvm/lib/CodeGen/ShadowStackGCLowering.cpp
    M llvm/lib/CodeGen/StackProtector.cpp
    M llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
    M llvm/lib/Target/AArch64/AArch64FastISel.cpp
    M llvm/lib/Target/Mips/MipsFastISel.cpp
    M llvm/lib/Target/X86/X86FastISel.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
    M llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp

  Log Message:
  -----------
  Allow invokable sub-classes of IntrinsicInst

It used to be that all of our intrinsics were call instructions, but over time, we've added more and more invokable intrinsics. According to the verifier, we're up to 8 right now. As IntrinsicInst is a sub-class of CallInst, this puts us in an awkward spot where the idiomatic means to check for intrinsic has a false negative if the intrinsic is invoked.

This change switches IntrinsicInst from being a sub-class of CallInst to being a subclass of CallBase. This allows invoked intrinsics to be instances of IntrinsicInst, at the cost of requiring a few more casts to CallInst in places where the intrinsic really is known to be a call, not an invoke.

After this lands and has baked for a couple days, planned cleanups:
    Make GCStatepointInst a IntrinsicInst subclass.
    Merge intrinsic handling in InstCombine and use idiomatic visitIntrinsicInst entry point for InstVisitor.
    Do the same in SelectionDAG.
    Do the same in FastISEL.

Differential Revision: https://reviews.llvm.org/D99976




More information about the All-commits mailing list