[llvm] r287061 - [BypassSlowDivision] Simplify partially-tautological if statement.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 16:44:43 PST 2016


Author: jlebar
Date: Tue Nov 15 18:44:43 2016
New Revision: 287061

URL: http://llvm.org/viewvc/llvm-project?rev=287061&view=rev
Log:
[BypassSlowDivision] Simplify partially-tautological if statement.

if (A || (B && A)) --> if (A).

Modified:
    llvm/trunk/lib/Transforms/Utils/BypassSlowDivision.cpp

Modified: llvm/trunk/lib/Transforms/Utils/BypassSlowDivision.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BypassSlowDivision.cpp?rev=287061&r1=287060&r2=287061&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/BypassSlowDivision.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/BypassSlowDivision.cpp Tue Nov 15 18:44:43 2016
@@ -83,10 +83,9 @@ static bool insertFastDiv(Instruction *I
   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;
   }
 




More information about the llvm-commits mailing list