Skip to content
Commit ec864a53 authored by Mingming Liu's avatar Mingming Liu
Browse files

[AArch64][PeepholeOpt]Optimize ALU + compare to flag-setting ALU

The motivating example is in https://godbolt.org/z/45nbdYMK9
- For this example, `subs` is generated for the good case; `sub` followed by `cmp` is generated for the bad case. Since signed overflow is undefined behavior in C/C++ (indicated as `nsw` flag in LLVM IR), `subs` should be generated for the good case as well.

This patch relaxes one restriction from "quit optimization when V is used" to "continue if MI produces poison value when signed overflow occurs". This is not meant to be C/C++ specific since it looks at 'NoSWrap' since it looks at MachineInstr flags.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D146820
parent a5ce2da0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment