[all-commits] [llvm/llvm-project] a89e04: [ValueTracking] Add additional tests for computeKn...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Tue Feb 11 14:18:09 PST 2025
Branch: refs/heads/release/20.x
Home: https://github.com/llvm/llvm-project
Commit: a89e04e7f0caa28d607e38099b905063b47a88fb
https://github.com/llvm/llvm-project/commit/a89e04e7f0caa28d607e38099b905063b47a88fb
Author: Nikita Popov <npopov at redhat.com>
Date: 2025-02-11 (Tue, 11 Feb 2025)
Changed paths:
M llvm/unittests/Analysis/ValueTrackingTest.cpp
Log Message:
-----------
[ValueTracking] Add additional tests for computeKnownBits on GEPs (NFC)
These demonstrate miscompiles in the existing code.
(cherry picked from commit 3dc1ef1650c8389a6f195a474781cf2281208bed)
Commit: 5777d5df62a659e165b4df74aefae29ae01d2509
https://github.com/llvm/llvm-project/commit/5777d5df62a659e165b4df74aefae29ae01d2509
Author: Nikita Popov <npopov at redhat.com>
Date: 2025-02-11 (Tue, 11 Feb 2025)
Changed paths:
M llvm/lib/Analysis/ValueTracking.cpp
M llvm/unittests/Analysis/ValueTrackingTest.cpp
Log Message:
-----------
[ValueTracking] Fix bit width handling in computeKnownBits() for GEPs (#125532)
For GEPs, we have three bit widths involved: The pointer bit width, the
index bit width, and the bit width of the GEP operands.
The correct behavior here is:
* We need to sextOrTrunc the GEP operand to the index width *before*
multiplying by the scale.
* If the index width and pointer width differ, GEP only ever modifies
the low bits. Adds should not overflow into the high bits.
I'm testing this via unit tests because it's a bit tricky to test in IR
with InstCombine canonicalization getting in the way.
(cherry picked from commit 3bd11b502c1846afa5e1257c94b7a70566e34686)
Compare: https://github.com/llvm/llvm-project/compare/af970cd8753c...5777d5df62a6
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