From: David Given Date: Sat, 8 Oct 2016 08:21:24 +0000 (+0200) Subject: Fix bug where pushes were being placed in the wrong blocks. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=9db902314bdaa621457b126b0d54dc577b3a2db1;p=ack.git Fix bug where pushes were being placed in the wrong blocks. --- diff --git a/mach/proto/mcg/pass_convertstackops.c b/mach/proto/mcg/pass_convertstackops.c index d73924d67..64bca0762 100644 --- a/mach/proto/mcg/pass_convertstackops.c +++ b/mach/proto/mcg/pass_convertstackops.c @@ -1,6 +1,6 @@ #include "mcg.h" -static ARRAYOF(struct ir) pops; +static PMAPOF(struct basicblock, struct ir) pops; static PMAPOF(struct basicblock, struct ir) pushes; static struct ir* get_last_push(struct basicblock* bb) @@ -62,7 +62,7 @@ static void convert_block(struct procedure* proc, struct basicblock* bb) ir = get_first_pop(outbb); if (!ir || (ir->size != lastpush->size)) return; - array_appendu(&pops, ir); + pmap_add(&pops, outbb, ir); /* Also abort unless *every* predecessor block of the one we've * just found *also* ends in a push of the same size. */ @@ -93,7 +93,8 @@ static void convert_block(struct procedure* proc, struct basicblock* bb) for (i=0; isize); for (j=0; jroot = phi; *ir = *phi; - array_insert(&bb->irs, ir, 0); } } }