[PATCH] D51169: [NewGVN] Mark function as changed if we erase instructions.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 7 04:44:52 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL341651: [NewGVN] Mark function as changed if we erase instructions. (authored by fhahn, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D51169?vs=164217&id=164389#toc
Repository:
rL LLVM
https://reviews.llvm.org/D51169
Files:
llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
llvm/trunk/test/Transforms/NewGVN/eliminate-callsite-inline.ll
Index: llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
+++ llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
@@ -3497,9 +3497,11 @@
if (!ToErase->use_empty())
ToErase->replaceAllUsesWith(UndefValue::get(ToErase->getType()));
- if (ToErase->getParent())
- ToErase->eraseFromParent();
+ assert(ToErase->getParent() &&
+ "BB containing ToErase deleted unexpectedly!");
+ ToErase->eraseFromParent();
}
+ Changed |= !InstructionsToErase.empty();
// Delete all unreachable blocks.
auto UnreachableBlockPred = [&](const BasicBlock &BB) {
Index: llvm/trunk/test/Transforms/NewGVN/eliminate-callsite-inline.ll
===================================================================
--- llvm/trunk/test/Transforms/NewGVN/eliminate-callsite-inline.ll
+++ llvm/trunk/test/Transforms/NewGVN/eliminate-callsite-inline.ll
@@ -0,0 +1,18 @@
+; RUN: opt -inline -newgvn -S < %s | FileCheck %s
+
+; CHECK-LABEL: @f2()
+; CHECK-NEXT: ret void
+; CHECK-NOT: @f1
+
+define void @f2() {
+ call void @f1()
+ call void @f1()
+ ret void
+}
+
+define internal void @f1() #1 {
+entry:
+ ret void
+}
+
+attributes #1 = { noinline nounwind readnone }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51169.164389.patch
Type: text/x-patch
Size: 1279 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180907/003970fb/attachment.bin>
More information about the llvm-commits
mailing list