[llvm] [clang] [flang] [InstCombine] Canonicalize constant GEPs to i8 source element type (PR #68882)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 3 00:57:54 PST 2024


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


More information about the llvm-commits mailing list