[PATCH] D65380: [InstCombine] Shift amount reassociation: shl-trunc-shl pattern
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 6 08:23:25 PDT 2019
lebedev.ri marked 4 inline comments as done.
lebedev.ri added a comment.
Thank you for the review!
================
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);
+}
----------------
spatel wrote:
> lebedev.ri wrote:
> > spatel wrote:
> > > Would we better off copying the codegen sibling API (same type implicitly returns self)?
> > >
> > > SelectionDAG::getZExtOrTrunc()
> > I'm not sure what you have in mind here, `ConstantExpr::getZExt()`
> > will (rightfully) assert if zext is unsuitable there.
> > `ConstantExpr::getBitCast()` won't, so i suppose i could just use it,
> > but i really don't need bitcast here, i really want either zext or nothing.
> >
> > Please can you be more specific as to what you envision here?
> I'm imagining that we'll eventually (or might already) want the flexibility of returning a constant of arbitrary type (wider or narrower) since that's used in codegen regularly. But that can be a follow-on if we want.
Actually, looking how much extra wrappers there are around e.g. `getZExtOrBitCast()`,
i think i'm just gonna use it here, not sure i want to add all those and i wouldn't want to leave them out.
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