This fixes the tests in 32-bit Windows self-hosts (see bug).
I'm anxious to get this in as the bug is blocking the 3.9 release candidate and Windows snapshot.
Differential D22644
[GVNHoist] Don't clone allocas (PR28606) Authored by hans on Jul 21 2016, 1:32 PM.
Details
Diff Detail Event Timeline
Comment Actions This value cloning is still quite dangerous... Consider: define void @test(i1 %b, i8** %y, i8** %z) {
entry:
%x = load volatile i8*, i8** %z
br i1 %b, label %true, label %false
true:
%p = getelementptr inbounds i8*, i8** %y, i32 0
store i8* %x, i8** %p, align 4
br label %exit
false:
%p2 = getelementptr inbounds i8*, i8** %y, i32 0
store i8* %x, i8** %p2, align 4
br label %exit
exit:
ret void
}gvn-hoist will make this: define void @test(i1 %b, i8** %y, i8** %z) {
entry:
%x = load volatile i8*, i8** %z, align 4
%0 = load volatile i8*, i8** %z, align 4
store i8* %0, i8** %y, align 4
br i1 %b, label %true, label %false
true: ; preds = %entry
br label %exit
false: ; preds = %entry
br label %exit
exit: ; preds = %false, %true
ret void
}This is bad, we just cloned a volatile instruction. To be honest, I'm not entirely sure why we must clone the value because we've already checked to see that it is available at the hoist point... Comment Actions
Right, I think we do not need to clone the value. Comment Actions I tried to just do that, but the hoistStores test fails: Instruction does not dominate all uses! %incdec.ptr = getelementptr inbounds i16, i16* %1, i32 1 store i16* %incdec.ptr, i16** %2, align 8 Sebastian: can you give this a shot? I probably won't get any further today. Comment Actions As I was not able to update the diff, I created a new ticket: | ||||||||||||
This should logic should go earlier, before we cloned the gep.