Fix Casting Bug
authorDavid Greene <greened@obbligato.org>
Mon, 14 Jan 2013 21:04:40 +0000 (21:04 +0000)
committerDavid Greene <greened@obbligato.org>
Mon, 14 Jan 2013 21:04:40 +0000 (21:04 +0000)
Add a const version of getFpValPtr to avoid a cast-away-const warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172467 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineAddSub.cpp

index f07c58d7d0997bf248d3319eabf89905775c2062..03be8ef6fb707c2c26a3b0c5c7d427616b3ac53d 100644 (file)
@@ -66,10 +66,12 @@ namespace {
     bool insaneIntVal(int V) { return V > 4 || V < -4; }
     APFloat *getFpValPtr(void)
       { return reinterpret_cast<APFloat*>(&FpValBuf.buffer[0]); }
+    const APFloat *getFpValPtr(void) const
+      { return reinterpret_cast<const APFloat*>(&FpValBuf.buffer[0]); }
 
     const APFloat &getFpVal(void) const {
       assert(IsFp && BufHasFpVal && "Incorret state");
-      return *reinterpret_cast<const APFloat*>(&FpValBuf.buffer[0]);
+      return *getFpValPtr();
     }
 
     APFloat &getFpVal(void)