[InstCombine] Remove one-use restriction on icmp of gep fold (#76730)
The fold for icmp (gep (p, i1), gep (p, i2)) to icmp (i1, i2) is currently limited to one of the GEPs either having one use or a constant offset. I believe this is to avoid duplicating complex arithmetic both in the GEP and the offset comparison. This patch instead does the same thing that the indexed compare fold does, which is to rewrite the GEP into i8 form if necessary, so that the offset arithmetic is not repeated after the transform. I ran into this problem in a case where there are multiple conditions on the same pointer, which prevents them from getting folded.
parent
b5abaea3
Please register or sign in to comment