mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
ifcvt should ignore cfg where true and false successors are the same.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73423 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -547,7 +547,11 @@ void IfConverter::ScanInstructions(BBInfo &BBI) {
|
|||||||
// fallthrough.
|
// fallthrough.
|
||||||
if (!BBI.FalseBB)
|
if (!BBI.FalseBB)
|
||||||
BBI.FalseBB = findFalseBlock(BBI.BB, BBI.TrueBB);
|
BBI.FalseBB = findFalseBlock(BBI.BB, BBI.TrueBB);
|
||||||
assert(BBI.FalseBB && "Expected to find the fallthrough block!");
|
if (!BBI.FalseBB) {
|
||||||
|
// Malformed bcc? True and false blocks are the same?
|
||||||
|
BBI.IsUnpredicable = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then scan all the instructions.
|
// Then scan all the instructions.
|
||||||
@@ -663,6 +667,13 @@ IfConverter::BBInfo &IfConverter::AnalyzeBlock(MachineBasicBlock *BB,
|
|||||||
return BBI;
|
return BBI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not ifcvt if true and false fallthrough blocks are the same.
|
||||||
|
if (!BBI.FalseBB) {
|
||||||
|
BBI.IsBeingAnalyzed = false;
|
||||||
|
BBI.IsAnalyzed = true;
|
||||||
|
return BBI;
|
||||||
|
}
|
||||||
|
|
||||||
BBInfo &TrueBBI = AnalyzeBlock(BBI.TrueBB, Tokens);
|
BBInfo &TrueBBI = AnalyzeBlock(BBI.TrueBB, Tokens);
|
||||||
BBInfo &FalseBBI = AnalyzeBlock(BBI.FalseBB, Tokens);
|
BBInfo &FalseBBI = AnalyzeBlock(BBI.FalseBB, Tokens);
|
||||||
|
|
||||||
|
12
test/CodeGen/ARM/ifcvt9.ll
Normal file
12
test/CodeGen/ARM/ifcvt9.ll
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
; RUN: llvm-as < %s | llc -march=arm
|
||||||
|
|
||||||
|
define fastcc void @t() nounwind {
|
||||||
|
entry:
|
||||||
|
br i1 undef, label %bb.i.i3, label %growMapping.exit
|
||||||
|
|
||||||
|
bb.i.i3: ; preds = %entry
|
||||||
|
unreachable
|
||||||
|
|
||||||
|
growMapping.exit: ; preds = %entry
|
||||||
|
unreachable
|
||||||
|
}
|
Reference in New Issue
Block a user