llvm.org GIT mirror llvm / 732d1a4
Approved by Chris: $ svn merge -c 113820 https://llvm.org/svn/llvm-project/llvm/trunk --- Merging r113820 into '.': U test/Transforms/LICM/crash.ll U lib/Transforms/Scalar/LICM.cpp Log: fix PR8102, a case where we'd copyValue from a value that we already deleted. Fix this by doing the copyValue's before we delete stuff! git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_28@113823 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 9 years ago
2 changed file(s) with 31 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
851851 ReplacedLoads[ALoad] = NewVal;
852852 }
853853
854 // If the preheader load is itself a pointer, we need to tell alias analysis
855 // about the new pointer we created in the preheader block and about any PHI
856 // nodes that just got inserted.
857 if (PreheaderLoad->getType()->isPointerTy()) {
858 // Copy any value stored to or loaded from a must-alias of the pointer.
859 CurAST->copyValue(SomeValue, PreheaderLoad);
860
861 for (unsigned i = 0, e = NewPHIs.size(); i != e; ++i)
862 CurAST->copyValue(SomeValue, NewPHIs[i]);
863 }
864
854865 // Now that everything is rewritten, delete the old instructions from the body
855866 // of the loop. They should all be dead now.
856867 for (unsigned i = 0, e = LoopUses.size(); i != e; ++i) {
881892 User->eraseFromParent();
882893 }
883894
884 // If the preheader load is itself a pointer, we need to tell alias analysis
885 // about the new pointer we created in the preheader block and about any PHI
886 // nodes that just got inserted.
887 if (PreheaderLoad->getType()->isPointerTy()) {
888 // Copy any value stored to or loaded from a must-alias of the pointer.
889 CurAST->copyValue(SomeValue, PreheaderLoad);
890
891 for (unsigned i = 0, e = NewPHIs.size(); i != e; ++i)
892 CurAST->copyValue(SomeValue, NewPHIs[i]);
893 }
894
895895 // fwew, we're done!
896896 }
897897
3838 store i32 undef, i32* @g_8, align 4
3939 br label %for.body
4040 }
41
42 ; PR8102
43 define void @test3() {
44 entry:
45 %__first = alloca { i32* }
46 br i1 undef, label %for.cond, label %for.end
47
48 for.cond: ; preds = %for.cond, %entry
49 %tmp1 = getelementptr { i32*}* %__first, i32 0, i32 0
50 %tmp2 = load i32** %tmp1, align 4
51 %call = tail call i32* @test3helper(i32* %tmp2)
52 %tmp3 = getelementptr { i32*}* %__first, i32 0, i32 0
53 store i32* %call, i32** %tmp3, align 4
54 br i1 false, label %for.cond, label %for.end
55
56 for.end: ; preds = %for.cond, %entry
57 ret void
58 }
59
60 declare i32* @test3helper(i32*)