Issue 243901
Summary [RelLookupTableConverter] Handle tables coming from phi/select
Labels missed-optimization
Assignees
Reporter aengelke
    SimplifyCFG can fold identical code sequences from different lookup tables and does so more often since #241916. This caused a measurable .data.rel.ro size regression in stage2 builds of LLVM (3.7%/26.4 kiB in my build config).

RelLookupTableConverter should handle cases where the table comes from a phi or select. Full example (via https://github.com/llvm/llvm-project/pull/241916#issuecomment-6961624466): https://clang.godbolt.org/z/YGc8effPo

```llvm
 %switch.table._Z1fii.10.sink = phi ptr [ @switch.table.f(int, int), %if.then ], [ @switch.table._Z1fii.10, %if.else ]
  %2 = zext nneg i32 %x to i64
 %switch.gep12 = getelementptr inbounds nuw [8 x i8], ptr %switch.table._Z1fii.10.sink, i64 %2
  %switch.load13 = load ptr, ptr %switch.gep12, align 8
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to