[llvm] [AMDGPU] Fix use-after-erase in OpenCL printf runtime binding (PR #177356)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 23 00:02:57 PST 2026
================
@@ -416,9 +416,13 @@ bool AMDGPUPrintfRuntimeBindingImpl::lowerPrintfForGpu(Module &M) {
}
}
- // erase the printf calls
- for (auto *CI : Printfs)
+ // Erase the printf calls and replace all uses with 0, signaling success.
+ // Since OpenCL only specifies undefined behaviors and not success criteria,
+ // returning 0 sinalling success always is valid.
+ for (auto *CI : Printfs) {
+ CI->replaceAllUsesWith(ConstantInt::get(I32Ty, 0));
----------------
arsenm wrote:
I'd just skip anything that looks unexpected
https://github.com/llvm/llvm-project/pull/177356
More information about the llvm-commits
mailing list