[PATCH] D71474: [TableGen] Introduce an if/then/else statement.

Simon Tatham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 2 04:55:22 PST 2020


simon_tatham added a comment.

> Without introducing a scope, the above is presumably valid but in a rather surprising way.

Er, wow, yes – when I tried it, it surprised //me!//

I had expected that if the `then` clause wasn't taken then a definition of `bar` from outside the multiclass would be used in place of the skipped definition (or an error would happen if there wasn't one). But in fact the definition wasn't skipped at all, which I agree is more surprising even than I expected. So no wonder it also doesn't work to define the same variable in both `then` and `else` branches (which I //intended// to work, but you're right that it currently doesn't).

Luckily I don't have to solve that mystery, since both of you agree that the behavior I intended was the wrong behavior anyway, and the one you're asking for is much easier to get right :-)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71474/new/

https://reviews.llvm.org/D71474





More information about the llvm-commits mailing list