Page MenuHomePhabricator

[MachineMemOperand] learn about ptr_provenance
Needs ReviewPublic

Authored by jeroen.dobbelaere on Aug 3 2021, 7:47 AM.

Details

Summary

For the machine instructions, MachineMemOperand is the better place to track the ptr_provenance.

Diff Detail

Event Timeline

jeroen.dobbelaere requested review of this revision.Aug 3 2021, 7:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2021, 7:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 15 2022, 7:04 AM
Zoxc added a subscriber: Zoxc.May 5 2022, 9:21 AM

Given that the provenance gets dropped in https://reviews.llvm.org/D107356, how does it end up in machine operands?

Given that the provenance gets dropped in https://reviews.llvm.org/D107356, how does it end up in machine operands?

Good question. The provenance embedded in the MachineOperand here originates from the ptr_provenance operand in load/store instructions.
Your question does point out that https://reviews.llvm.org/D107356 (aka CodeGen/IntrinsicLowering) is too early if we want to track the more complex forms
of provenance after lowering.

Given that the provenance gets dropped in https://reviews.llvm.org/D107356, how does it end up in machine operands?

Good question. The provenance embedded in the MachineOperand here originates from the ptr_provenance operand in load/store instructions.
Your question does point out that https://reviews.llvm.org/D107356 (aka CodeGen/IntrinsicLowering) is too early if we want to track the more complex forms
of provenance after lowering.

Having looked deeper into it: IntrinsicLowering.cpp seems only to be used for the interpreter. There it makes sense to eliminate the noalias/ptr_provenance intrinsics.
During code generation, SelectionDAG is taking care of seeing through the intrinsics while lowering. But, the original llvm-IR (with intrinsics) stays available for the alias analysis. So the machine operands must be able to see it.
(Although you might need to enable AA analysis on machine ir)