[PATCH] D149237: [Mem2Reg] !nonnull and !noundef are enough for creating assume
luxufan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 25 23:26:18 PDT 2023
StephenFan created this revision.
StephenFan added reviewers: nikic, goldstein.w.n.
Herald added subscribers: hoy, hiraditya.
Herald added a project: All.
StephenFan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The behavior of violating !nonnull and !noundef is immediate undefined
behavior, that's enough to create a non-null assumption.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149237
Files:
llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
Index: llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
===================================================================
--- llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -410,8 +410,7 @@
// returns poison while assume violations are immediate undefined behavior,
// we can only do this if the value is known non-poison.
if (AC && LI->getMetadata(LLVMContext::MD_nonnull) &&
- LI->getMetadata(LLVMContext::MD_noundef) &&
- !isKnownNonZero(Val, DL, 0, AC, LI, DT))
+ LI->getMetadata(LLVMContext::MD_noundef))
addAssumeNonNull(AC, LI);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149237.517069.patch
Type: text/x-patch
Size: 645 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230426/b8d8d89d/attachment.bin>
More information about the llvm-commits
mailing list