[PATCH] D26381: LibcallsShrinkWrap doesn't preserve the CFG
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 8 10:44:44 PST 2016
davide updated this revision to Diff 77214.
davide added a comment.
Updated the pipeline. Also added a comment to explain what's going on there.
https://reviews.llvm.org/D26381
Files:
lib/Transforms/Utils/LibCallsShrinkWrap.cpp
test/Transforms/InstCombine/shrinkwrap-nopreserve.ll
Index: test/Transforms/InstCombine/shrinkwrap-nopreserve.ll
===================================================================
--- /dev/null
+++ test/Transforms/InstCombine/shrinkwrap-nopreserve.ll
@@ -0,0 +1,11 @@
+; We need this pipeline because to trigger dominator info verification
+; we have to compute the dominator before libcalls-shrinkwrap and
+; have a pass which requires the dominator tree after.
+; RUN: opt -domtree -libcalls-shrinkwrap -instcombine -verify-dom-info %s
+
+define void @main() {
+ %_tmp31 = call float @acosf(float 2.000000e+00)
+ ret void
+}
+
+declare float @acosf(float)
Index: lib/Transforms/Utils/LibCallsShrinkWrap.cpp
===================================================================
--- lib/Transforms/Utils/LibCallsShrinkWrap.cpp
+++ lib/Transforms/Utils/LibCallsShrinkWrap.cpp
@@ -29,6 +29,7 @@
#include "llvm/Transforms/Utils/LibCallsShrinkWrap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
+#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Constants.h"
@@ -529,7 +530,7 @@
}
void LibCallsShrinkWrapLegacyPass::getAnalysisUsage(AnalysisUsage &AU) const {
- AU.setPreservesCFG();
+ AU.addPreserved<GlobalsAAWrapperPass>();
AU.addRequired<TargetLibraryInfoWrapperPass>();
}
@@ -561,6 +562,8 @@
bool Changed = runImpl(F, TLI);
if (!Changed)
return PreservedAnalyses::all();
- return PreservedAnalyses::none();
+ auto PA = PreservedAnalyses();
+ PA.preserve<GlobalsAA>();
+ return PA;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26381.77214.patch
Type: text/x-patch
Size: 1570 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161108/6ebef5c6/attachment.bin>
More information about the llvm-commits
mailing list