[SampleProfileLoader] Fix integer overflow in generateMDProfMetadata (#90217)
commit686a206b2665b6ba9245980489daa79dc8547079
authorNabeel Omer <nabeel.omer@sony.com>
Wed, 8 May 2024 13:32:56 +0000 (8 14:32 +0100)
committerGitHub <noreply@github.com>
Wed, 8 May 2024 13:32:56 +0000 (8 14:32 +0100)
tree9c25e375cf902486e5bf68f319e2f9cb5546ac96
parentc84c74e67839a5207d7c6318fc37e607f088a994
[SampleProfileLoader] Fix integer overflow in generateMDProfMetadata (#90217)

This patch fixes an integer overflow in the SampleProfileLoader pass.
The issue occurs when weights are saturated and Profi isn't being used.

This patch also adds a newline to a debug message to make it more
readable.
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/test/Transforms/SampleProfile/Inputs/overflow.proftext [new file with mode: 0644]
llvm/test/Transforms/SampleProfile/overflow.ll [new file with mode: 0644]