Skip to content

Dynamic Memory Issue #1

@Stefan-Mada

Description

@Stefan-Mada

Unsure whether dynamic memory is supported, but here is what I found:

Source file:

int* function(){
	int* arr = new int[10];
	return arr;
}

Compiled using:
clang++ -I -march=native -mavx2 -O3 -Werror -S -emit-llvm function.cpp -o function.ll

Called supervec using:
$HOME/llvm/build/bin/opt -enable-new-pm=0 -load $HOME/minotaur/build/minotaur.so -so -S function.ll


Sketches output:
---------Sketches------------
(copy reservedconst)
-----------------------------

----------------------------------------
define * @_Z8functionv.1.2(* %_reservedc_0) nonnull nofree {
%0:
  %1 = malloc i64 40, nonnull
  %2 = bitcast * %1 to *
  ret * %2
}
=>
define * @_Z8functionv.1(* %_reservedc_0) nonnull nofree {
%0:
  %1 = malloc i64 40, nonnull
  ret * %_reservedc_0
}
;result
* %_reservedc_0 = pointer(non-local, block_id=1, offset=0)
opt: /home/stefan/llvm/llvm/lib/IR/Value.cpp:502: void llvm::Value::doRAUW(llvm::Value*, llvm::Value::ReplaceMetadataUses): Assertion `New && "Value::replaceAllUsesWith(<null>) is invalid!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/stefan/llvm/build/bin/opt -enable-new-pm=0 -load /home/stefan/minotaur/build/minotaur.so -so -S function.ll
1.	Running pass 'Function Pass Manager' on module 'function.ll'.
2.	Running pass 'Superoptimizer' on function '@_Z8functionv'
 #0 0x00007fad412d7c14 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x00007fad412d4c9e SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fad40d11210 (/lib/x86_64-linux-gnu/libc.so.6+0x46210)
 #3 0x00007fad40d1118b raise /build/glibc-eX1tMB/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #4 0x00007fad40cf0859 abort /build/glibc-eX1tMB/glibc-2.31/stdlib/abort.c:81:7
 #5 0x00007fad40cf0729 get_sysdep_segment_value /build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:509:8
 #6 0x00007fad40cf0729 _nl_load_domain /build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:970:34
 #7 0x00007fad40d01f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
 #8 0x00007fad41655723 (/home/stefan/llvm/build/bin/../lib/libLLVMCore.so.14git+0x2ea723)
 #9 0x00007fad3f95102e minotaur::synthesize(llvm::Function&, llvm::TargetLibraryInfo*) (/home/stefan/minotaur/build/minotaur.so+0x7b02e)
#10 0x00007fad415dd7d3 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/stefan/llvm/build/bin/../lib/libLLVMCore.so.14git+0x2727d3)
#11 0x00007fad415dda19 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/stefan/llvm/build/bin/../lib/libLLVMCore.so.14git+0x272a19)
#12 0x00007fad415dec23 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/stefan/llvm/build/bin/../lib/libLLVMCore.so.14git+0x273c23)
#13 0x000055761ab9ffc4 main (/home/stefan/llvm/build/bin/opt+0x27fc4)
#14 0x00007fad40cf20b3 __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:342:3
#15 0x000055761aba0e7e _start (/home/stefan/llvm/build/bin/opt+0x28e7e)
Aborted (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions