[llvm] r250660 - Preserve CFG in MergedLoadStoreMotion. This fixes PR24426.
Jakub Staszak via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 18 12:34:10 PDT 2015
Author: kuba
Date: Sun Oct 18 14:34:10 2015
New Revision: 250660
URL: http://llvm.org/viewvc/llvm-project?rev=250660&view=rev
Log:
Preserve CFG in MergedLoadStoreMotion. This fixes PR24426.
Added:
llvm/trunk/test/Transforms/GVN/pr24426.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp?rev=250660&r1=250659&r2=250660&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp Sun Oct 18 14:34:10 2015
@@ -118,6 +118,7 @@ public:
private:
// This transformation requires dominator postdominator info
void getAnalysisUsage(AnalysisUsage &AU) const override {
+ AU.setPreservesCFG();
AU.addRequired<TargetLibraryInfoWrapperPass>();
AU.addRequired<AAResultsWrapperPass>();
AU.addPreserved<GlobalsAAWrapperPass>();
Added: llvm/trunk/test/Transforms/GVN/pr24426.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/pr24426.ll?rev=250660&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/GVN/pr24426.ll (added)
+++ llvm/trunk/test/Transforms/GVN/pr24426.ll Sun Oct 18 14:34:10 2015
@@ -0,0 +1,18 @@
+; RUN: opt < %s -memcpyopt -mldst-motion -gvn -S | FileCheck %s
+
+declare void @check(i8)
+
+declare void @write(i8* %res)
+
+define void @test1() {
+ %1 = alloca [10 x i8]
+ %2 = bitcast [10 x i8]* %1 to i8*
+ call void @write(i8* %2)
+ %3 = load i8, i8* %2
+
+; CHECK-NOT: undef
+ call void @check(i8 %3)
+
+ ret void
+}
+
More information about the llvm-commits
mailing list