mirror of
https://github.com/RPCSX/llvm.git
synced 2025-04-10 12:11:13 +00:00
Keep CodeGenPrepare from preserving the domtree.
CGP modifies the domtree in some cases, so saying that it preserves the domtree is a lie. We'll be able to selectively preserve it with the new pass manager. Differential Revision: http://reviews.llvm.org/D16893 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264099 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a31e891389
commit
58cad7988f
@ -158,7 +158,7 @@ class TypePromotionTransaction;
|
|||||||
const char *getPassName() const override { return "CodeGen Prepare"; }
|
const char *getPassName() const override { return "CodeGen Prepare"; }
|
||||||
|
|
||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
AU.addPreserved<DominatorTreeWrapperPass>();
|
// FIXME: When we can selectively preserve passes, preserve the domtree.
|
||||||
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||||
AU.addRequired<TargetTransformInfoWrapperPass>();
|
AU.addRequired<TargetTransformInfoWrapperPass>();
|
||||||
}
|
}
|
||||||
@ -5277,6 +5277,7 @@ bool CodeGenPrepare::optimizeBlock(BasicBlock &BB, bool& ModifiedDT) {
|
|||||||
for (auto &I : reverse(BB)) {
|
for (auto &I : reverse(BB)) {
|
||||||
if (makeBitReverse(I, *DL, *TLI)) {
|
if (makeBitReverse(I, *DL, *TLI)) {
|
||||||
MadeBitReverse = MadeChange = true;
|
MadeBitReverse = MadeChange = true;
|
||||||
|
ModifiedDT = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
41
test/Transforms/CodeGenPrepare/dom-tree.ll
Normal file
41
test/Transforms/CodeGenPrepare/dom-tree.ll
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
; RUN: opt -S -loop-unroll -codegenprepare < %s -domtree -analyze | FileCheck %s
|
||||||
|
;
|
||||||
|
; Checks that the dom tree is properly invalidated after an operation that will
|
||||||
|
; invalidate it in CodeGenPrepare. If the domtree isn't properly invalidated,
|
||||||
|
; this will likely segfault, or print badref.
|
||||||
|
|
||||||
|
; CHECK-NOT: <badref>
|
||||||
|
|
||||||
|
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
|
||||||
|
target triple = "armv7--linux-gnueabihf"
|
||||||
|
|
||||||
|
define i32 @f(i32 %a) #0 {
|
||||||
|
entry:
|
||||||
|
br label %for.body
|
||||||
|
|
||||||
|
for.cond.cleanup:
|
||||||
|
ret i32 %or
|
||||||
|
|
||||||
|
for.body:
|
||||||
|
%i.08 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
|
||||||
|
%b.07 = phi i32 [ 0, %entry ], [ %or, %for.body ]
|
||||||
|
%shr = lshr i32 %a, %i.08
|
||||||
|
%and = and i32 %shr, 1
|
||||||
|
%sub = sub nuw nsw i32 31, %i.08
|
||||||
|
%shl = shl i32 %and, %sub
|
||||||
|
%or = or i32 %shl, %b.07
|
||||||
|
%inc = add nuw nsw i32 %i.08, 1
|
||||||
|
%exitcond = icmp eq i32 %inc, 32
|
||||||
|
br i1 %exitcond, label %for.cond.cleanup, label %for.body, !llvm.loop !3
|
||||||
|
}
|
||||||
|
|
||||||
|
attributes #0 = { norecurse nounwind readnone "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="cortex-a8" "target-features"="+dsp,+neon,+vfp3" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||||
|
|
||||||
|
!llvm.module.flags = !{!0, !1}
|
||||||
|
!llvm.ident = !{!2}
|
||||||
|
|
||||||
|
!0 = !{i32 1, !"wchar_size", i32 4}
|
||||||
|
!1 = !{i32 1, !"min_enum_size", i32 4}
|
||||||
|
!2 = !{!"clang version 3.8.0 (http://llvm.org/git/clang.git b7441a0f42c43a8eea9e3e706be187252db747fa)"}
|
||||||
|
!3 = distinct !{!3, !4}
|
||||||
|
!4 = !{!"llvm.loop.unroll.full"}
|
Loading…
x
Reference in New Issue
Block a user