This is an archive of the discontinued LLVM Phabricator instance.

[Polly] [PPCGCodeGeneration] Teach `SubtreeValues` to include possibly required base pointers, not remove all base pointers blindly.
Needs ReviewPublic

Authored by bollu on Nov 10 2017, 8:45 AM.

Details

Summary

Currently, we remove all ScopArrayInfo base pointers from SubtreeValues.
We do this on the assumption that if an array is used, it will be passed
by the relevant ScopArrayInfo in
createKernelFunction/createKernelFunctionDecl.

However, there can be operations on a base pointer that we _do not
model_, eg. ptrtoint.

This will lead to incorrect code generation since we blindly copy
instructions using BlockGenerator. When BlockGenerator tries to clone
the ptrtoint instruction, It will create a kernel-to-host reference
which will cause us to fail verify.

Event Timeline

bollu created this revision.Nov 10 2017, 8:45 AM
efriedma edited edge metadata.Nov 10 2017, 1:17 PM

Did you forget to include part of your patch? This doesn't contain any code changes.

bollu added a comment.Nov 11 2017, 5:06 AM

@efriedma Thanks, I totally screwed up the rebase :)

bollu updated this revision to Diff 122579.Nov 11 2017, 5:06 AM
  • add changes in PPCGCodeGen that were missed due to incorrect rebase.
bollu updated this revision to Diff 122580.Nov 11 2017, 5:07 AM
  • [NFC wrt patch] remove debug code
philip.pfaffe edited edge metadata.Nov 12 2017, 2:17 AM

Do you have a testcase for the change this patch is introducing?

bollu updated this revision to Diff 123168.Nov 16 2017, 6:02 AM
  • update code and test case
philip.pfaffe added inline comments.Nov 17 2017, 3:43 AM
lib/CodeGen/PPCGCodeGeneration.cpp
1289

Is this related?

1498

This lambda can perfectly be inlined into it's caller.

philip.pfaffe added inline comments.Dec 1 2017, 4:37 AM
test/GPGPU/invariant-load-hoisting.ll
20

Please don't hardcode unnamed registers!

test/GPGPU/only-remove-arrays-from-subtree-that-are-used-by-kernel.ll
44

Don't hardcode unnamed registers.

jdoerfert resigned from this revision.Jun 4 2019, 10:03 PM