summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/Reassociate
diff options
context:
space:
mode:
authorMikael Holmen <mikael.holmen@ericsson.com>2017-06-27 05:32:13 +0000
committerMikael Holmen <mikael.holmen@ericsson.com>2017-06-27 05:32:13 +0000
commit37b5120a9aea9629859338d3cc128568a35089eb (patch)
treec95561fb7a5354aa9255704803db7c6ddde32f8e /llvm/test/Transforms/Reassociate
parent5102028f63b585bab42b2641bc9fcce71bb6ca99 (diff)
downloadbcm5719-llvm-37b5120a9aea9629859338d3cc128568a35089eb.tar.gz
bcm5719-llvm-37b5120a9aea9629859338d3cc128568a35089eb.zip
[Reassociate] Make sure EraseInst sets MadeChange
Summary: EraseInst didn't report that it made IR changes through MadeChange. It is essential that changes to the IR are reported correctly, since for example ReassociatePass::run() will indicate that all analyses are preserved otherwise. And the CGPassManager determines if the CallGraph is up-to-date based on status from InstructionCombiningPass::runOnFunction(). Reviewers: craig.topper, rnk, davide Reviewed By: rnk, davide Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34616 llvm-svn: 306368
Diffstat (limited to 'llvm/test/Transforms/Reassociate')
-rw-r--r--llvm/test/Transforms/Reassociate/erase_inst_made_change.ll29
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/test/Transforms/Reassociate/erase_inst_made_change.ll b/llvm/test/Transforms/Reassociate/erase_inst_made_change.ll
new file mode 100644
index 00000000000..febb9447e2b
--- /dev/null
+++ b/llvm/test/Transforms/Reassociate/erase_inst_made_change.ll
@@ -0,0 +1,29 @@
+; RUN: opt < %s -inline -reassociate -S | FileCheck %s
+
+; This test case exposed a bug in reassociate where EraseInst's
+; removal of a dead call wasn't recognized as changing the IR.
+; So when runOnFunction propagated the "made changes" upwards
+; to the CallGraphSCCPass it signalled that no changes had been
+; made, so CallGraphSCCPass assumed that the old CallGraph,
+; as known by that pass manager, still was up-to-date.
+;
+; This was detected as an assert when trying to remove the
+; no longer used function 'bar' (due to incorrect reference
+; count in the CallGraph).
+
+define void @foo() {
+; CHECK-LABEL: @foo(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: ret void
+entry:
+ call void @bar()
+ ret void
+}
+
+define internal void @bar() noinline nounwind readnone {
+; CHECK-NOT: bar
+entry:
+ ret void
+}
+
+
OpenPOWER on IntegriCloud