mchalupa / dg

[LLVM Static Slicer] Various program analyses, construction of dependence graphs and program slicing of LLVM bitcode.
MIT License
474 stars 131 forks source link

How to slice the following c++ file? #430

Open TimHe95 opened 2 years ago

TimHe95 commented 2 years ago

Source file of MySQL

First, get .bc file (os0file.bc) with the command used when compiling MySQL:

clang++-9  -DCOMPILER_HINTS -DHAVE_CONFIG_H -DHAVE_FALLOC_FL_ZERO_RANGE=1 -DHAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE=1 -DHAVE_IB_ATOMIC_PTHREAD_T_GCC=1 -DHAVE_IB_GCC_ATOMIC_COMPARE_EXCHANGE=1 -DHAVE_IB_GCC_ATOMIC_THREAD_FENCE=1 -DHAVE_IB_GCC_SYNC_SYNCHRONISE=1 -DHAVE_IB_LINUX_FUTEX=1 -DHAVE_NANOSLEEP=1 -DHAVE_SCHED_GETCPU=1 -DHAVE_TLSv13 -DLINUX_NATIVE_AIO=1 -DLOG_SUBSYSTEM_TAG=\"InnoDB\" -DLZ4_DISABLE_DEPRECATE_WARNINGS -DMUTEX_EVENT -DMYSQL_SERVER -DRAPIDJSON_NO_SIZETYPEDEFINE -DRAPIDJSON_SCHEMA_USE_INTERNALREGEX=0 -DRAPIDJSON_SCHEMA_USE_STDREGEX=1 -DUNIV_LINUX -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_USE_MATH_DEFINES -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -isystem /home/timhe/Downloads/mysql-server-mysql-8.0.22/extra/rapidjson/include -isystem /home/timhe/Downloads/mysql-server-mysql-8.0.22/extra/lz4 -isystem /home/timhe/Downloads/mysql-server-mysql-8.0.22/extra/libedit/libedit-20190324-3.1/src/editline -isystem /home/timhe/Downloads/mysql-server-mysql-8.0.22/extra/zstd/lib -isystem /home/timhe/Downloads/mysql-server-mysql-8.0.22/build/extra/zlib -isystem /home/timhe/Downloads/mysql-server-mysql-8.0.22/extra/zlib -I/home/timhe/Downloads/mysql-server-mysql-8.0.22/build -I/home/timhe/Downloads/mysql-server-mysql-8.0.22/build/include -I/home/timhe/Downloads/mysql-server-mysql-8.0.22 -I/home/timhe/Downloads/mysql-server-mysql-8.0.22/include -I/home/timhe/Downloads/mysql-server-mysql-8.0.22/storage/innobase -I/home/timhe/Downloads/mysql-server-mysql-8.0.22/storage/innobase/include -I/home/timhe/Downloads/mysql-server-mysql-8.0.22/storage/innobase/handler -I/home/timhe/Downloads/mysql-server-mysql-8.0.22/sql -I/home/timhe/Downloads/mysql-server-mysql-8.0.22/sql/auth -I/home/timhe/Downloads/mysql-server-mysql-8.0.22/extra/protobuf/protobuf-3.11.4/src  -std=c++14 -fno-omit-frame-pointer -ftls-model=initial-exec  -Wall -Wextra -Wformat-security -Wvla -Wundef -Wmissing-format-attribute -Woverloaded-virtual -Wcast-qual -Wno-null-conversion -Wno-unused-private-field -Wconditional-uninitialized -Wdeprecated -Wextra-semi -Wheader-hygiene -Wnon-virtual-dtor -Wundefined-reinterpret-cast -Winconsistent-missing-destructor-override -Winconsistent-missing-override -Wshadow-field -Wno-unused-parameter -Wno-cast-qual -DDBUG_OFF -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -fno-discard-value-names -emit-llvm -o os0file.bc -c os0file.cc

Then, llvm-slice (also compiled with clang-9) the file with:

llvm-slicer -cutoff-diverging=false -sc 'fsync' -entry=_Z18os_file_flush_funci os/os0file.bc

