[PATCH] D43762: [IPSCCP] Use constant range information for comparisons of parameters.

Eric Christopher via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 11 19:12:25 PDT 2018


I've gone ahead and reverted this for now in r336877. Happy to help if we
need anything more here.

-eric

On Wed, Jul 11, 2018 at 3:39 PM Jordan Rupprecht via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> It looks like this commit caused a miscompile regression (with -O1 or
> greater), reduced to this example:
>
> namespace {
> template <typename T1, typename T2>
> bool Same(const T1& v1, const T2& v2) {
>   return v1 == v2;
> }
>
> class Thing {
>  public:
>   enum Color { kPurple, kYellow };
>   enum Numbers { kZero };
>
>   static bool CheckFoo(int x, Color color) {
>     if (!Same(kZero, x)) __builtin_abort();
>     if (color == kPurple) __builtin_printf("color is purple\n");
>     return true;
>   }
> };
>
> class SomeThing : public Thing {
>  public:
>   static void DoBar() {
>     if (!CheckFoo(0, kPurple)) {
>       __builtin_printf("This should never happen\n");
>     }
>   }
> };
>
> class OtherThing : public Thing {
>  public:
>   static void DoBar() {
>     if (!CheckFoo(0, kYellow)) {
>       __builtin_printf("This should never happen\n");
>     }
>   }
> };
> }  // namespace
>
> int main(int argc, char** argv) {
>   SomeThing::DoBar();
>   OtherThing::DoBar();
>   return 0;
> }
>
> Output:
> $ <clang built @r336098> -O1 regression.cc && ./a.out
> color is purple
> This should never happen
> This should never happen
> $ <clang built @r336097> -O1 regression.cc && ./a.out
> color is purple
> It looks like this might just be uncovering a bug in an earlier revision
> (r335588), but we're not sure yet. Mind if we revert this change until we
> figure out what's going on?
>
> (I also left this comment on https://reviews.llvm.org/rL336098, reposting
> here for visibility)
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180711/4070a8f2/attachment.html>


More information about the llvm-commits mailing list