From 63adbb9a0ed9a40fc47c72502754d88d04ede1e0 Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Sun, 9 Feb 2020 20:21:56 -0600 Subject: [PATCH] [Attributor][FIX] Remove FIXME that seems outdated The change is performed as stated by the FIXME and the tests are adjusted. All changes look fine to me and values can be inferred as undef without it being an error. --- llvm/lib/Transforms/IPO/Attributor.cpp | 4 +--- llvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll | 2 +- llvm/test/Transforms/Attributor/dereferenceable-1.ll | 4 ++-- llvm/test/Transforms/Attributor/undefined_behavior.ll | 5 ++--- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp index d8d3108d75dc..da5260bb0c94 100644 --- a/llvm/lib/Transforms/IPO/Attributor.cpp +++ b/llvm/lib/Transforms/IPO/Attributor.cpp @@ -4408,9 +4408,7 @@ struct AAValueSimplifyImpl : AAValueSimplify { else return false; } else { - // FIXME: It should be llvm::None but if you set llvm::None, - // values are mistakenly infered as `undef` now. - SimplifiedAssociatedValue = &getAssociatedValue(); + SimplifiedAssociatedValue = llvm::None; } return true; } diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll b/llvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll index c3fe2b4fcfea..06ce2d579bcd 100644 --- a/llvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll +++ b/llvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes -; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=3 < %s | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 < %s | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" diff --git a/llvm/test/Transforms/Attributor/dereferenceable-1.ll b/llvm/test/Transforms/Attributor/dereferenceable-1.ll index bc16ab8f0c43..b42d85a34ea5 100644 --- a/llvm/test/Transforms/Attributor/dereferenceable-1.ll +++ b/llvm/test/Transforms/Attributor/dereferenceable-1.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -attributor -attributor-manifest-internal --attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=5 -S < %s | FileCheck %s --check-prefix=ATTRIBUTOR - +; RUN: opt -attributor -attributor-manifest-internal --attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefix=ATTRIBUTOR +; FIXME: Figure out why we need 16 iterations here. declare void @deref_phi_user(i32* %a); diff --git a/llvm/test/Transforms/Attributor/undefined_behavior.ll b/llvm/test/Transforms/Attributor/undefined_behavior.ll index fd0ddb1ebb85..8e16a919f483 100644 --- a/llvm/test/Transforms/Attributor/undefined_behavior.ll +++ b/llvm/test/Transforms/Attributor/undefined_behavior.ll @@ -265,15 +265,14 @@ e: ; Branch on undef that depends on propagation of ; undef of a previous instruction. -; FIXME: Currently it doesn't propagate the undef. define i32 @cond_br_on_undef3() { ; ATTRIBUTOR-LABEL: @cond_br_on_undef3( ; ATTRIBUTOR-NEXT: %cond = icmp ne i32 1, undef ; ATTRIBUTOR-NEXT: br i1 %cond, label %t, label %e ; ATTRIBUTOR: t: -; ATTRIBUTOR-NEXT: ret i32 1 +; ATTRIBUTOR-NEXT: unreachable ; ATTRIBUTOR: e: -; ATTRIBUTOR-NEXT: ret i32 2 +; ATTRIBUTOR-NEXT: unreachable %cond = icmp ne i32 1, undef br i1 %cond, label %t, label %e