[llvm-dev] anyone want to help tune up computeKnownBits()?
Duncan Sands via llvm-dev
llvm-dev at lists.llvm.org
Tue Sep 1 09:02:24 PDT 2015
Hi John, I'm amazed the following two were missed. They seem like the first to
implement.
> if the little end of a word contains some contiguous zeros, they'll still be
> there after a shl:
>
> %0:i32 = var
> %1:i32 = shl 8:i32, %0
> infer %1
>
> known from LLVM: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> known from Souper: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx000
> --------------------------------------------------------------------
>
> if the big end of a word contains some zeros, lshr can't make them go away:
>
> %0:i64 = var
> %1:i64 = lshr 233:i64, %0
> infer %1
>
> known from LLVM: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> known from Souper:
00000000000000000000000000000000000000000000000000000000xxxxxxxx
As for looking through phis:
> do we want to follow phis a bit more aggressively?
>
> %0 = block 2
> %1 = block 2
> %2:i64 = phi %1, 0:i64, 1:i64
> %3:i64 = phi %0, 1:i64, %2
> infer %3
>
> known from LLVM: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> known from Souper: 000000000000000000000000000000000000000000000000000000000000000x
my guess is that this would be a win: optimizations on phis usually pay off.
Ciao, Duncan.
More information about the llvm-dev
mailing list