[llvm] [IR] Only follow ptr/ptr-vector sources in stripAndAccumulateConstantOffsets bitcasts (PR #203356)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 13 09:19:16 PDT 2026
================
@@ -2011,4 +2011,54 @@ TEST(InstructionsTest, StripAndAccumulateConstantOffset) {
EXPECT_TRUE(Offset.isZero());
}
+// stripAndAccumulateConstantOffsets must only look through ptr->ptr (or
+// ptr-vector) bitcasts, matching stripPointerCastsAndOffsets. Following a
+// bitcast from a non-pointer (e.g. lossless iN->ptr) would leave a non-pointer
+// V and violate the strip loop invariant.
+TEST(InstructionsTest, StripAndAccumulateConstantOffsets_ThroughPtrBitCast) {
----------------
nikic wrote:
https://github.com/llvm/llvm-project/issues/203695 seems like a very simple way to trigger the issue in a lit test.
https://github.com/llvm/llvm-project/pull/203356
More information about the llvm-commits
mailing list