[PATCH] D53676: [WebAssembly] Lower away condition truncations for scalar selects

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 24 20:39:38 PDT 2018


tlively added a comment.

In https://reviews.llvm.org/D53676#1275284, @aheejin wrote:

> It seems only 1 can be a possible condition value from a valid LLVM IR, and if that's the case, I think what we need in this case is `UndefinedBooleanContent`. And I guess that should be the case for all other wasm instructions, but if we comment out this line <https://github.com/llvm-mirror/llvm/blob/7b105bc3a6c4795ad428e55713aedfa7edb27911/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp#L50>, a bunch of test fails... Not sure why we need that line and what makes this case exceptional. Could you check?


I checked it out. The BooleanContents value is used to describe both how bools are produced and how bools are consumed. `ZeroOrOneBooleanContent` is a correct value for WebAssembly because all of our instructions that produce bools produce either zero or one. Setting the BooleanContents to `UndefinedBooleanContent` causes LLVM to emit `and 1` after every instruction that produces a bool (or at least after instructions that produce bools that are returned from functions). That is why the tests are failing. I'm not sure why LLVM explicitly zeros the high bits instead of leaving them undefined.

I suppose ideally we would be able to separately specify that instructions that produce bools produce either zeros or ones and instructions that consume bools can consume zeros or nonzeros, rather than using a single configuration option for both producers and consumers of bools.


Repository:
  rL LLVM

https://reviews.llvm.org/D53676





More information about the llvm-commits mailing list