[Please keep pkg-clamav-devel at lists.alioth.debian.org in CC.] Hi, I nearly finished adapting clamav to LLVM 3.6, just one problem remains: The Sparse Conditional Constant Propagation optimization doesn't work anymore. I have created a small example program demonstrating the problem (attached). It works fine with LLVM 3.5: $ make $ ./test LLVM module: --------- ; ModuleID = 'test' target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" define i32 @test() { EntryBlock: ret i32 1 } --------- verifying... starting test() with JIT... Result: 1 But it fails with LLVM 3.6: $ make LLVM=3.6 $ ./test Pass 'Sparse Conditional Constant Propagation' is not initialized. Verify if there is a pass dependency cycle. Required Passes: Segmentation fault (core dumped) It's a rather strange error message, because there can't be a dependency cycle, if there are no required passes. The reason for the behavior change is that in LLVM 3.6 the JIT compiler got removed so that the MCJIT one is now used by default. Using the MCJIT compiler in LLVM 3.5 also shows the problem: $ make MCJIT=1 $ ./test Pass 'Sparse Conditional Constant Propagation' is not initialized. Verify if there is a pass dependency cycle. Required Passes: Segmentation fault (core dumped) Disabling the SCCP pass avoids this segfault, but then the optimizations are missing (obviously): $ make SCCP=0 LLVM=3.6 $ ./test LLVM module: --------- ; ModuleID = 'test' target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" define i32 @test() { EntryBlock: %cond = icmp sle i32 1, 2 br i1 %cond, label %return, label %test return: ; preds = %test, %EntryBlock ret i32 1 test: ; preds = %EntryBlock, %test %arg = add i32 1, 2 %cond2 = icmp sle i32 1, %arg br i1 %cond2, label %return, label %test } --------- verifying... starting test() with JIT... Result: 1 Thus I'm wondering if there is a way to make the SCCP pass work with MCJIT or is this a bug in LLVM? Best regards, Andreas -------------- next part -------------- A non-text attachment was scrubbed... Name: test.cpp Type: text/x-c++src Size: 2955 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150216/8107d96a/attachment.cpp> -------------- next part -------------- LLVM := 3.5 MCJIT := 0 SCCP := 1 LLVM_VERSION=$(shell echo $(LLVM) | sed 's/\.//') CXXFLAGS := -Wall -g -std=c++11 -I/usr/include/llvm-$(LLVM)/ -I/usr/include/llvm-c-$(LLVM) -DLLVM_VERSION=$(LLVM_VERSION) -DUSE_MCJIT=$(MCJIT) -DUSE_SCCP=$(SCCP) -DNDEBUG LDLIBS := -lLLVM-$(LLVM) -lstdc++ $(LDLIBS) LDFLAGS := -L/usr/lib/llvm-$(LLVM)/lib EXAMPLES=test OBJS=$(addsuffix .o,$(EXAMPLES)) .phony: all clean all: $(OBJS) $(EXAMPLES) clean: $(RM) $(EXAMPLES) $(OBJS)