This is an archive of the discontinued LLVM Phabricator instance.

Handle boundry condition missed by r297682
AbandonedPublic

Authored by zzheng on Mar 15 2017, 5:31 PM.

Details

Summary

There's a corner case when imm is -2147483648, that's -2^31 and 0x80000000 in two's compliment.

SignExt this value then take it's negative, it's still 0x80000000 and interpreted as -2^31 by i32 type.

So we have infinite loop here where this function consume and produce this number forever.

Diff Detail

Repository
rL LLVM

Event Timeline

zzheng updated this revision to Diff 91966.Mar 15 2017, 5:31 PM
zzheng created this revision.

Updated diff with full context

zzheng edited the summary of this revision. (Show Details)Mar 15 2017, 5:33 PM
efriedma edited edge metadata.Mar 15 2017, 5:38 PM

(Missing context in diff; please generate diffs with "-U1000000".)

lib/Target/ARM/ARMISelLowering.cpp
9792

"-(1<<31)" is undefined behavior, strictly speaking. There are a few different ways you could write it, but the simplest is "INT32_MIN".

test/CodeGen/Thumb/long.ll
148

This comment is a bit misleading... we can, and do perform that transform.

sorry... this should be fixed by https://reviews.llvm.org/rL297820, I'll abandon this one.

zzheng abandoned this revision.Mar 15 2017, 5:42 PM

r297820 got reverted in r297842.