[PATCH] D32684: [X86] Adding new LLVM TableGen backend that generates the X86 backend memory folding tables.

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 19 06:54:06 PDT 2017


RKSimon added inline comments.


================
Comment at: utils/TableGen/X86FoldTablesEmitter.cpp:257
+  for (unsigned i = 0, e = B->getNumBits(); i != e; ++i) {
+    if (BitInit *Bit = cast<BitInit>(B->getBit(i)))
+      Value |= uint64_t(Bit->getValue()) << i;
----------------
aymanmus wrote:
> RKSimon wrote:
> > Shouldn't this be dyn_cast if you want it to fail gracefully? Otherwise possibly replace that PrintFatalError with an assertion at the start of the loop?
> It was a dynamic cast, but then @filcab noted that we can't expect getBit() to return something that is not a BitInit.
> I personally agree with him.
OK - but those cast<BitInit> can't fail so the if()'s should be removed


https://reviews.llvm.org/D32684





More information about the llvm-commits mailing list