; The -raise pass is not correctly deleting instructions in all cases where it ; should, which leaves the instruction to be deleted by DCE. This is bad ; because some instructions are left in an invalid form, causing an assertion ; failure. In this case, a chain of instructions, including a zero argument; ; PHI node is left behind. ; ; RUN: as < %s | opt -raise -q ; %Hash = type { { uint, sbyte *, \2 } * *, int (uint) *, int } * %HashEntry = type { uint, sbyte *, \2 } * %hash = type { { uint, sbyte *, \2 } * *, int (uint) *, int } %hash_entry = type { uint, sbyte *, \2 * } implementation void "HashDelete"(uint %key, %Hash %hash) begin bb1: ;[#uses=1] %cast1006 = cast %Hash %hash to sbyte * ; [#uses=1] %cast1007 = cast ulong 8 to sbyte * ; [#uses=1] %reg1000 = add sbyte * %cast1006, %cast1007 ; [#uses=1] %cast1008 = cast sbyte * %reg1000 to sbyte * * ; [#uses=1] %reg111 = load sbyte * * %cast1008 ; [#uses=1] %cast1009 = cast sbyte * %reg111 to uint (...) * ; [#uses=1] %reg110 = call uint (...) * %cast1009( uint %key ) ; [#uses=1] %reg114 = shl uint %reg110, ubyte 3 ; [#uses=1] %cast115 = cast uint %reg114 to ulong ; [#uses=1] %cast116 = cast ulong %cast115 to sbyte * ; [#uses=1] %cast1010 = cast %Hash %hash to sbyte * * ; [#uses=1] %reg117 = load sbyte * * %cast1010 ; [#uses=1] %reg112 = add sbyte * %reg117, %cast116 ; [#uses=4] %cast1011 = cast sbyte * %reg112 to sbyte * * ; [#uses=1] %reg122 = load sbyte * * %cast1011 ; [#uses=2] %cast1012 = cast ulong 0 to sbyte * ; [#uses=1] %cond1001 = seteq sbyte * %reg122, %cast1012 ; [#uses=1] br bool %cond1001, label %bb5, label %bb2 bb2: ;[#uses=3] %cast1013 = cast sbyte * %reg122 to uint * ; [#uses=1] %reg124 = load uint * %cast1013 ; [#uses=1] %cond1002 = seteq uint %reg124, %key ; [#uses=1] br bool %cond1002, label %bb5, label %bb3 bb3: ;[#uses=3] %reg125 = phi sbyte * [ %reg126, %bb4 ], [ %reg112, %bb2 ] ; [#uses=1] %cast1014 = cast sbyte * %reg125 to sbyte * * ; [#uses=1] %reg121 = load sbyte * * %cast1014 ; [#uses=2] %cast1015 = cast ulong 16 to sbyte * ; [#uses=1] %reg126 = add sbyte * %reg121, %cast1015 ; [#uses=3] %cast1016 = cast ulong 16 to sbyte * ; [#uses=1] %reg1003 = add sbyte * %reg121, %cast1016 ; [#uses=1] %cast1017 = cast sbyte * %reg1003 to sbyte * * ; [#uses=1] %reg118 = load sbyte * * %cast1017 ; [#uses=2] %cast1018 = cast ulong 0 to sbyte * ; [#uses=1] %cond1004 = seteq sbyte * %reg118, %cast1018 ; [#uses=1] br bool %cond1004, label %bb5, label %bb4 bb4: ;[#uses=3] %cast1019 = cast sbyte * %reg118 to uint * ; [#uses=1] %reg120 = load uint * %cast1019 ; [#uses=1] %cond1005 = setne uint %reg120, %key ; [#uses=1] br bool %cond1005, label %bb3, label %bb5 bb5: ;[#uses=4] %reg127 = phi sbyte * [ %reg126, %bb4 ], [ %reg126, %bb3 ], [ %reg112, %bb2 ], [ %reg112, %bb1 ] ; [#uses=1] call int (...) * %foo( sbyte * %reg127 ) ; :0 [#uses=0] ret void end declare int "foo"(...)