This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Treat 'Z' inline asm constraint as a true memory constraint
ClosedPublic

Authored by nemanjai on Apr 6 2020, 5:00 AM.

Details

Summary

We currently emit incorrect codegen for this constraint because we set it as a constraint that allows registers. This will cause the value to be copied to the stack and that address to be passed as the address. This is not what we want.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=42762

Diff Detail

Event Timeline

nemanjai created this revision.Apr 6 2020, 5:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 6 2020, 5:00 AM
amyk added a subscriber: amyk.Apr 11 2020, 1:44 PM
amyk added inline comments.
clang/lib/Basic/Targets/PPC.h
277

Just curious, but does this case still require Info.setAllowsMemory(); as well?

nemanjai marked an inline comment as done.Apr 26 2020, 6:34 PM
nemanjai added inline comments.
clang/lib/Basic/Targets/PPC.h
277

I don't want to change the behaviour of a QPX-specific asm constraint, so I'd rather leave it as-is. Q will set both, Z will only set "memory".

lei accepted this revision as: lei.May 4 2020, 11:38 AM
lei added a subscriber: lei.

LGTM

This revision is now accepted and ready to land.May 4 2020, 11:38 AM
amyk added inline comments.May 11 2020, 2:47 PM
clang/lib/Basic/Targets/PPC.h
277

I see. Thanks for explaining.

clang/test/CodeGen/ppc64-inline-asm.c
50

Missing a k in CHECK?

stefanp accepted this revision as: stefanp.May 19 2020, 9:32 AM
stefanp added a subscriber: stefanp.

Other than the two missing Ks in the test case as Amy pointed out LGTM.

nemanjai marked an inline comment as done.May 22 2020, 3:30 AM
nemanjai added inline comments.
clang/test/CodeGen/ppc64-inline-asm.c
50

Great catch! Thank you.

This revision was automatically updated to reflect the committed changes.