[llvm] 47aec80 - [NFC][InstCombine] Negator: add a comment about negating exact arithmentic shift

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 13:45:33 PDT 2020


Author: Roman Lebedev
Date: 2020-08-06T23:37:16+03:00
New Revision: 47aec80e4afc8e3746e09f4c9d309cf8941f68cc

URL: https://github.com/llvm/llvm-project/commit/47aec80e4afc8e3746e09f4c9d309cf8941f68cc
DIFF: https://github.com/llvm/llvm-project/commit/47aec80e4afc8e3746e09f4c9d309cf8941f68cc.diff

LOG: [NFC][InstCombine] Negator: add a comment about negating exact arithmentic shift

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp b/llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
index bd3613c89c22..9033f389cd67 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
@@ -184,6 +184,10 @@ LLVM_NODISCARD Value *Negator::visitImpl(Value *V, unsigned Depth) {
       }
       return BO;
     }
+    // While we could negate exact arithmetic shift:
+    //   ashr exact %x, C  -->   sdiv exact i8 %x, -1<<C
+    // iff C != 0 and C u< bitwidth(%x), we don't want to,
+    // because division is *THAT* much worse than a shift.
     break;
   }
   case Instruction::SExt:


        


More information about the llvm-commits mailing list