https://llvm.org/bugs/show_bug.cgi?id=28922
Bug ID: 28922 Summary: Unsigned wrap check conditions falling to original code Product: Polly Version: unspecified Hardware: PC OS: Windows NT Status: NEW Severity: normal Priority: P Component: Optimizer Assignee: polly-...@googlegroups.com Reporter: chr...@codeaurora.org CC: llvm-bugs@lists.llvm.org Classification: Unclassified Created attachment 16927 --> https://llvm.org/bugs/attachment.cgi?id=16927&action=edit test case > opt -polly-process-unprofitable -polly-code-generator=isl -polly-ast > -analyze test.ll Consider the context check below, :: isl ast :: foo4 :: %entry.split---%for.cond.cleanup if (1 && 0 == (m >= n + 9223372036854775809 || n >= m + 9223372036854775808 || m == -9223372036854775808)) for (int c0 = 0; c0 < -m + n; c0 += 1) Stmt_for_body(c0); else { /* original code */ } Values 9223372036854775809 (0x8000000000000001) and 9223372036854775808 (8000000000000000) are already overflown and having addition operation with them leads to the result being wrapped. Hence this would lead to the context condition falling to the original code. On the other hand, say if the condition were in form where there was no operation with the max int values it would not wrap. i.e. if the condition were like (m - n >= 9223372036854775809) or (n - m >= 9223372036854775808). > opt -polly-process-unprofitable -polly-code-generator=isl -polly-codegen -S > test.ll --snip-- polly.split_new_and_old: ; preds = %entry %0 = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %n, i64 -9223372036854775807) <=== %.obit = extractvalue { i64, i1 } %0, 1 %polly.overflow.state = or i1 false, %.obit %.res = extractvalue { i64, i1 } %0, 0 %1 = icmp sge i64 %m, %.res %2 = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %m, i64 -9223372036854775808) <=== %.obit1 = extractvalue { i64, i1 } %2, 1 %polly.overflow.state2 = or i1 %polly.overflow.state, %.obit1 %.res3 = extractvalue { i64, i1 } %2, 0 %3 = icmp sge i64 %n, %.res3 %4 = or i1 %1, %3 %5 = icmp eq i64 %m, -9223372036854775808 %6 = or i1 %4, %5 %7 = sext i1 %6 to i64 %8 = icmp eq i64 0, %7 %9 = and i1 true, %8 %polly.rtc.overflown = xor i1 %polly.overflow.state2, true %polly.rtc.result = and i1 %9, %polly.rtc.overflown br i1 %polly.rtc.result, label %polly.start, label %entry.split --snip-- -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs