Description
Type *I32Ty = Type::getInt32Ty(M.getContext()); if (I32Ty->isIntegerTy()) { errs() << "xxx : I32Ty isIntegerTy\n"; } else if (I32Ty->isFunctionTy()) { errs() << "xxx : I32Ty isFunctionTy\n"; } else { errs() << "xxx : I32Ty isUnknown\n"; }
this code for I32Ty is FunctionTy, I32Ty should be isIntegerTy!!!
Reproduction steps as follows:
you can search llvm src LLVMPasses PassBuilderPipeLines.cpp, in this file has a lot of internel pass, you can find any one for module pass.
for example: Annotation2MetadataPass
PreservedAnalyses Annotation2MetadataPass::run(Module &M, ModuleAnalysisManager &AM) { Type *I32Ty = Type::getInt32Ty(M.getContext()); if (I32Ty->isIntegerTy()) { errs() << "xxx : I32Ty isIntegerTy\n"; } else if (I32Ty->isFunctionTy()) { errs() << "xxx : I32Ty isFunctionTy\n"; } else { errs() << "xxx : I32Ty isUnknown\n"; } convertAnnotation2Metadata(M); return PreservedAnalyses::all(); }