[llvm] r303800 - [AArch64] Prevent nested ADDs from address calc in splitStoreSplat. NFC

Friedman, Eli via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 11:55:00 PDT 2017


On 5/25/2017 9:10 AM, Nirav Davé wrote:
> Hmm. Wrapping was why I had it signed (I was looking at a negative 
> BaseOffset). I believe we want the signed interpretation for the 
> constant here.
>
> That said, it looks like getConstant only accepts a uint64_t so we are 
> implicitly casting. The internal ConstantInt the value is fed into 
> does allow it to be interpreted as signed. Presumably we do not have 
> signed constant nodes to improve constant sharing. I wonder if it's 
> worth propagating signedness throughout to explicitly avoid any 
> overflow/underflow problems.

The overflow/underflow problem here is that if you build LLVM with 
-fsanitize=undefined, it will crash here trying to fold the addition in 
certain cases.  Hence the suggestion to use uint64_t, which wraps the 
same way ISD::ADD does.

(We don't have signed/unsigned integer constants because we don't have 
signed/unsigned integer types in IR.)

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-commits mailing list