llvm / llvm/llvm-project

[X86] Using (SUB32ri GR32:$src1, -128) for (add X, 128) incorrectly preserves NUW flag

Open
#160,217 6 comments 0 reactions 1 assignee Claimed by @hesam-oxe View on GitHub
backend:X86 miscompilation
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

If the ADD instruction has an NUW flag, it is incorrectly copied into the MIR SUB instructions. If any MIR transforms use this flag, they may get incorrect information.

There are many such patterns like this with the same issue.

CC: @rksimon @phoebewang @arsenm

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.