mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
[LibcallsShrinkWrap] This pass doesn't preserve the CFG.
For example, it invalidates the domtree, causing assertions in later passes which need dominator infos. Make it preserve GlobalsAA, as suggested by Eli. Differential Revision: https://reviews.llvm.org/D26381 llvm-svn: 286271
This commit is contained in:
parent
4e7dddafdc
commit
ca68c4db42
@ -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 @@ bool LibCallsShrinkWrap::perform(CallInst *CI) {
|
||||
}
|
||||
|
||||
void LibCallsShrinkWrapLegacyPass::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesCFG();
|
||||
AU.addPreserved<GlobalsAAWrapperPass>();
|
||||
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||
}
|
||||
|
||||
@ -561,6 +562,8 @@ PreservedAnalyses LibCallsShrinkWrapPass::run(Function &F,
|
||||
bool Changed = runImpl(F, TLI);
|
||||
if (!Changed)
|
||||
return PreservedAnalyses::all();
|
||||
return PreservedAnalyses::none();
|
||||
auto PA = PreservedAnalyses();
|
||||
PA.preserve<GlobalsAA>();
|
||||
return PA;
|
||||
}
|
||||
}
|
||||
|
11
test/Transforms/InstCombine/pr30929.ll
Normal file
11
test/Transforms/InstCombine/pr30929.ll
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user