[PATCH] Fix urem instruction with power of two to compute known bit.

Andrey Kuharev an.kuharev at gmail.com
Fri May 23 00:33:09 PDT 2014


I check asm output in new version by
llc -mtriple=i386-pc-win32 computeKnownBits_urem.ll
Result is very simple and right:



  _main:                                  # @main
  # BB#0:                                 # %entry
  	pushl	%eax
  	movl	$1, (%esp)
  	movl	$1, %eax
  	popl	%edx
  	retl
  

	
Algorithm is sufficiently complex and the same result in asm
can be obtained by the different ways with slightly different IR file.
Changed code works when simplification begins from not "urem" instruction.
Instructions "and" and "or" set KnownOne and KnownZero mutually.
Instruction "load" in computeKnownBits cuts initialization of %a.
Result of changed code work is simplification with message 
  Replacing.2 ....... 
if KnownOne and KnownZero leads to definite result 
then next message is 
  With: 0x{{[0-9a-f]+}}: i32 = Constant ....

http://reviews.llvm.org/D3823






More information about the llvm-commits mailing list