Skip to content

Commit 8583b1f

Browse files
committed
Run LLVM verify pass on IR in assert builds.
The problem fixed by commit 53c8d6c would have been noticed if we'd been running LLVM's verify pass on generated IR. Doing so also reveals a complaint about incorrect name mangling, fixed here. Only enabled for LLVM 17+ because it uses the new pass manager API. Suggested-by: Dmitry Dolgov <9erthalion6@gmail.com> Discussion: https://postgr.es/m/CAFj8pRACpVFr7LMdVYENUkScG5FCYMZDDdSGNU-tch%2Bw98OxYg%40mail.gmail.com
1 parent 9165134 commit 8583b1f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/backend/jit/llvm/llvmjit.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,11 @@ llvm_optimize_module(LLVMJitContext *context, LLVMModuleRef module)
714714
LLVMPassBuilderOptionsSetDebugLogging(options, 1);
715715
#endif
716716

717+
/* In assertion builds, run the LLVM verify pass. */
718+
#ifdef USE_ASSERT_CHECKING
719+
LLVMPassBuilderOptionsSetVerifyEach(options, true);
720+
#endif
721+
717722
LLVMPassBuilderOptionsSetInlinerThreshold(options, 512);
718723

719724
err = LLVMRunPasses(module, passes, NULL, options);

src/backend/jit/llvm/llvmjit_expr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2765,7 +2765,7 @@ create_LifetimeEnd(LLVMModuleRef mod)
27652765
LLVMContextRef lc;
27662766

27672767
/* variadic pointer argument */
2768-
const char *nm = "llvm.lifetime.end.p0i8";
2768+
const char *nm = "llvm.lifetime.end.p0";
27692769

27702770
fn = LLVMGetNamedFunction(mod, nm);
27712771
if (fn)

0 commit comments

Comments
 (0)