Displaying 2 results from an estimated 2 matches for "testeh".
Did you mean:
tested
2014 Jul 10
2
[LLVMdev] Telling the optimizer a value is always null at the start
How do I tell the optimizer that the (dereferenced) value of an i8**
parameter is NULL at the start so that it can eliminate the check?
I have code like:
void test2(void** ex) {
printf("go\n"); // does not change *ex
}
void call2(void** ex);
void testeh(void** ex) {
// I want to tell the optimizer *ex is null so it can eliminate the
first if below if test2 is inlined:
test2(ex)
if (*ex) return;
printf("done")
}
I tried with llvm.invariant.start/end but that doesn't seem to make any
differen...
2014 Jul 10
2
[LLVMdev] Telling the optimizer a value is always null at the start
...hilip Reames
<listmail at philipreames.com> wrote:
> Hm, I don't know of an explicit way in the IR to do this. If anyone else
> does, feel free to chime in.
>
> One approach would be to add a branch at the beginning of the function to an
> unreachable block. If you're testeh function started with:
> if( *ex != null) llvm_unreachable();
>
> You might get lucky and have the GVN or EarlyCSE propagate the null value.
> You're going to run into pass ordering problems here though. I suspect we'd
> drop the unreachable block before GVN runs.
Yep - Sim...