The loop vectorizer preserves wrapping, exact, and fast-math properties of scalar instructions. This patch adds a convenience method to make that operation easier because we need to do this in the loop vectorizer, SLP vectorizer, and possibly other places.
Although this is a 'no functional change' patch, I've added a testcase to verify that the exact flag is preserved by the loop vectorizer. The wrapping and fast-math flags are already checked in existing testcases.
This is a preliminary patch to enable a fix for:
http://llvm.org/bugs/show_bug.cgi?id=20802
[SLP vectorizer] fast-math and wrap/exact flags are not preserved.
Nitpick: Can you put a newline below this line for symmetry?