This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Extend constant folding for logical operations
ClosedPublic

Authored by grahamsellers on Dec 8 2018, 5:52 AM.

Details

Reviewers
arsenm
nhaehnle
Summary

This patch extends existing constant folding in logical operations to handle S_XNOR, S_NAND, S_NOR, S_ANDN2, S_ORN2, V_LSHL_ADD_U32 and V_AND_OR_B32. Also added a couple of tests for existing folds.

Diff Detail

Event Timeline

grahamsellers created this revision.Dec 8 2018, 5:52 AM
arsenm added inline comments.Dec 8 2018, 12:21 PM
test/CodeGen/AMDGPU/constant-fold-imm-immreg.mir
209–211

Somehow this MIR looks ancient. The virtual registers should have the class annotations and then you can drop the register section. You can use -run-pass=none to convert this (and after delete the frame info etc.)

Ran constant-fold-imm-immreg.mir through llc -run-pass none and fixed up the result as requested. This adds register info to the virtual registers and allows deletion of the register sections of the resulting file.

arsenm accepted this revision.Dec 12 2018, 6:56 PM

LGTM with another minor round of test reduction

test/CodeGen/AMDGPU/constant-fold-imm-immreg.mir
135–137

You can strip out all of these default false/0 fields too

This revision is now accepted and ready to land.Dec 12 2018, 6:56 PM

It looks like this was never committed. What's the next step here?

It looks like this was never committed. What's the next step here?

I didn't get this in before the break. When I returned, I integrated to ToT and re-ran tests, and got a bunch of failures. I'm pretty sure it's nothing to do with this change, but didn't want to commit as-is. I haven't had a chance to dig deeper. If there is a problem with this change, I'll want to re-review it.