This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Defined and lowered llvm.ppc.kill.canary intrinsic
AbandonedPublic

Authored by pscoro on May 18 2022, 11:38 AM.

Details

Reviewers
nemanjai
shchenz
Group Reviewers
Restricted Project

Diff Detail

Event Timeline

pscoro created this revision.May 18 2022, 11:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 11:38 AM
pscoro requested review of this revision.May 18 2022, 11:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 11:38 AM
pscoro added a reviewer: Restricted Project.Jun 1 2022, 9:08 AM

Can you add some test cases?
How is this new intrinsic will be used? For now there is no user for it and it will only be used in LLVM IR?

pscoro updated this revision to Diff 438794.Jun 21 2022, 12:12 PM

Added tests and debugging

pscoro updated this revision to Diff 438985.Jun 22 2022, 5:20 AM

[PowerPC] implemented kill_canary intrinsic and tests

Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2022, 5:20 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
pscoro updated this revision to Diff 438987.Jun 22 2022, 5:24 AM

[PowerPC]
Removed accidental patch files

pscoro updated this revision to Diff 438988.Jun 22 2022, 5:27 AM

[PowerPC]
Removed commented change

@shchenz I have added the test cases.
This intrinsic is defined in order to test the stackprotect functionality on xlf. Use the -qdebug=smashstack flag to use it, make sure that -qstackprotect=all is also set

shchenz added inline comments.Jun 22 2022, 8:10 AM
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
11112

Why should return -1?

11120

nit: the first letter should be upper for deadBird according to LLVM coding style.

And how can we make sure 0x4C6C566D is not the same with the canary word load with TargetOpcode::LOAD_STACK_GUARD?

11122

Need to run clang-format for the new codes.

11136

nit: no need for the break after a return

llvm/test/CodeGen/PowerPC/kill-canary-intrinsic.ll
3 ↗(On Diff #438988)

We may also need to add test cases for AIX 32/64 bit too as stack protector is also supported on AIX.

13 ↗(On Diff #438988)

This seems wrong. When there is no stack protector related instructions in the function, we should not generate the killed store to the stack slot for canary word.

The store instruction now will store a word to the caller unexpectedly.

pscoro abandoned this revision.Jun 27 2022, 8:08 AM
pscoro added inline comments.
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
11112

The source code for getStackProtectorIndex just returns StackProtectorIndex which is initialized to -1, it makes sense as the stack protector byte should be right before the stack frame begins

11120

What would you suggest for this? I'm not sure exactly how the canary word is created, is it worth loading the canary word first, manipulating it to make sure that we store something different?

pscoro updated this revision to Diff 442677.Jul 6 2022, 1:35 PM

patch fix

pscoro abandoned this revision.Jul 6 2022, 1:49 PM