Got the following errors:

  %lpad.val.i = insertvalue { i8*, i32 } undef, i8* %exn.slot.0.i, 0, !dbg !7542
  %lpad.val63.i = insertvalue { i8*, i32 } %lpad.val.i, i32 %ehselector.slot.0.i, 1, !dbg !7542
  resume { i8*, i32 } %lpad.val63.i, !dbg !7542
  invoke void @_ZN2ib6logger3msgIJRA1_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiDpOT_(%"class.std::__cxx11::basic_string"* nonnull sret %ref.tmp, i32 %err, [1 x i8]* nonnull dereferenceable(1) @.str.186)
          to label %invoke.cont unwind label %lpad, !dbg !7337
  %call2.i8 = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %2, i8* %3, i64 %4)
          to label %invoke.cont4 unwind label %lpad3, !dbg !7385
  %7 = landingpad { i8*, i32 }
          cleanup, !dbg !7495
  %10 = landingpad { i8*, i32 }
          cleanup, !dbg !7495
  %lpad.val = insertvalue { i8*, i32 } undef, i8* %exn.slot.0, 0, !dbg !7495
  %lpad.val6 = insertvalue { i8*, i32 } %lpad.val, i32 %ehselector.slot.0, 1, !dbg !7495
  resume { i8*, i32 } %lpad.val6, !dbg !7495
  %call1.i.i7.i = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %6, i8* nonnull getelementptr inbounds ([32 x i8], [32 x i8]* @.str.160, i64 0, i64 0), i64 31)
          to label %invoke.cont36.i unwind label %lpad35.i, !dbg !7531
  %18 = landingpad { i8*, i32 }
          cleanup, !dbg !7533
  %call1.i.i1.i = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %10, i8* nonnull getelementptr inbounds ([10 x i8], [10 x i8]* @.str.158, i64 0, i64 0), i64 9)
          to label %invoke.cont.i unwind label %lpad.i, !dbg !7491
  %call1.i.i4.i = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %10, i8* nonnull getelementptr inbounds ([29 x i8], [29 x i8]* @.str.159, i64 0, i64 0), i64 28)
          to label %invoke.cont25.i unwind label %lpad.i, !dbg !7511
  %14 = landingpad { i8*, i32 }
          cleanup, !dbg !7513
WARNING: matched due to a lack of information:   tail call void @_ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1ESt13_Ios_Openmode(%"class.std::__cxx11::basic_ostringstream"* nonnull %m_oss, i32 16), !dbg !7321
[ERROR]: getAccessedMemory: unhandled intruction
  invoke void @_ZN2ib6logger3msgIJRA1_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiDpOT_(%"class.std::__cxx11::basic_string"* nonnull sret %ref.tmp, i32 %err, [1 x i8]* nonnull dereferenceable(1) @.str.186)
          to label %invoke.cont unwind label %lpad, !dbg !7337
WARNING: matched due to a lack of information:   invoke void @_ZN2ib6logger3msgIJRA1_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiDpOT_(%"class.std::__cxx11::basic_string"* nonnull sret %ref.tmp, i32 %err, [1 x i8]* nonnull dereferenceable(1) @.str.186)
          to label %invoke.cont unwind label %lpad, !dbg !7337
[ERROR]: getAccessedMemory: unhandled intruction
  %call2.i8 = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %2, i8* %3, i64 %4)
          to label %invoke.cont4 unwind label %lpad3, !dbg !7385
WARNING: matched due to a lack of information:   %call2.i8 = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %2, i8* %3, i64 %4)
          to label %invoke.cont4 unwind label %lpad3, !dbg !7385
