Commit 83879f4
authored
[SimplifyCFG] Don't block sinking for allocas if no phi created (#104579)
SimplifyCFG sinking currently does not sink loads/stores of allocas,
because historically SROA was unable to handle the resulting IR. Since
then, SROA both learned to speculate loads/stores over selects and phis,
*and* SimplifyCFG sinking has been deferred to the end of the function
simplification pipeline, which means that SROA happens before it.
As such, I believe that this workaround should no longer be necessary.
Given how sensitive SimplifyCFG sinking seems to be, this patch takes a
very conservative step towards removing this, by allowing sinking if we
don't actually need to form a phi over the pointer argument.
This fixes #104567, where
sinking a store to an escaped alloca allows converting a switch into
arithmetic.1 parent 985d64b commit 83879f4
File tree
5 files changed
+34
-50
lines changed- llvm
- lib/Transforms/Utils
- test
- CodeGen/Hexagon
- DebugInfo/ARM
- Transforms/SimplifyCFG
- X86
5 files changed
+34
-50
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1994 | 1994 | | |
1995 | 1995 | | |
1996 | 1996 | | |
1997 | | - | |
1998 | | - | |
1999 | | - | |
2000 | | - | |
2001 | | - | |
2002 | | - | |
2003 | | - | |
2004 | | - | |
2005 | | - | |
2006 | | - | |
2007 | | - | |
2008 | | - | |
2009 | | - | |
2010 | | - | |
2011 | | - | |
2012 | | - | |
2013 | | - | |
2014 | | - | |
2015 | | - | |
2016 | | - | |
2017 | | - | |
2018 | | - | |
2019 | 1997 | | |
2020 | 1998 | | |
2021 | 1999 | | |
| |||
2053 | 2031 | | |
2054 | 2032 | | |
2055 | 2033 | | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
2056 | 2055 | | |
2057 | 2056 | | |
2058 | 2057 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
838 | 838 | | |
839 | 839 | | |
840 | 840 | | |
841 | | - | |
842 | | - | |
843 | 841 | | |
844 | 842 | | |
845 | 843 | | |
846 | | - | |
847 | | - | |
848 | 844 | | |
849 | 845 | | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
850 | 849 | | |
851 | 850 | | |
852 | 851 | | |
| |||
914 | 913 | | |
915 | 914 | | |
916 | 915 | | |
917 | | - | |
918 | | - | |
919 | | - | |
| 916 | + | |
920 | 917 | | |
921 | | - | |
| 918 | + | |
922 | 919 | | |
923 | 920 | | |
924 | 921 | | |
925 | | - | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
926 | 926 | | |
927 | 927 | | |
928 | 928 | | |
| |||
Lines changed: 2 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 12 | + | |
| 13 | + | |
29 | 14 | | |
30 | 15 | | |
31 | 16 | | |
| |||
0 commit comments