[llvm] 876174f - [InstCombine] Test for ephemeral nonnull load. (NFC)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 21 23:35:06 PST 2025
Author: Andreas Jonson
Date: 2025-02-22T08:34:59+01:00
New Revision: 876174ffd7533dc220f94721173bb767b659fa7f
URL: https://github.com/llvm/llvm-project/commit/876174ffd7533dc220f94721173bb767b659fa7f
DIFF: https://github.com/llvm/llvm-project/commit/876174ffd7533dc220f94721173bb767b659fa7f.diff
LOG: [InstCombine] Test for ephemeral nonnull load. (NFC)
Added:
Modified:
llvm/test/Transforms/InstCombine/assume.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/assume.ll b/llvm/test/Transforms/InstCombine/assume.ll
index 0007cc1518730..90fa9e680bb1e 100644
--- a/llvm/test/Transforms/InstCombine/assume.ll
+++ b/llvm/test/Transforms/InstCombine/assume.ll
@@ -581,6 +581,23 @@ not_taken:
ret i1 %control
}
+define void @nonnull_only_ephemeral_use(ptr %p) {
+; DEFAULT-LABEL: @nonnull_only_ephemeral_use(
+; DEFAULT-NEXT: [[A:%.*]] = load ptr, ptr [[P:%.*]], align 8
+; DEFAULT-NEXT: [[CMP:%.*]] = icmp ne ptr [[A]], null
+; DEFAULT-NEXT: tail call void @llvm.assume(i1 [[CMP]])
+; DEFAULT-NEXT: ret void
+;
+; BUNDLES-LABEL: @nonnull_only_ephemeral_use(
+; BUNDLES-NEXT: [[A:%.*]] = load ptr, ptr [[P:%.*]], align 8
+; BUNDLES-NEXT: call void @llvm.assume(i1 true) [ "nonnull"(ptr [[A]]) ]
+; BUNDLES-NEXT: ret void
+;
+ %a = load ptr, ptr %p
+ %cmp = icmp ne ptr %a, null
+ tail call void @llvm.assume(i1 %cmp)
+ ret void
+}
define void @always_true_assumption() {
; CHECK-LABEL: @always_true_assumption(
More information about the llvm-commits
mailing list