[PATCH] D62266: [DAGCombine][X86][AArch64][ARM] (C - x) + y -> (y - x) + C fold

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 13:49:14 PDT 2019


lebedev.ri added a comment.

In D62266#1521995 <https://reviews.llvm.org/D62266#1521995>, @dmgreen wrote:

> Hello. I found this code that seems to loop forever:


*This* code? As in *this* patch, correct?

>   target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
>   target triple = "thumbv6m-arm-none-eabi"
>   
>   @a = dso_local local_unnamed_addr global i32 0, align 4
>   @b = dso_local local_unnamed_addr global i32 0, align 4
>   
>   ; Function Attrs: minsize nounwind optsize
>   define dso_local i32 @c() local_unnamed_addr #0 {
>   entry:
>     %0 = load i32, i32* @a, align 4
>     %sub = sub nsw i32 2000, %0
>     %call = tail call i32 bitcast (i32 (...)* @d to i32 (i32)*)(i32 %sub) #2
>     %1 = load i32, i32* @b, align 4
>     %cmp = icmp sgt i32 %1, 1999
>     br i1 %cmp, label %if.then, label %if.end
>   
>   if.then:                                          ; preds = %entry
>     %call1 = tail call i32 bitcast (i32 (...)* @e to i32 ()*)() #2
>     br label %if.end
>   
>   if.end:                                           ; preds = %if.then, %entry
>     ret i32 undef
>   }
>   
>   declare dso_local i32 @d(...) local_unnamed_addr #1
>   declare dso_local i32 @e(...) local_unnamed_addr #1

Thanks for the reproducer.
There may be one more (as in, an unrelated to this one) endless loop in D62257 <https://reviews.llvm.org/D62257> in test-suite, did not reduce it yet (i reverted that patch)


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62266/new/

https://reviews.llvm.org/D62266





More information about the llvm-commits mailing list