Skip to content

Commit

Permalink
[BypassSlowDivision] Simplify partially-tautological if statement.
Browse files Browse the repository at this point in the history
if (A || (B && A)) --> if (A).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287061 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Justin Lebar committed Nov 16, 2016
1 parent d021118 commit c18d950
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/Transforms/Utils/BypassSlowDivision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,9 @@ static bool insertFastDiv(Instruction *I, IntegerType *BypassType,
Value *Dividend = I->getOperand(0);
Value *Divisor = I->getOperand(1);

if (isa<ConstantInt>(Divisor) ||
(isa<ConstantInt>(Dividend) && isa<ConstantInt>(Divisor))) {
// Operations with immediate values should have
// been solved and replaced during compile time.
if (isa<ConstantInt>(Divisor)) {
// Division by a constant should have been been solved and replaced earlier
// in the pipeline.
return false;
}

Expand Down

0 comments on commit c18d950

Please sign in to comment.