[PATCH] IR: Do not canonicalize constant GEPs into an out-of-bounds array access
David Majnemer
david.majnemer at gmail.com
Wed Nov 6 18:06:29 PST 2013
================
Comment at: lib/IR/ConstantFold.cpp:1975
@@ +1974,3 @@
+ if (ConstantInt *CIIdx0 = dyn_cast<ConstantInt>(Idx0))
+ if (CIIdx0->getSExtValue() < NumElements)
+ IsSequentialAccessInRange = true;
----------------
Bill Wendling wrote:
> Please do a zext instead of sext.
GEP values which are negative are out of bounds which is why all this work is done with signed comparisons and signed types.
http://llvm-reviews.chandlerc.com/D2093
More information about the llvm-commits
mailing list