nikic wrote:

@Artem-B Thanks for the report. SROA already has a bunch of special handling 
for `load(c ? p1 : p2)` as well as `load(gep(c ? p1 : p2, idx))`, so it's 
probably not too hard to also support `load(gep(p, c ? idx1 : idx2))`.

In your particular case, it seems like it's actually InstCombine itself that 
converts `load(c ? p1 : p2)` into `c ? load(p1) : load(p2)` in 
https://github.com/llvm/llvm-project/blob/141de749597c7b59ebe2c4aa7ee573d124dc903c/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp#L1068-L1087.
 So supporting additional patterns there might be a possible alternative. But I 
think we should try making SROA more powerful first.

https://github.com/llvm/llvm-project/pull/68882
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to