diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-04-24 20:25:01 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-04-24 20:25:01 +0000 |
commit | 4474652c95bd7544319d8ed25d0e068b3d454537 (patch) | |
tree | 9c26ccd4088bc79ad6af86ea5ea146bb93347bf7 /llvm/lib/Transforms/Scalar/StructurizeCFG.cpp | |
parent | ca81fbcadbb5c1648973f4cbfee5f60f198b6ee3 (diff) | |
download | bcm5719-llvm-4474652c95bd7544319d8ed25d0e068b3d454537.tar.gz bcm5719-llvm-4474652c95bd7544319d8ed25d0e068b3d454537.zip |
Revert "StructurizeCFG: Directly invert cmp instructions"
This reverts commit r300732. This breaks a few tests.
I think the problem is related to adding more uses of
the condition that don't yet exist at this point.
llvm-svn: 301242
Diffstat (limited to 'llvm/lib/Transforms/Scalar/StructurizeCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/StructurizeCFG.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp index 659353e912f..49ce0262c97 100644 --- a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp +++ b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp @@ -352,20 +352,10 @@ Value *StructurizeCFG::invert(Value *Condition) { if (Instruction *Inst = dyn_cast<Instruction>(Condition)) { // Third: Check all the users for an invert BasicBlock *Parent = Inst->getParent(); - for (User *U : Condition->users()) { - if (Instruction *I = dyn_cast<Instruction>(U)) { + for (User *U : Condition->users()) + if (Instruction *I = dyn_cast<Instruction>(U)) if (I->getParent() == Parent && match(I, m_Not(m_Specific(Condition)))) return I; - } - } - - // Avoid creating a new instruction in the common case of a compare. - if (CmpInst *Cmp = dyn_cast<CmpInst>(Inst)) { - if (Cmp->hasOneUse()) { - Cmp->setPredicate(Cmp->getInversePredicate()); - return Cmp; - } - } // Last option: Create a new instruction return BinaryOperator::CreateNot(Condition, "", Parent->getTerminator()); |