[all-commits] [llvm/llvm-project] 53f599: [InstCombine] Rebuild type-changing PHIs in Pointe...
Keshav Vinayak Jha via All-commits
all-commits at lists.llvm.org
Tue Aug 4 04:20:43 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 53f5999f0382624abdbae90df143e83c71cdb8ab
https://github.com/llvm/llvm-project/commit/53f5999f0382624abdbae90df143e83c71cdb8ab
Author: Keshav Vinayak Jha <31160700+keshavvinayak01 at users.noreply.github.com>
Date: 2026-08-04 (Tue, 04 Aug 2026)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
M llvm/test/Transforms/InstCombine/ptr-replace-alloca.ll
Log Message:
-----------
[InstCombine] Rebuild type-changing PHIs in PointerReplacer (#212429)
PointerReplacer mutates PHI types when replacing an alloca with a
pointer in another address space. Mutating a value type in place can
invalidate existing users whose result types or operand constraints were
formed from the original pointer type.
For example:
```
%p = phi ptr addrspace(5) [ %a, %bb0 ], [ %b, %bb1 ]
%g = getelementptr i8, ptr addrspace(5) %p, i64 1
```
Changing `%p` to `ptr addrspace(4)` leaves the existing GEP result in
`AS5` while its pointer operand is now in `AS4`. (This is what exposed
the bug). This triggered:
https://github.com/llvm/llvm-project/blob/0bcff14b1740cf32f9e0983726238dcf353c6ac8/llvm/lib/IR/Operator.cpp#L129-L131
Create a new PHI when the replacement changes type so existing users
remain attached to the original well-typed graph while PointerReplacer
builds their replacements. Preserve in-place operand updates when the
PHI type is unchanged.
Assisted-by: Codex
---------
Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha at gmail.com>
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