This is an archive of the discontinued LLVM Phabricator instance.

add a convenience method to copy wrapping, exact, and fast-math flags (NFC)
ClosedPublic

Authored by spatel on Aug 31 2014, 5:14 PM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

spatel updated this revision to Diff 13131.Aug 31 2014, 5:14 PM
spatel retitled this revision from to add a convenience method to copy wrapping, exact, and fast-math flags (NFC).
spatel updated this object.
spatel edited the test plan for this revision. (Show Details)
spatel added reviewers: aschwaighofer, nadav, hfinkel.
spatel added a subscriber: Unknown Object (MLST).
majnemer added inline comments.
lib/IR/Instructions.cpp
2033–2049 ↗(On Diff #13131)

You could shorten this a bit by doing two things:

  1. Folding the dyn_cast into the if
  2. Using auto for the type of the variables, the dyn_cast makes unambiguous.
test/Transforms/LoopVectorize/exact.ll
3–4 ↗(On Diff #13131)

Space between ; and CHECK.

spatel updated this revision to Diff 13133.Aug 31 2014, 9:03 PM

Thanks, David! Patch updated.

aschwaighofer edited edge metadata.Sep 1 2014, 9:26 AM

LGTM.

Thanks!

lib/IR/Instructions.cpp
2038 ↗(On Diff #13133)

Nitpick: Can you put a newline below this line for symmetry?

spatel closed this revision.Sep 1 2014, 11:55 AM
spatel updated this revision to Diff 13142.

Closed by commit rL216886 (authored by @spatel).

Thanks, Arnold! Checked in with r216886.