[PATCH] D24104: Make GlobalsAA ignore dead constant expressions.

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 12:10:02 PDT 2016


sanjoy added inline comments.


> GlobalsModRef.cpp:369
>          return true; // Allow comparison against null.
> +    } else if (Constant *C = dyn_cast<Constant>(I)) {
> +      return C->isConstantUsed();

How about pulling this out of the loop?  That is, do:

  if (auto *C = dyn_cast<Constant>(V))
    if (!C->isConstantUsed())
      return false;

> dead-uses.ll:11
> +; CHECK-LABEL: define i32 @g()
> +; CHECK: load i32, i32* @a, align 4
> +; CHECK-NEXT: br label %for.cond

Some more context here will be helpful -- are you trying to check if the load was hoisted out of the loop?  If so, then a `CHECK: entry:` before the `load` will be nice (since there are two instances of `br label %for.inc`).

Repository:
  rL LLVM

https://reviews.llvm.org/D24104





More information about the llvm-commits mailing list