WARNING: matched due to a lack of information:   %vbase.offset.i.i = load i64, i64* %18, align 8, !dbg !7541
WARNING: matched due to a lack of information:   call void @_ZNSt6localeD1Ev(%"class.std::locale"* nonnull %_M_buf_locale.i.i.i.i) #14, !dbg !7595
WARNING: matched due to a lack of information:   call void @_ZNSt8ios_baseD2Ev(%"class.std::ios_base"* nonnull %24) #14, !dbg !7610
WARNING: matched due to a lack of information:   %call1.i = call i32 @backtrace(i8** nonnull %arraydecay.i, i32 100), !dbg !7341
WARNING: matched due to a lack of information:   %call2.i = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.151, i64 0, i64 0), i32 %call1.i), !dbg !7342
WARNING: matched due to a lack of information:   %call4.i = call i8** @backtrace_symbols(i8** nonnull %arraydecay.i, i32 %call1.i) #14, !dbg !7343
WARNING: matched due to a lack of information:   call void @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.152, i64 0, i64 0)) #15, !dbg !7347
WARNING: matched due to a lack of information:   call void @exit(i32 1) #16, !dbg !7349
WARNING: matched due to a lack of information:   %call5.i = call %struct._IO_FILE* @fopen64(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.153, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.154, i64 0, i64 0)), !dbg !7350
WARNING: matched due to a lack of information:   %call6.i = call i32 (%struct._IO_FILE*, i8*, ...) @fprintf(%struct._IO_FILE* %call5.i, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.155, i64 0, i64 0), i32 %call.i), !dbg !7351
WARNING: matched due to a lack of information:   %fputc.i = call i32 @fputc(i32 10, %struct._IO_FILE* %call5.i), !dbg !7356
WARNING: matched due to a lack of information:   %call10.i = call i32 @fclose(%struct._IO_FILE* %call5.i), !dbg !7357
WARNING: matched due to a lack of information:   call void @free(i8* %1) #14, !dbg !7359
WARNING: matched due to a lack of information:   %12 = load i8*, i8** %arrayidx.i, align 8, !dbg !7450, !tbaa !7451
WARNING: matched due to a lack of information:   %call8.i = call i32 (%struct._IO_FILE*, i8*, ...) @fprintf(%struct._IO_FILE* %call5.i, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.156, i64 0, i64 0), i8* %12), !dbg !7453
WARNING: matched due to a lack of information:   %13 = load i32, i32* %call17.i, align 4, !dbg !7457, !tbaa !7458
WARNING: matched due to a lack of information:   call void @_Z23ut_dbg_assertion_failedPKcS0_m(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.157, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i64 2882) #18, !dbg !7467
WARNING: matched due to a lack of information:   call void @_ZN2ib6loggerC2E8logleveli(%"class.ib::logger"* nonnull %8, i32 2, i32 12598), !dbg !7473
[ERROR]: getAccessedMemory: unhandled intruction
  %call1.i.i1.i = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %10, i8* nonnull getelementptr inbounds ([10 x i8], [10 x i8]* @.str.158, i64 0, i64 0), i64 9)
          to label %invoke.cont.i unwind label %lpad.i, !dbg !7491
WARNING: matched due to a lack of information:   %call1.i.i1.i = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %10, i8* nonnull getelementptr inbounds ([10 x i8], [10 x i8]* @.str.158, i64 0, i64 0), i64 9)
          to label %invoke.cont.i unwind label %lpad.i, !dbg !7491
[ERROR]: getAccessedMemory: unhandled intruction
  %call1.i.i4.i = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %10, i8* nonnull getelementptr inbounds ([29 x i8], [29 x i8]* @.str.159, i64 0, i64 0), i64 28)
          to label %invoke.cont25.i unwind label %lpad.i, !dbg !7511
WARNING: matched due to a lack of information:   %call1.i.i4.i = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %10, i8* nonnull getelementptr inbounds ([29 x i8], [29 x i8]* @.str.159, i64 0, i64 0), i64 28)
          to label %invoke.cont25.i unwind label %lpad.i, !dbg !7511
WARNING: matched due to a lack of information:   call void @_ZN2ib6loggerD2Ev(%"class.ib::logger"* nonnull %8) #14, !dbg !7472
WARNING: matched due to a lack of information:   call void @_ZN2ib6loggerD2Ev(%"class.ib::logger"* nonnull %8) #14, !dbg !7472
WARNING: matched due to a lack of information:   %call11.i.i = call i32 @nanosleep(%struct.timespec* nonnull %tmpcast, %struct.timespec* nonnull %tmpcast), !dbg !7517
WARNING: matched due to a lack of information:   %17 = load i32, i32* %call17.i, align 4, !dbg !7520, !tbaa !7458
WARNING: matched due to a lack of information:   call void @_ZN2ib6loggerC2E8logleveli(%"class.ib::logger"* nonnull %4, i32 1, i32 13622), !dbg !7527
[ERROR]: getAccessedMemory: unhandled intruction
  %call1.i.i7.i = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %6, i8* nonnull getelementptr inbounds ([32 x i8], [32 x i8]* @.str.160, i64 0, i64 0), i64 31)
          to label %invoke.cont36.i unwind label %lpad35.i, !dbg !7531
