diff --git a/src/cgutils.cpp b/src/cgutils.cpp index 6e1fb68a08a3a..6c1f7c9645a78 100644 --- a/src/cgutils.cpp +++ b/src/cgutils.cpp @@ -3053,6 +3053,7 @@ static Value *emit_genericmemoryptr(jl_codectx_t &ctx, Value *mem, const jl_data PointerType *PT = cast(mem->getType()); assert(PT == ctx.types().T_prjlvalue); Value *addr = emit_bitcast(ctx, mem, ctx.types().T_jlgenericmemory->getPointerTo(PT->getAddressSpace())); + addr = decay_derived(ctx, addr); addr = ctx.builder.CreateStructGEP(ctx.types().T_jlgenericmemory, addr, 1); setName(ctx.emission_context, addr, ".data_ptr"); PointerType *PPT = cast(ctx.types().T_jlgenericmemory->getElementType(1)); diff --git a/src/clangsa/GCChecker.cpp b/src/clangsa/GCChecker.cpp index 60471f1909f02..9caff014c7703 100644 --- a/src/clangsa/GCChecker.cpp +++ b/src/clangsa/GCChecker.cpp @@ -795,57 +795,54 @@ static bool isMutexUnlock(StringRef name) { false; } -#if LLVM_VERSION_MAJOR >= 13 -#define endswith_lower endswith_insensitive -#endif bool GCChecker::isGCTrackedType(QualType QT) { return isJuliaType( [](StringRef Name) { - if (Name.endswith_lower("jl_value_t") || - Name.endswith_lower("jl_svec_t") || - Name.endswith_lower("jl_sym_t") || - Name.endswith_lower("jl_expr_t") || - Name.endswith_lower("jl_code_info_t") || - Name.endswith_lower("jl_array_t") || - Name.endswith_lower("jl_genericmemory_t") || - //Name.endswith_lower("jl_genericmemoryref_t") || - Name.endswith_lower("jl_method_t") || - Name.endswith_lower("jl_method_instance_t") || - Name.endswith_lower("jl_debuginfo_t") || - Name.endswith_lower("jl_tupletype_t") || - Name.endswith_lower("jl_datatype_t") || - Name.endswith_lower("jl_typemap_entry_t") || - Name.endswith_lower("jl_typemap_level_t") || - Name.endswith_lower("jl_typename_t") || - Name.endswith_lower("jl_module_t") || - Name.endswith_lower("jl_tupletype_t") || - Name.endswith_lower("jl_gc_tracked_buffer_t") || - Name.endswith_lower("jl_binding_t") || - Name.endswith_lower("jl_ordereddict_t") || - Name.endswith_lower("jl_tvar_t") || - Name.endswith_lower("jl_typemap_t") || - Name.endswith_lower("jl_unionall_t") || - Name.endswith_lower("jl_methtable_t") || - Name.endswith_lower("jl_cgval_t") || - Name.endswith_lower("jl_codectx_t") || - Name.endswith_lower("jl_ast_context_t") || - Name.endswith_lower("jl_code_instance_t") || - Name.endswith_lower("jl_excstack_t") || - Name.endswith_lower("jl_task_t") || - Name.endswith_lower("jl_uniontype_t") || - Name.endswith_lower("jl_method_match_t") || - Name.endswith_lower("jl_vararg_t") || - Name.endswith_lower("jl_opaque_closure_t") || - Name.endswith_lower("jl_globalref_t") || + if (Name.ends_with_insensitive("jl_value_t") || + Name.ends_with_insensitive("jl_svec_t") || + Name.ends_with_insensitive("jl_sym_t") || + Name.ends_with_insensitive("jl_expr_t") || + Name.ends_with_insensitive("jl_code_info_t") || + Name.ends_with_insensitive("jl_array_t") || + Name.ends_with_insensitive("jl_genericmemory_t") || + //Name.ends_with_insensitive("jl_genericmemoryref_t") || + Name.ends_with_insensitive("jl_method_t") || + Name.ends_with_insensitive("jl_method_instance_t") || + Name.ends_with_insensitive("jl_debuginfo_t") || + Name.ends_with_insensitive("jl_tupletype_t") || + Name.ends_with_insensitive("jl_datatype_t") || + Name.ends_with_insensitive("jl_typemap_entry_t") || + Name.ends_with_insensitive("jl_typemap_level_t") || + Name.ends_with_insensitive("jl_typename_t") || + Name.ends_with_insensitive("jl_module_t") || + Name.ends_with_insensitive("jl_tupletype_t") || + Name.ends_with_insensitive("jl_gc_tracked_buffer_t") || + Name.ends_with_insensitive("jl_binding_t") || + Name.ends_with_insensitive("jl_ordereddict_t") || + Name.ends_with_insensitive("jl_tvar_t") || + Name.ends_with_insensitive("jl_typemap_t") || + Name.ends_with_insensitive("jl_unionall_t") || + Name.ends_with_insensitive("jl_methtable_t") || + Name.ends_with_insensitive("jl_cgval_t") || + Name.ends_with_insensitive("jl_codectx_t") || + Name.ends_with_insensitive("jl_ast_context_t") || + Name.ends_with_insensitive("jl_code_instance_t") || + Name.ends_with_insensitive("jl_excstack_t") || + Name.ends_with_insensitive("jl_task_t") || + Name.ends_with_insensitive("jl_uniontype_t") || + Name.ends_with_insensitive("jl_method_match_t") || + Name.ends_with_insensitive("jl_vararg_t") || + Name.ends_with_insensitive("jl_opaque_closure_t") || + Name.ends_with_insensitive("jl_globalref_t") || // Probably not technically true for these, but let's allow it - Name.endswith_lower("typemap_intersection_env") || - Name.endswith_lower("interpreter_state") || - Name.endswith_lower("jl_typeenv_t") || - Name.endswith_lower("jl_stenv_t") || - Name.endswith_lower("jl_varbinding_t") || - Name.endswith_lower("set_world") || - Name.endswith_lower("jl_codectx_t")) { + Name.ends_with_insensitive("typemap_intersection_env") || + Name.ends_with_insensitive("interpreter_state") || + Name.ends_with_insensitive("jl_typeenv_t") || + Name.ends_with_insensitive("jl_stenv_t") || + Name.ends_with_insensitive("jl_varbinding_t") || + Name.ends_with_insensitive("set_world") || + Name.ends_with_insensitive("jl_codectx_t")) { return true; } return false; diff --git a/src/passes.h b/src/passes.h index 9c3b0421670b5..6557a5813063d 100644 --- a/src/passes.h +++ b/src/passes.h @@ -64,7 +64,7 @@ struct RemoveNIPass : PassInfoMixin { struct MultiVersioningPass : PassInfoMixin { bool external_use; - MultiVersioningPass(bool external_use = false) : external_use(external_use) {} + MultiVersioningPass(bool external_use = false) JL_NOTSAFEPOINT : external_use(external_use) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM) JL_NOTSAFEPOINT; static bool isRequired() { return true; } }; diff --git a/src/pipeline.cpp b/src/pipeline.cpp index efefa1bf3c7f6..7704336045ad9 100644 --- a/src/pipeline.cpp +++ b/src/pipeline.cpp @@ -189,10 +189,11 @@ namespace { // } } -#ifdef JL_DEBUG_BUILD +#ifdef JL_VERIFY_PASSES static inline void addVerificationPasses(ModulePassManager &MPM, bool llvm_only) JL_NOTSAFEPOINT { - if (!llvm_only) - MPM.addPass(llvm::createModuleToFunctionPassAdaptor(GCInvariantVerifierPass())); + if (!llvm_only){ + MPM.addPass(llvm::createModuleToFunctionPassAdaptor(GCInvariantVerifierPass(true))); + } MPM.addPass(VerifierPass()); } #endif @@ -332,7 +333,7 @@ namespace { static void buildEarlySimplificationPipeline(ModulePassManager &MPM, PassBuilder *PB, OptimizationLevel O, const OptimizationOptions &options) JL_NOTSAFEPOINT { MPM.addPass(BeforeEarlySimplificationMarkerPass()); -#ifdef JL_DEBUG_BUILD +#ifdef JL_VERIFY_PASSES addVerificationPasses(MPM, options.llvm_only); #endif if (options.enable_early_simplifications) {