[PATCH] D77403: [AssumeBundles] preserve knowledge in DCE
Tyker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 3 08:35:18 PDT 2020
Tyker created this revision.
Tyker added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77403
Files:
llvm/lib/Transforms/Scalar/DCE.cpp
llvm/test/Transforms/DCE/basic-preservation.ll
Index: llvm/test/Transforms/DCE/basic-preservation.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/DCE/basic-preservation.ll
@@ -0,0 +1,11 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -dce -S --enable-knowledge-retention < %s | FileCheck %s
+
+define void @test(i32* %P) {
+; CHECK-LABEL: @test(
+; CHECK-NEXT: call void @llvm.assume(i1 true) [ "dereferenceable"(i32* [[P:%.*]], i64 4), "nonnull"(i32* [[P]]) ]
+; CHECK-NEXT: ret void
+;
+ %a = load i32, i32* %P
+ ret void
+}
Index: llvm/lib/Transforms/Scalar/DCE.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/DCE.cpp
+++ llvm/lib/Transforms/Scalar/DCE.cpp
@@ -25,6 +25,7 @@
#include "llvm/Pass.h"
#include "llvm/Support/DebugCounter.h"
#include "llvm/Transforms/Scalar.h"
+#include "llvm/Transforms/Utils/AssumeBundleBuilder.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Local.h"
using namespace llvm;
@@ -127,6 +128,7 @@
return false;
salvageDebugInfo(*I);
+ salvageKnowledge(I);
// Null out all of the instruction's operands to see if any operand becomes
// dead as we go.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77403.254813.patch
Type: text/x-patch
Size: 1274 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200403/1331b8cc/attachment.bin>
More information about the llvm-commits
mailing list