I don't know how to use gdb for llvm. I follow the manual. But
$gdb opt
can't load opt. I got:
"/usr/dcs/projects/cs426/jliu7/llvm/tools/Debug/opt": not in executable
format: File format not recognized
Try one of "gdb64" or "gdb-64".
-Chris
I don't know how to use gdb for llvm. I follow the manual. But
$gdb opt
can't load opt. I got:
"/usr/dcs/projects/cs426/jliu7/llvm/tools/Debug/opt": not in executable
format: File format not recognized
Try one of "gdb64" or "gdb-64".
-Chris
How can I run llvm-gcc in such a way that does not perform
optimizations like constant propagation and dead code elimination?
In particular, I'm trying to analyze cases where the code will look
like:
int *op;
int *ip=(int*)malloc(sizeof(int));
op=ip;
/* store/read into *ip */
free(op);
but llvm-gcc transforms the above code to
int *ip=(int*)malloc(sizeof(int));
/* store/read into *ip */
free(ip);
which is a very reasonable thing to do, except that I _need_ to test
cases where I allocate objects with one pointer and deallocate with
another.
nicolas
As far as I know, there isn't. The gcc front-end has only been modified
to emit code in LLVM syntax, it will do whatever it regularly does,
which includes some optimizations.
The only solution I know of is to write LLVM assembly directly and then
use the LLVM assembler to make .bc files for input into opt and friends.
That will not eliminate dead code or constant-propagate.
HTH.
Nicholas,
A copy operation like op=ip get's eliminated because it is redundant in
SSA form. Both become a single virtual register.
Instead, do the following:
int **tmp = alloca int*;
ip = malloc...
store ip, tmp;
...
load tmp, op;
free(op);
Now, if gccas may run mem2reg, in which case tmp will be eliminated by
promoting from stack to register (and then folded away as before). If
so, pass tmp to some procedure and it will be left on the stack.
--Vikram
http://www.cs.uiuc.edu/~vadve