[all-commits] [llvm/llvm-project] b9bba6: [BasicAA] Track nuw through decomposed expressions...

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Sep 2 03:11:25 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b9bba6ca9fc62c5ae3ee402196b11a523a500fdc
      https://github.com/llvm/llvm-project/commit/b9bba6ca9fc62c5ae3ee402196b11a523a500fdc
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-09-02 (Mon, 02 Sep 2024)

  Changed paths:
    M llvm/lib/Analysis/BasicAliasAnalysis.cpp
    M llvm/test/Analysis/BasicAA/gep-nuw-alias.ll

  Log Message:
  -----------
  [BasicAA] Track nuw through decomposed expressions (#106512)

When we decompose the GEP offset expression, and the arithmetic is not
performed using nuw operations, we cannot retain the nuw flag on the
decomposed GEP.

For example, if we have `gep nuw p, (a-1)`, this is not at all the same
as `gep nuw (gep nuw p, a), -1`.

Fix this by tracking NUW through linear expression decomposition,
similarly to what we already do for the NSW flag.

This fixes the miscompilation reported in
https://github.com/llvm/llvm-project/pull/105496#issuecomment-2315322220.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list