[PATCH] D26381: LibcallsShrinkWrap doesn't preserve the CFG

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 11:27:57 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL286271: [LibcallsShrinkWrap] This pass doesn't preserve the CFG. (authored by davide).

Changed prior to commit:
  https://reviews.llvm.org/D26381?vs=77215&id=77219#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26381

Files:
  llvm/trunk/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
  llvm/trunk/test/Transforms/InstCombine/pr30929.ll


Index: llvm/trunk/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
+++ llvm/trunk/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;
 }
 }
Index: llvm/trunk/test/Transforms/InstCombine/pr30929.ll
===================================================================
--- llvm/trunk/test/Transforms/InstCombine/pr30929.ll
+++ llvm/trunk/test/Transforms/InstCombine/pr30929.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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26381.77219.patch
Type: text/x-patch
Size: 1637 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161108/77cb9f05/attachment.bin>


More information about the llvm-commits mailing list