Hi All, My codegen is trying to generate some thing like this: entry: .... %34 = icmp ne i32 %33, 15 br i1 %34, label %then, label %else then: ; preds = %entry %returnValue = or i1 true, false .... br label %ifmerge else: ; preds = %entry br label %ifmerge ifmerge: ; preds = %else, %then ... %41 = icmp ne i32 %40, 15 br i1 %41, label %then1, label %else3 then1: ; preds = %ifmerge %returnValue2 = or i1 true, %returnValue else3: ; preds = %ifmerge br label %ifmerge4 ifmerge4: ; preds = %else3, %then1 .... And I'm getting the following error: Instruction does not dominate all uses! %returnValue = or i1 true, false %returnValue2 = or i1 true, %returnValue Broken module found, compilation aborted!>From the code I can see all the operands are i1 type, so the 'or'instructions should be valid. Could some one give me some clues how to fix this problem? With Regards, --Cuong -- View this message in context: http://old.nabble.com/Avoiding-Constant-Folding-tp31838929p31838929.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
On Mon, Jun 13, 2011 at 5:33 PM, Cuong Pham <phamcuongbk at gmail.com> wrote:> > Hi All, > > My codegen is trying to generate some thing like this: > > entry: > .... > %34 = icmp ne i32 %33, 15 > br i1 %34, label %then, label %else > > then: ; preds = %entry > %returnValue = or i1 true, false > .... > br label %ifmerge > > else: ; preds = %entry > br label %ifmerge > > ifmerge: ; preds = %else, %then > ... > %41 = icmp ne i32 %40, 15 > br i1 %41, label %then1, label %else3 > > then1: ; preds = %ifmerge > %returnValue2 = or i1 true, %returnValue > > else3: ; preds = %ifmerge > br label %ifmerge4 > > ifmerge4: ; preds = %else3, %then1 > .... > > And I'm getting the following error: > Instruction does not dominate all uses! > %returnValue = or i1 true, false > %returnValue2 = or i1 true, %returnValue > Broken module found, compilation aborted! > > >From the code I can see all the operands are i1 type, so the 'or' > instructions should be valid. Could some one give me some clues how to fix > this problem?Maybe take a look at http://llvm.org/docs/tutorial/LangImpl7.html ? The simplest way to avoid "Instruction does not dominate all uses!" errors is to avoid having values defined in a different block from the use. -Eli
Hi,>> entry: >> .... >> %34 = icmp ne i32 %33, 15 >> br i1 %34, label %then, label %else >> >> then: ; preds = %entry >> %returnValue = or i1 true, false >> .... >> br label %ifmerge >> >> else: ; preds = %entry >> br label %ifmerge >> >> ifmerge: ; preds = %else, %then >> ... >> %41 = icmp ne i32 %40, 15 >> br i1 %41, label %then1, label %else3 >> >> then1: ; preds = %ifmerge >> %returnValue2 = or i1 true, %returnValueif control flow goes: "entry" -> "else" -> "ifmerge" -> "then1", then you will try to use %returnValue in then1 without ever defining it. This is what the error message is trying to tell you. Ciao, Duncan.>> >> else3: ; preds = %ifmerge >> br label %ifmerge4 >> >> ifmerge4: ; preds = %else3, %then1 >> .... >> >> And I'm getting the following error: >> Instruction does not dominate all uses! >> %returnValue = or i1 true, false >> %returnValue2 = or i1 true, %returnValue >> Broken module found, compilation aborted!Ciao, Duncan.