This is an archive of the discontinued LLVM Phabricator instance.

Propagate Undef in llvm.cos Intrinsic
ClosedPublic

Authored by anna on Apr 7 2016, 8:18 AM.

Details

Summary

the llvm cos intrinsic currently does not propagate undef's. This change transforms cos(undef) to null value or 0.

There are 2 test cases added as well.

Diff Detail

Event Timeline

anna updated this revision to Diff 52925.Apr 7 2016, 8:18 AM
anna retitled this revision from to Propagate Undef in llvm.cos Intrinsic.
anna updated this object.
anna added a reviewer: sanjoy.
anna changed the visibility from "Public (No Login Required)" to "All Users".
anna added a subscriber: llvm-commits.
sanjoy updated this object.Apr 7 2016, 9:30 AM
sanjoy changed the visibility from "All Users" to "Public (No Login Required)".
sanjoy requested changes to this revision.Apr 7 2016, 9:32 AM
sanjoy edited edge metadata.
sanjoy added a subscriber: majnemer.

@majnemer - what do you think of this?

lib/Analysis/ConstantFolding.cpp
1446

Since you're not using Op, using isa instead of dyn_cast is better.

This revision now requires changes to proceed.Apr 7 2016, 9:32 AM
anna updated this revision to Diff 52938.Apr 7 2016, 10:00 AM
anna edited edge metadata.
anna marked an inline comment as done.Apr 7 2016, 10:02 AM
anna added inline comments.
lib/Analysis/ConstantFolding.cpp
1446

Updated the code to use isa.

sanjoy accepted this revision.Apr 7 2016, 10:55 AM
sanjoy edited edge metadata.

LGTM pending a minor comment inline. Let me know once you're ready for me to commit this for you.

test/Transforms/InstCombine/cos_intrinsic.ll
9

Can you please change this directly CHECK for the result of the fold?

This revision is now accepted and ready to land.Apr 7 2016, 10:55 AM
anna updated this revision to Diff 52940.Apr 7 2016, 11:18 AM
anna edited edge metadata.
anna marked an inline comment as done.

updated based on Sanjoy's comment to place the check in the first test after the cos(undef) itself

This revision was automatically updated to reflect the committed changes.