WARNING: matched due to a lack of information:   %call1.i.i7.i = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %6, i8* nonnull getelementptr inbounds ([32 x i8], [32 x i8]* @.str.160, i64 0, i64 0), i64 31)
          to label %invoke.cont36.i unwind label %lpad35.i, !dbg !7531
WARNING: matched due to a lack of information:   call void @_ZN2ib5fatalD1Ev(%"class.ib::fatal"* nonnull %ref.tmp34.i) #14, !dbg !7526
WARNING: matched due to a lack of information:   call void @_ZN2ib5fatalD1Ev(%"class.ib::fatal"* nonnull %ref.tmp34.i) #14, !dbg !7526
WARNING: matched due to a lack of information:   call void @_Z23ut_dbg_assertion_failedPKcS0_m(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.161, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i64 2901) #18, !dbg !7539
WARNING: matched due to a lack of information:   call void @_Z23ut_dbg_assertion_failedPKcS0_m(i8* null, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i64 2905) #18, !dbg !7541
SC: Matched 'fsync' to: 
    %call1.i.i1.i = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %10, i8* nonnull getelementptr inbounds ([10 x i8], [10 x i8]* @.str.158, i64 0, i64 0), i64 9)
          to label %invoke.cont.i unwind label %lpad.i, !dbg !7491
    %call1.i = call i32 @backtrace(i8** nonnull %arraydecay.i, i32 100), !dbg !7341
    %call2.i = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.151, i64 0, i64 0), i32 %call1.i), !dbg !7342
    %call4.i = call i8** @backtrace_symbols(i8** nonnull %arraydecay.i, i32 %call1.i) #14, !dbg !7343
    call void @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.152, i64 0, i64 0)) #15, !dbg !7347
    call void @exit(i32 1) #16, !dbg !7349
    %call5.i = call %struct._IO_FILE* @fopen64(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.153, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.154, i64 0, i64 0)), !dbg !7350
    %call6.i = call i32 (%struct._IO_FILE*, i8*, ...) @fprintf(%struct._IO_FILE* %call5.i, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.155, i64 0, i64 0), i32 %call.i), !dbg !7351
    %fputc.i = call i32 @fputc(i32 10, %struct._IO_FILE* %call5.i), !dbg !7356
    %call10.i = call i32 @fclose(%struct._IO_FILE* %call5.i), !dbg !7357
    call void @free(i8* %1) #14, !dbg !7359
    %call1316.i = call i32 @fsync(i32 %file), !dbg !7365
    %12 = load i8*, i8** %arrayidx.i, align 8, !dbg !7450, !tbaa !7451
    %call8.i = call i32 (%struct._IO_FILE*, i8*, ...) @fprintf(%struct._IO_FILE* %call5.i, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.156, i64 0, i64 0), i8* %12), !dbg !7453
    %13 = load i32, i32* %call17.i, align 4, !dbg !7457, !tbaa !7458
    call void @_Z23ut_dbg_assertion_failedPKcS0_m(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.157, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i64 2882) #18, !dbg !7467
    call void @_ZN2ib6loggerC2E8logleveli(%"class.ib::logger"* nonnull %8, i32 2, i32 12598), !dbg !7473
    %call1.i.i4.i = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %10, i8* nonnull getelementptr inbounds ([29 x i8], [29 x i8]* @.str.159, i64 0, i64 0), i64 28)
          to label %invoke.cont25.i unwind label %lpad.i, !dbg !7511
    call void @_ZN2ib6loggerD2Ev(%"class.ib::logger"* nonnull %8) #14, !dbg !7472
    call void @_ZN2ib6loggerD2Ev(%"class.ib::logger"* nonnull %8) #14, !dbg !7472
    %call11.i.i = call i32 @nanosleep(%struct.timespec* nonnull %tmpcast, %struct.timespec* nonnull %tmpcast), !dbg !7517
    %17 = load i32, i32* %call17.i, align 4, !dbg !7520, !tbaa !7458
    call void @_ZN2ib6loggerC2E8logleveli(%"class.ib::logger"* nonnull %4, i32 1, i32 13622), !dbg !7527
    %call1.i.i7.i = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %6, i8* nonnull getelementptr inbounds ([32 x i8], [32 x i8]* @.str.160, i64 0, i64 0), i64 31)
          to label %invoke.cont36.i unwind label %lpad35.i, !dbg !7531
    call void @_ZN2ib5fatalD1Ev(%"class.ib::fatal"* nonnull %ref.tmp34.i) #14, !dbg !7526
    call void @_ZN2ib5fatalD1Ev(%"class.ib::fatal"* nonnull %ref.tmp34.i) #14, !dbg !7526
    call void @_Z23ut_dbg_assertion_failedPKcS0_m(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.161, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i64 2901) #18, !dbg !7539
    call void @_Z23ut_dbg_assertion_failedPKcS0_m(i8* null, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i64 2905) #18, !dbg !7541
    %call13.i = call i32 @fsync(i32 %file), !dbg !7365
    invoke void @_ZN2ib6logger3msgIJRA1_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiDpOT_(%"class.std::__cxx11::basic_string"* nonnull sret %ref.tmp, i32 %err, [1 x i8]* nonnull dereferenceable(1) @.str.186)
          to label %invoke.cont unwind label %lpad, !dbg !7337
    tail call void @_ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1ESt13_Ios_Openmode(%"class.std::__cxx11::basic_ostringstream"* nonnull %m_oss, i32 16), !dbg !7321
    %call2.i8 = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %2, i8* %3, i64 %4)
          to label %invoke.cont4 unwind label %lpad3, !dbg !7385
    %vbase.offset.i.i = load i64, i64* %18, align 8, !dbg !7541
    call void @_ZNSt6localeD1Ev(%"class.std::locale"* nonnull %_M_buf_locale.i.i.i.i) #14, !dbg !7595
    call void @_ZNSt8ios_baseD2Ev(%"class.std::ios_base"* nonnull %24) #14, !dbg !7610
