Displaying 2 results from an estimated 2 matches for "global_init".
2015 Jul 23
0
[LLVMdev] [cfe-dev] Clang devirtualization proposal
...concerned that this is not actually sound in general. Consider:
struct A;
extern A a;
void *p = &a; // emit load/icmp/assume here?
struct A { virtual void f(); };
A a;
If we emit an assume on the vptr at the point where the address of a is
taken, we get:
@a = global %A zeroinitializer
void @global_init() {
load @a
%x = icmp @a, @A.vtable
call @llvm.assume(%x)
store @a, @p
call @A::A(@a)
}
... where the assume call can be folded to "call @llvm.assume(i1 false)",
which (presumably) can be reduced further to "unreachable" (oops). (In
Geoff's example, this is sound...
2015 Jul 23
2
[LLVMdev] Clang devirtualization proposal
HI,
Yep, our proposal doesn't cover it, because this load ; icmp ; assume; will
land global initilizer function, and main will not see it.
At least if foo would be called multiple times, then we would only have one
load from vtable, but unfortunatelly we will not be able to inline, or make
direct call to it with this approach.
I think that this case is rare enough to solve it right now.
Piotr