[PATCH] D45760: Emit a left-shift instead of a power-of-two multiply for jump-tables
    Simon Dardis via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Apr 24 05:53:27 PDT 2018
    
    
  
sdardis added inline comments.
================
Comment at: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:3696-3703
+    if (llvm::isPowerOf2_32(EntrySize)) {
+      Index = DAG.getNode(
+          ISD::SHL, dl, Index.getValueType(), Index,
+          DAG.getConstant(llvm::Log2_32(EntrySize), dl, Index.getValueType()));
+    } else {
+      Index = DAG.getNode(ISD::MUL, dl, Index.getValueType(), Index,
+                          DAG.getConstant(EntrySize, dl, Index.getValueType()));
----------------
You drop the braces for this if/else pair as they're each a single statement.
Repository:
  rL LLVM
https://reviews.llvm.org/D45760
    
    
More information about the llvm-commits
mailing list