Craig Smith
2011-Aug-19 20:59 UTC
[LLVMdev] LLVM ERROR: Cannot select error in simple i128 math?
In both LLVM 2.9 and the current svn head, I get the following error when running llc % llc < fxp2.ll LLVM ERROR: Cannot select: 0xa5302b0: glue = carry_false [ID=7] on this code: target triple = "i386-pc-linux-gnu" define i32 @fxpadd(i32 %cl) { entry: %0 = zext i32 %cl to i128 %1 = zext i32 %cl to i128 %2 = add i128 %1, %0 br label %L1001510 L1001510: ; preds = %L13400 %vr1484.5 = trunc i128 %2 to i32 ret i32 %vr1484.5 } This code was whittled down from a fixed point math test by bugpoint, and further simplified by hand. The problem did not occur in 2.8. (Removing the trivial branch makes the problem go away.) I'm not sure where to begin debugging it, so any pointers would be appreciated.
Eli Friedman
2011-Aug-19 22:06 UTC
[LLVMdev] LLVM ERROR: Cannot select error in simple i128 math?
On Fri, Aug 19, 2011 at 1:59 PM, Craig Smith <craig at ni.com> wrote:> In both LLVM 2.9 and the current svn head, I get the following error when running llc > > % llc < fxp2.ll > LLVM ERROR: Cannot select: 0xa5302b0: glue = carry_false [ID=7] > > on this code: > > target triple = "i386-pc-linux-gnu" > > define i32 @fxpadd(i32 %cl) { > entry: > %0 = zext i32 %cl to i128 > %1 = zext i32 %cl to i128 > %2 = add i128 %1, %0 > br label %L1001510 > > L1001510: ; preds = %L13400 > %vr1484.5 = trunc i128 %2 to i32 > ret i32 %vr1484.5 > > } > > This code was whittled down from a fixed point math test by bugpoint, and further simplified by hand. The problem did not occur in 2.8. > (Removing the trivial branch makes the problem go away.) > > I'm not sure where to begin debugging it, so any pointers would be appreciated.DAGCombiner::visitADDE looks suspicious to me... specifically, the way ReplaceAllUsesOfValueWith is used. -Eli
Benjamin Kramer
2011-Aug-19 22:41 UTC
[LLVMdev] LLVM ERROR: Cannot select error in simple i128 math?
On Fri, Aug 19, 2011 at 15:06, Eli Friedman <eli.friedman at gmail.com> wrote:> On Fri, Aug 19, 2011 at 1:59 PM, Craig Smith <craig at ni.com> wrote: >> In both LLVM 2.9 and the current svn head, I get the following error when running llc >> >> % llc < fxp2.ll >> LLVM ERROR: Cannot select: 0xa5302b0: glue = carry_false [ID=7] >> >> on this code: >> >> target triple = "i386-pc-linux-gnu" >> >> define i32 @fxpadd(i32 %cl) { >> entry: >> %0 = zext i32 %cl to i128 >> %1 = zext i32 %cl to i128 >> %2 = add i128 %1, %0 >> br label %L1001510 >> >> L1001510: ; preds = %L13400 >> %vr1484.5 = trunc i128 %2 to i32 >> ret i32 %vr1484.5 >> >> } >> >> This code was whittled down from a fixed point math test by bugpoint, and further simplified by hand. The problem did not occur in 2.8. >> (Removing the trivial branch makes the problem go away.) >> >> I'm not sure where to begin debugging it, so any pointers would be appreciated. > > DAGCombiner::visitADDE looks suspicious to me... specifically, the way > ReplaceAllUsesOfValueWith is used.Yeah, it's a hack. I was looking for a way to do this without introducing matchers for ADDE everywhere, but it turns the way DAGCombiner works upside down. I ripped it out in r138130, additions on big integer types will get more ugly in some cases, but we'll see if someone cares enough to make DAGCombine smarter about glue flags. - Ben