[llvm-dev] a basic BasicAA question

Friedman, Eli via llvm-dev llvm-dev at lists.llvm.org
Thu Nov 1 11:07:34 PDT 2018


On 11/1/2018 10:54 AM, Michael Ferguson via llvm-dev wrote:
> Hi -
>
> I'm working on writing some tests for some BasicAA cases and I noticed
> something I can't explain. It's probably a detail I don't understand
> but I thought I'd ask about it since it seems to me to be a really
> simple case.
>
> If I have
>
> define void @test1(double* %P, i64 %i) {
>    %sum = add nuw nsw i64 %i, 128
>    %A = getelementptr double, double* %P, i64 %sum
>    ret void
> }
>
> in a file, let's say, tiny.ll, and I run
>
> opt-6.0 -basicaa -aa-eval -print-may-aliases -disable-output tiny.ll
> (or just opt)
>
> it prints out
>
> Function: test1: 2 pointers, 0 call sites
>    MayAlias: double* %A, double* %P
>
> Here I am surprised that it isn't able to determine that %P and %A cannot alias.
>
> Is this a case that BasicAA ignores (for one reason or another)

The relevant code in BasicAA (BasicAAResult::aliasGEP) doesn't handle 
nuw markings.

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-dev mailing list