[PATCH] Reassociate GEP operands for loop invariant code motion

Sanjoy Das sanjoy at playingwithpointers.com
Mon Apr 20 22:09:22 PDT 2015


>> Indvar widening alleviates this nsw issue for lots of architectures. However, it's not a good option for GPU programs again because most GPUs support only i32 natively. If LSR fails to simplify the loop, then indvar widening can negatively affect performance (https://llvm.org/bugs/show_bug.cgi?id=21148) because 64-bit arithmetic is much more expensive than 32-bit. P.S. maybe we can narrow an induction variable back to its original size on LSR failure?

Actually, widening the induction variable looks like an orthogonal
issue to re-associating GEPs.  As mentioned in the bug, the right fix
to the widening issue is to not widen if wide integer ops are more
expensive for the target -- if LSR is widening indvars when it
shouldn't perhaps that part of LSR should be predicated on a target
specific hook also?

-- Sanjoy




More information about the llvm-commits mailing list