[llvm] [SROA] Unfold gep of index select (PR #80983)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 12:57:34 PST 2024


================
@@ -158,11 +158,20 @@ bb:
 
 define i32 @test_select_idx_memcpy(i1 %c, ptr %p) {
----------------
nikic wrote:

The transform is beneficial, though it's not entirely obvious from looking at the IR. Two of the allocas are entirely dead and will get eliminated by InstCombine, the two other memcpys will be folded to load/store, at which point this reduces to scalar code and the remaining two allocas are also removed.

The point of this test is to show that the select unfolding works correctly even if the alloca is splittable, but non-promotable.

https://github.com/llvm/llvm-project/pull/80983


More information about the llvm-commits mailing list