@@ -195,6 +195,7 @@ void kill_instruction(struct instruction *insn)
repeat_phase |= REPEAT_CSE;
return;
+ case OP_SETVAL:
case OP_NOT: case OP_NEG:
insn->bb = NULL;
kill_use(&insn->src1);
@@ -30,6 +30,12 @@ static int kill_select(int a)
return (a ? 1 : 0) && 0;
}
+static int kill_setval(int a)
+{
+l:
+ return &&l && 0;
+}
+
static int kill_load(int *a)
{
return *a && 0;
@@ -51,4 +57,5 @@ static int kill_store(int *a)
* check-output-excludes: ptrcast\\.
* check-output-excludes: fpcast\\.
* check-output-excludes: sel\\.
+ * check-output-excludes: set\\.
*/
Currently, kill_instruction() ignore OP_SETVAL instructions with the result that some instructions are not optimized away as expected. For example, when looking at the output of test-linearize, the following function: static int kill_setval(void) { l: return &&l && 0; } gives the following output: kill_setval: set.64 %r6 <- .L1 ret.32 $0 The 'set' instruction is obviously unneeded but nevertheless present. With the patch, the output is the expected: kill_set: ret.32 $0 Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- simplify.c | 1 + validation/kill-replaced-insn.c | 7 +++++++ 2 files changed, 8 insertions(+)