[PATCH] D144939: [SimplifyCFG] Handle MD_noundef when hoisting common codes
luxufan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 27 20:51:42 PST 2023
StephenFan created this revision.
StephenFan added a reviewer: nikic.
Herald added a subscriber: hiraditya.
Herald added a project: All.
StephenFan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D144939
Files:
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/Transforms/SimplifyCFG/hoist-with-range.ll
Index: llvm/test/Transforms/SimplifyCFG/hoist-with-range.ll
===================================================================
--- llvm/test/Transforms/SimplifyCFG/hoist-with-range.ll
+++ /dev/null
@@ -1,20 +0,0 @@
-; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -hoist-common-insts=true -S | FileCheck %s
-
-define void @foo(i1 %c, ptr %p) {
-; CHECK: if:
-; CHECK-NEXT: load i8, ptr %p, align 1, !range !0
-; CHECK: !0 = !{i8 0, i8 1, i8 3, i8 5}
-if:
- br i1 %c, label %then, label %else
-then:
- %t = load i8, ptr %p, !range !0
- br label %out
-else:
- %e = load i8, ptr %p, !range !1
- br label %out
-out:
- ret void
-}
-
-!0 = !{ i8 0, i8 1 }
-!1 = !{ i8 3, i8 5 }
Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
===================================================================
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1619,7 +1619,6 @@
I2->replaceAllUsesWith(I1);
I1->andIRFlags(I2);
unsigned KnownIDs[] = {LLVMContext::MD_tbaa,
- LLVMContext::MD_range,
LLVMContext::MD_fpmath,
LLVMContext::MD_invariant_load,
LLVMContext::MD_nonnull,
@@ -1629,7 +1628,8 @@
LLVMContext::MD_dereferenceable_or_null,
LLVMContext::MD_mem_parallel_loop_access,
LLVMContext::MD_access_group,
- LLVMContext::MD_preserve_access_index};
+ LLVMContext::MD_preserve_access_index,
+ LLVMContext::MD_noundef};
combineMetadata(I1, I2, KnownIDs, true);
// I1 and I2 are being combined into a single instruction. Its debug
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144939.501009.patch
Type: text/x-patch
Size: 1859 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230228/6155ed0a/attachment.bin>
More information about the llvm-commits
mailing list