This came up in some benchmark: int div (int sub (int cast ([1 x { [6 x int], int, { [32 x uint] } }]* %save_regs_gc_mark to int), int cast (sbyte* getelementptr (sbyte* cast ([1 x { [6 x int], int, { [32 x uint] } }]* %save_regs_gc_mark to sbyte*), long 156) to int)), int 4) ---------------------------------------------------- %RealTy = type [1 x { [6 x int], int, { [32 x uint] } }] %OtherTy = type { short, short, { ulong } } %save_regs_gc_mark = external global [1 x { [6 x int], int, { [32 x uint] } }] ;; First step: fold (gep (cast %A* %P to sbyte*), int 1234) to (cast (gep %A* %P, 12) to ...) implementation ; Functions: bool %t() { ret bool setlt (int 1, int div (int sub (int cast ({ short, short, { ulong } }** select (bool setgt ({ short, short, { ulong } }** cast ([1 x { [6 x int], int, { [32 x uint] } }]* %save_regs_gc_mark to { short, short, { ulong } }**), { short, short, { ulong } }** cast (sbyte* getelementptr (sbyte* cast ([1 x { [6 x int], int, { [32 x uint] } }]* %save_regs_gc_mark to sbyte*), int 156) to { short, short, { ulong } }**)), { short, short, { ulong } }** cast ([1 x { [6 x int], int, { [32 x uint] } }]* %save_regs_gc_mark to { short, short, { ulong } }**), { short, short, { ulong } }** cast (sbyte* getelementptr (sbyte* cast ([1 x { [6 x int], int, { [32 x uint] } }]* %save_regs_gc_mark to sbyte*), int 156) to { short, short, { ulong } }**)) to int), int cast ({ short, short, { ulong } }** select (bool setgt ({ short, short, { ulong } }** cast ([1 x { [6 x int], int, { [32 x uint] } }]* %save_regs_gc_mark to { short, short, { ulong } }**), { short, short, { ulong } }** cast (sbyte* getelementptr (sbyte* cast ([1 x { [6 x int], int, { [32 x uint] } }]* %save_regs_gc_mark to sbyte*), int 156) to { short, short, { ulong } }**)), { short, short, { ulong } }** cast (sbyte* getelementptr (sbyte* cast ([1 x { [6 x int], int, { [32 x uint] } }]* %save_regs_gc_mark to sbyte*), int 156) to { short, short, { ulong } }**), { short, short, { ulong } }** cast ([1 x { [6 x int], int, { [32 x uint] } }]* %save_regs_gc_mark to { short, short, { ulong } }**)) to int)), int 4)) } ---------------------------------------------------- %scan_xp_.1 = phi uint* [ %inc.26, %endif.7 ], [ getelementptr ([2 x uint]* cast (long add (long cast ([0 x [2 x ui nt]]* %reg_class_contents to long), long 48) to [2 x uint]*), long 0, long 0), %no_exit.8 ], [ getelementptr ([2 x uint]* c ast (long add (long cast ([0 x [2 x uint]]* %reg_class_contents to long), long 48) to [2 x uint]*), long 0, long 0), %no_ex it.9 ], [ getelementptr ([2 x uint]* cast (long add (long cast ([0 x [2 x uint]]* %reg_class_contents to long), long 48) to [2 x uint]*), long 0, long 0), %then.4 ], [ getelementptr ([2 x uint]* cast (long add (long cast ([0 x [2 x uint]]* %reg_c lass_contents to long), long 48) to [2 x uint]*), long 0, long 0), %endif.4 ] (long add (long cast ([0 x [2 x uint]]* %reg_class_contents to long), long 48) Should be a gep then cast.