[llvm-commits] [llvm] r153423 - in /llvm/trunk: lib/Analysis/InstructionSimplify.cpp lib/Analysis/ValueTracking.cpp test/Transforms/InstSimplify/pr12251.ll
Duncan Sands
baldrick at free.fr
Tue Mar 27 01:01:43 PDT 2012
Hi Rafael,
On 26/03/12 17:58, Rafael EspĂndola wrote:
>> Why can't this just be trunc? We know that we have an i8 which contains
>> either '0' or '1'... Am I missing something?
>
> It can be a trunc. In fact that is what clang starts with when
> producing the "tobool" variables. What is missing here is making
> codegen use the range metadata to codegen icmp (or trunc if we make
> that the canonical representation) to nothing in this case.
I guess SelectionDAGBuilder could generate AssertSext/AssertZext nodes on the
result of loads with range metadata. That said, these assert nodes are not a
great design if you ask me (they can impede other optimizations) so it would
be nice to have something better in the long term; but for the moment they
should do the trick.
Ciao, Duncan.
More information about the llvm-commits
mailing list