[PATCH] D65380: [InstCombine] Shift amount reassociation: shl-trunc-shl pattern
    Sanjay Patel via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Aug  6 05:38:51 PDT 2019
    
    
  
spatel added inline comments.
================
Comment at: llvm/lib/IR/Constants.cpp:1590-1594
+Constant *ConstantExpr::getZExtOrSelf(Constant *C, Type *Ty) {
+  if (C->getType() == Ty)
+    return C;
+  return getZExt(C, Ty);
+}
----------------
Would we better off copying the codegen sibling API (same type implicitly returns self)?
SelectionDAG::getZExtOrTrunc()
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:39
+
+  // There may be a truncation before the next shift; take note and ignore it.
   Instruction *Sh1;
----------------
That comment isn't clear to me.
  "If there is truncation of the shifted value, we must 
  adjust the constraints of this fold and recreate that op." ?
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65380/new/
https://reviews.llvm.org/D65380
    
    
More information about the llvm-commits
mailing list