This is an archive of the discontinued LLVM Phabricator instance.

[NVPTX] truncating 64-bit to 32-bit is free
ClosedPublic

Authored by jingyue on Aug 15 2015, 10:00 PM.

Details

Summary

Add an LSR test that exercises isTruncateFree. Without this change, LSR creates
another indvar representing the truncated value.

Diff Detail

Event Timeline

jingyue updated this revision to Diff 32230.Aug 15 2015, 10:00 PM
jingyue retitled this revision from to [NVPTX] truncating 64-bit to 32-bit is free.
jingyue updated this object.
jingyue added reviewers: jholewinski, eliben.
jingyue added a subscriber: llvm-commits.
eliben added inline comments.Aug 20 2015, 11:58 AM
lib/Target/NVPTX/NVPTXISelLowering.h
464

I'd just && the four conditions in the 'return' statement here, would make it clearer IMHO. But it's just style so up to you

test/Transforms/LoopStrengthReduce/NVPTX/trunc.ll
2

Can you add a detailed comment explaining what this is testing?

jingyue updated this revision to Diff 32733.Aug 20 2015, 1:34 PM

more explanation on the test

jingyue marked an inline comment as done.Aug 20 2015, 1:39 PM
jingyue added inline comments.
lib/Target/NVPTX/NVPTXISelLowering.h
464

I'll keep what it is. It looks clearer to me: the first check as an early return against non-integer cases, and the remaining focuses at bitwidths. It could be that we later want to consider more types of trunc free and OR the bitwdith checks together.

eliben accepted this revision.Aug 20 2015, 1:52 PM
eliben edited edge metadata.

lgtm

This revision is now accepted and ready to land.Aug 20 2015, 1:52 PM
jingyue closed this revision.Aug 20 2015, 1:59 PM