I want to see the impact of each optimization pass on the performance of the programs compiled by Clang. So I chose CoreMark as the test program. The compilation rules in Makefile are modified as follows:
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -emit-llvm $(CFLAGS) -c $< -o $@.bc
opt $@.bc -sroa -o $@1.bc
llc -march=riscv32 -filetype=obj $@1.bc -o $@
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
$(SZ) $@
Although it can be successfully compiled into an executable program, the program cannot run correctly.Can you tell me whether the problem is that the Makefile is not written correctly or that pass cannot be used alone?