[llvm-slicer] CPU time of pointer analysis: 2.252400e-02 s
[llvm-slicer] CPU time of data dependence analysis: 4.890000e-04 s
[llvm-slicer] CPU time of control dependence analysis: 1.220000e-04 s
[llvm-slicer] Finding dependent nodes took 0 sec 0 ms
[llvm-slicer] Slicing dependence graph took 0 sec 0 ms
[llvm-slicer] Sliced away 165 from 294 nodes in DG
The unwind destination does not have an exception handling instruction!
  %call1.i.i1.i = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %7, i8* nonnull getelementptr inbounds ([10 x i8], [10 x i8]* @.str.158, i64 0, i64 0), i64 9)
          to label %invoke.cont.i unwind label %lpad.i, !dbg !7448
The unwind destination does not have an exception handling instruction!
  %call1.i.i4.i = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %7, i8* nonnull getelementptr inbounds ([29 x i8], [29 x i8]* @.str.159, i64 0, i64 0), i64 28)
          to label %invoke.cont25.i unwind label %lpad.i, !dbg !7463
The unwind destination does not have an exception handling instruction!
  %call1.i.i7.i = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %4, i8* nonnull getelementptr inbounds ([32 x i8], [32 x i8]* @.str.160, i64 0, i64 0), i64 31)
          to label %invoke.cont36.i unwind label %lpad35.i, !dbg !7513
The unwind destination does not have an exception handling instruction!
  invoke void undef(%"class.std::__cxx11::basic_string"* nonnull sret %ref.tmp, i32 %err, [1 x i8]* nonnull dereferenceable(1) @.str.186)
          to label %invoke.cont unwind label %ehcleanup, !dbg !7547
The unwind destination does not have an exception handling instruction!
  %call2.i8 = invoke dereferenceable(272) %"class.std::basic_ostream"* @_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l(%"class.std::basic_ostream"* nonnull dereferenceable(272) %1, i8* %2, i64 %3)
          to label %safe_return unwind label %ehcleanup, !dbg !7587
[llvm-slicer] ERROR: Verifying module failed, the IR is not valid
[llvm-slicer] Saving anyway so that you can check it

It seems that this is not the problem mentioned in the documents. It is possible I can make it in this c++ file? Thanks!!

mchalupa commented 2 years ago

DG does not support LLVM generated from C++, which seems to be the problem here -- that the invoke instructions were sliced incorrectly.

shijy16 commented 2 years ago

I met the same issue when slicing LLVM IR generated from C++. Do you plan to support C++ in the future? @mchalupa

mchalupa commented 2 years ago

I met the same issue when slicing LLVM IR generated from C++. Do you plan to support C++ in the future? @mchalupa

I don't have time to work on the C++ support myself, but I'll gladly review and merge any PRs ;)