Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AMDGPU] Uses SExt on indices in isInterestingPHIIncomingValue #85717

Closed
DataCorrupted opened this issue Mar 18, 2024 · 1 comment · Fixed by #85718
Closed

[AMDGPU] Uses SExt on indices in isInterestingPHIIncomingValue #85717

DataCorrupted opened this issue Mar 18, 2024 · 1 comment · Fixed by #85718
Assignees
Labels
backend:AMDGPU crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@DataCorrupted
Copy link
Member

Reproduction

https://godbolt.org/z/P97TT7fEs

Cause

When i1 true is used as an index, SExt extends it to i32 -1. This would cause BitVector to overflow.
This can be a quick fix by using ZExt over SExt, as we have specified in the language manual that the index shall be treated as an unsigned number. (https://llvm.org/docs/LangRef.html#insertelement-instruction)

@DataCorrupted DataCorrupted added backend:AMDGPU crash Prefer [crash-on-valid] or [crash-on-invalid] labels Mar 18, 2024
@DataCorrupted DataCorrupted self-assigned this Mar 18, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Mar 18, 2024

@llvm/issue-subscribers-backend-amdgpu

Author: Peter Rong (DataCorrupted)

## Reproduction

https://godbolt.org/z/P97TT7fEs

Cause

When i1 true is used as an index, SExt extends it to i32 -1. This would cause BitVector to overflow.
This can be a quick fix by using ZExt over SExt, as we have specified in the language manual that the index shall be treated as an unsigned number. (https://llvm.org/docs/LangRef.html#insertelement-instruction)

DataCorrupted added a commit to SecurityLab-UCD/llvm-project that referenced this issue Mar 18, 2024
…tion.

This patch fixes llvm#85717

Signed-off-by: Peter Rong <PeterRong96@gmail.com>
DataCorrupted added a commit that referenced this issue Mar 20, 2024
When i1 true is used as an index, SExt extends it to i32 -1. This would
cause BitVector to overflow.
The language manual have specified that the index shall be treated as an
unsigned number, this patch fixes that.
(https://llvm.org/docs/LangRef.html#insertelement-instruction)

This patch fixes #85717

---------

Signed-off-by: Peter Rong <PeterRong96@gmail.com>
chencha3 pushed a commit to chencha3/llvm-project that referenced this issue Mar 23, 2024
…5718)

When i1 true is used as an index, SExt extends it to i32 -1. This would
cause BitVector to overflow.
The language manual have specified that the index shall be treated as an
unsigned number, this patch fixes that.
(https://llvm.org/docs/LangRef.html#insertelement-instruction)

This patch fixes llvm#85717

---------

Signed-off-by: Peter Rong <PeterRong96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AMDGPU crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants