|Anonymous | Login | Signup for a new account||2020-02-28 03:45 CET|
|Main | My View | View Issues|
|Viewing Issue Simple Details|
|ID||Category||Severity||Reproducibility||Date Submitted||Last Update|
|0000084||[libFirm] optimisations||minor||always||2011-08-23 18:41||2011-12-24 03:47|
|Summary||0000084: unnecessary alignment localopt|
Typical alignment code works like this:
/* clear lowest 3 bits */
(x + (1<<3)-1) & ~(1<<3)-1
However if x has a value like (x*8), resp. x<<3 then the masking is obviously unnecessary. We should somehow detect this.
(I've seen this when looking at code produced for alloca on sparc where it was obvious that the requested number of bytes is a multiple of 8, but the generated code still contained alignment logic).
|Tags||No tags attached.|
some notes on how this should be done:
If you do a bit-analysis to analyse set/cleared bit then you should be able to find out that (x + (1<<3)-1) produces no overflows in the aligned x case. In this case the add has the same effect as an or instruction.
Then we can use a (a|b) & ~b => a & ~b to optimize the thing away.
|The necessary localopt rules are implemented in b7bf9774e5e704382bdf3eb7c09bc5755d4f067e. Note that for using them you need vrp info to be calculated (-fvrp, when and how to enable this by default is another story).|
|2011-08-23 18:41||Matze||New Issue|
|2011-08-23 18:41||Matze||Summary||another localopt? => unnecessary alignment localopt|
|2011-10-18 18:28||Matze||Note Added: 0000123|
|2011-11-04 11:36||Matze||Note Added: 0000132|
|2011-11-04 11:36||Matze||Assigned To||=> Matze|
|2011-11-04 11:36||Matze||Status||new => resolved|
|2011-11-04 11:36||Matze||Resolution||open => fixed|
|2011-11-04 11:36||Matze||View Status||private => public|
|2011-12-24 03:47||Matze||Status||resolved => closed|
|Mantis 1.1.5[^] Copyright © 2000 - 2008 Mantis Group|