Bug 80603 - Optimize loads from constant arrays or aggregates with arrays
Summary: Optimize loads from constant arrays or aggregates with arrays
Status: ASSIGNED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: ---
Assignee: Richard Biener
URL:
Keywords:
: 91326 93411 (view as bug list)
Depends on:
Blocks: 99419
  Show dependency treegraph
 
Reported: 2017-05-03 08:00 UTC by Jakub Jelinek
Modified: 2023-10-01 03:32 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-05-03 00:00:00


Attachments
gcc8-cst-load.patch (4.00 KB, patch)
2017-05-03 08:00 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2017-05-03 08:00:18 UTC
Created attachment 41301 [details]
gcc8-cst-load.patch

The vrp113.c testcase (a copy of vrp40.c) is now XFAILed, because the switch optimization does a better job on it, but we don't manage to figure out that no matter what the index is we load always the same constant.
For integer loads, we can also figure ranges from those even if the constants aren't the same, similarly for pointers (always NULL vs. always non-NULL vs. anything).
Comment 1 Richard Biener 2017-05-03 08:40:20 UTC
Mine.
Comment 2 Richard Biener 2019-08-30 12:32:38 UTC
Would also be a suitable enhancement for fold_const_aggregate_ref in general
if you consider IPA-VRP propagation and

 _1 = AGGR[param_2(D)];
 return _1;
Comment 3 Jakub Jelinek 2020-01-28 10:24:52 UTC
*** Bug 93411 has been marked as a duplicate of this bug. ***
Comment 4 Jakub Jelinek 2020-01-28 15:19:21 UTC
*** Bug 91326 has been marked as a duplicate of this bug. ***