Sending to cfe-commits. Sorry for the noise on llvm-commits. 2012/3/13 Rafael Espíndola <[email protected]>: > In the testcase of pr12251 we use a i8* for loading a boolean value: > > %3 = load i8* %2 > %4 = trunc i8 %3 to i > > The problem then is that LLVM has no way of knowing that %3 can only > be 0 or 1. A C file using uint8_t would have compiled to the same IL. > > It would be nice to have a general way of telling LLVM that a value is > known to be in a range, but for the specific cases of booleans we can > do better by just using a more restrictive type. This patch changes > clang to use i1 pointers for doing the loads and stores. This changes > the generated code from > > movb (%rdi), %al > andb $1, %al > ret > > to just > > movb (%rdi), %al > ret > > I think the idea can be extended for systems that use 32 bit booleans. > We would just have to be careful with endianess. I got the idea from > http://llvm.org/bugs/show_bug.cgi?id=8730#c3. > > Is this patch OK? > > Cheers, > Rafael
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
