[PATCH] propagate IR-level fast-math-flags to DAG nodes

Sanjay Patel spatel at rotateright.com
Tue Apr 21 15:11:42 PDT 2015

In http://reviews.llvm.org/D8900#157594, @spatel wrote:

> In http://reviews.llvm.org/D8900#157396, @hfinkel wrote:
> > Have you tried running under valgrind and/or asan/msan? Does this happen in a debug build, or just an optimized build?
> Not yet; that's the next step. I wanted to see if there were structural objections to this patch before chasing down the errors.

Valgrind noted that the flags were being read uninitialized. I thought between bitfields, bools and shifts, I must've stepped into a pile of UB, but the actual bug was when creating the node. I was checking:

  if (Flags && mayHaveOptimizationFlags(Opcode))

We can't use the nullptr Flags to decide the type of node to allocate; if it may have opt flags, then it must be an SDNodeWithFlags. We just have to fill in default flags in that case.

I had no luck with sanitizers (not enabled with the OS X system clang? And can't build LLVM trunk with that turned on?). But it pushed me to build on Linux x86-64 where I confirmed that the sizeof(SDNode) == sizeof(SDNodeWithFlags) == 80. So again, it looks like we can use a proper software class for the flags without any size overhead.



More information about the llvm-commits mailing list