diff --git a/llvm/test/Regression/Transforms/ADCE/2002-05-28-Crash.ll b/llvm/test/Regression/Transforms/ADCE/2002-05-28-Crash.ll new file mode 100644 index 000000000000..184384ed48e8 --- /dev/null +++ b/llvm/test/Regression/Transforms/ADCE/2002-05-28-Crash.ll @@ -0,0 +1,54 @@ +; This testcase is distilled from the GNU rx package. The loop should be +; removed but causes a problem when ADCE does. The source function is: +; int rx_bitset_empty (int size, rx_Bitset set) { +; int x; +; RX_subset s; +; s = set[0]; +; set[0] = 1; +; for (x = rx_bitset_numb_subsets(size) - 1; !set[x]; --x) +; ; +; set[0] = s; +; return !s; +;} +; +; RUN: as < %s | opt -adce | dis + +implementation ; Functions: + +int %rx_bitset_empty(int %size, uint* %set) { +bb1: ;[#uses=2] + %reg110 = load uint* %set ; [#uses=2] + store uint 1, uint* %set + %cast112 = cast int %size to ulong ; [#uses=1] + %reg113 = add ulong %cast112, 31 ; [#uses=1] + %reg114 = shr ulong %reg113, ubyte 5 ; [#uses=2] + %cast109 = cast ulong %reg114 to int ; [#uses=1] + %reg129 = add int %cast109, -1 ; [#uses=1] + %reg114-idxcast = cast ulong %reg114 to uint ; [#uses=1] + %reg114-idxcast-offset = add uint %reg114-idxcast, 1073741823 ; [#uses=1] + %reg124 = getelementptr uint* %set, uint %reg114-idxcast-offset ; [#uses=1] + %reg125 = load uint* %reg124 ; [#uses=1] + %cond232 = setne uint %reg125, 0 ; [#uses=1] + br bool %cond232, label %bb3, label %bb2 + +bb2: ;[#uses=3] + %cann-indvar = phi int [ 0, %bb1 ], [ %add1-indvar, %bb2 ] ; [#uses=2] + %reg130-scale = mul int %cann-indvar, -1 ; [#uses=1] + %reg130 = add int %reg130-scale, %reg129 ; [#uses=1] + %add1-indvar = add int %cann-indvar, 1 ; [#uses=1] + %reg130-idxcast = cast int %reg130 to uint ; [#uses=1] + %reg130-idxcast-offset = add uint %reg130-idxcast, 1073741823 ; [#uses=1] + %reg118 = getelementptr uint* %set, uint %reg130-idxcast-offset ; [#uses=1] + %reg119 = load uint* %reg118 ; [#uses=1] + %cond233 = seteq uint %reg119, 0 ; [#uses=1] + br bool %cond233, label %bb2, label %bb3 + +bb3: ;[#uses=2] + store uint %reg110, uint* %set + %cast126 = cast uint %reg110 to ulong ; [#uses=1] + %reg127 = add ulong %cast126, 18446744073709551615 ; [#uses=1] + %reg128 = shr ulong %reg127, ubyte 63 ; [#uses=1] + %cast120 = cast ulong %reg128 to int ; [#uses=1] + ret int %cast120 + +}