[PATCH] Introduce bitset metadata format and bitset lowering pass.

Peter Collingbourne peter at pcc.me.uk
Thu Feb 19 11:22:20 PST 2015

Comment at: lib/Transforms/IPO/LowerBitSets.cpp:42
@@ +41,3 @@
+  if ((Offset - ByteOffset) % (1 << AlignLog2) != 0)
+    return false;
jfb wrote:
> 1 should technically be a `uint64_t` too, though if the current code triggered UB things would be awful in other ways!
Thanks, fixed and added unit tests for this function.

Comment at: lib/Transforms/IPO/LowerBitSets.cpp:236
@@ +235,3 @@
+                                      Value *BitOffset) {
+  if (BSI.Bits.size() <= 8) {
+    // If the bit set is sufficiently small, we can avoid a load by bit testing
jfb wrote:
> I'm mildly disappointed that the optimizer doesn't do this by taking into account ISA-specific sizes (and then removing the dead global because its address isn't taken).
This should in principle be possible, but this pass runs late so in any case it seems best to directly generate the IR we need.



More information about the llvm-commits mailing list