[all-commits] [llvm/llvm-project] 48a21e: [RISCV] Fix a correctness issue in optimizeCondBra...
Craig Topper via All-commits
all-commits at lists.llvm.org
Tue Jun 24 15:45:27 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 48a21e69159a7e6698cde380f6d64274c6569f29
https://github.com/llvm/llvm-project/commit/48a21e69159a7e6698cde380f6d64274c6569f29
Author: Craig Topper <craig.topper at sifive.com>
Date: 2025-06-24 (Tue, 24 Jun 2025)
Changed paths:
M llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
M llvm/test/CodeGen/RISCV/branch-opt.mir
Log Message:
-----------
[RISCV] Fix a correctness issue in optimizeCondBranch. Prevent optimizing compare with x0. NFC (#145440)
We were incorrectly changing -1 to 0 for unsigned compares in case 1.
The comment incorrectly said UINT64_MAX is bigger than INT64_MAX, but
we were doing a signed compare and UINT64_MAX is smaller than INT64_MAX
in signed space.
Prevent changing 0 constants since we can use x0. The test cases
for these are contrived to use addi rd, x0, 0. We're more likely
to have a COPY from x0 which we already don't optimize for other
reasons.
Check if registers are virtual before calling hasOneUse. The use count
for physical registers is meaningless.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list