Your question isn't clear; please restate what specifically isn't working. -Eli On Wed, Aug 14, 2013 at 11:57 AM, Rasha Omar <rasha.sala7 at gmail.com> wrote:> or like this > > %cmp4 = icmp eq i32 %rem, 0 > > br i1 %cmp4, label %if.then5, label %if.else7 > > > On 14 August 2013 20:08, Rasha Omar <rasha.sala7 at gmail.com> wrote: > >> Hi All, >> >> How could I use BranchInst to implement for example >> br label %if.else7 >> br label %if.then5 >> br i1 %cmp4, label %if.then5, label %if.else7 >> >> I can use BranchInst for only one instruction but how could I compare >> between two branches >> >> Thanks >> >> -- >> * Rasha Salah Omar >> Msc Student at E-JUST >> Demonestrator at Faculty of Computers and Informatics >> Benha University* >> >> * e-mail: rasha.omar at ejust.edu.eg* >> P* Please consider the environment before printing this email.* >> >> > > > -- > * Rasha Salah Omar > Msc Student at E-JUST > Demonestrator at Faculty of Computers and Informatics > Benha University* > > * e-mail: rasha.omar at ejust.edu.eg* > P* Please consider the environment before printing this email.* > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu llvm.cs.uiuc.edu > lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <lists.llvm.org/pipermail/llvm-dev/attachments/20130814/6b91bee1/attachment.html>
How could BranchInst be used to insert new branch between two basic blocks to get result like this example: br label %if.else br label %if.then br i1 %cmp1, label %if.then, label %if.else Thanks for your help On 14 August 2013 21:36, Eli Friedman <eli.friedman at gmail.com> wrote:> Your question isn't clear; please restate what specifically isn't working. > > -Eli > > On Wed, Aug 14, 2013 at 11:57 AM, Rasha Omar <rasha.sala7 at gmail.com>wrote: > >> or like this >> >> %cmp4 = icmp eq i32 %rem, 0 >> >> br i1 %cmp4, label %if.then5, label %if.else7 >> >> >> On 14 August 2013 20:08, Rasha Omar <rasha.sala7 at gmail.com> wrote: >> >>> Hi All, >>> >>> How could I use BranchInst to implement for example >>> br label %if.else7 >>> br label %if.then5 >>> br i1 %cmp4, label %if.then5, label %if.else7 >>> >>> I can use BranchInst for only one instruction but how could I compare >>> between two branches >>> >>> Thanks >>> >>> -- >>> * Rasha Salah Omar >>> Msc Student at E-JUST >>> Demonestrator at Faculty of Computers and Informatics >>> Benha University* >>> >>> * e-mail: rasha.omar at ejust.edu.eg* >>> P* Please consider the environment before printing this email.* >>> >>> >> >> >> -- >> * Rasha Salah Omar >> Msc Student at E-JUST >> Demonestrator at Faculty of Computers and Informatics >> Benha University* >> >> * e-mail: rasha.omar at ejust.edu.eg* >> P* Please consider the environment before printing this email.* >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu llvm.cs.uiuc.edu >> lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> >-- * Rasha Salah Omar Msc Student at E-JUST Demonestrator at Faculty of Computers and Informatics Benha University* * e-mail: rasha.omar at ejust.edu.eg* P* Please consider the environment before printing this email.* -------------- next part -------------- An HTML attachment was scrubbed... URL: <lists.llvm.org/pipermail/llvm-dev/attachments/20130815/6cd28f55/attachment.html>
Or maybe there is another method to be used?? On 15 August 2013 14:34, Rasha Omar <rasha.sala7 at gmail.com> wrote:> How could BranchInst be used to insert new branch between two basic blocks > to get result like this example: > > br label %if.else > br label %if.then > br i1 %cmp1, label %if.then, label %if.else > > Thanks for your help > > > On 14 August 2013 21:36, Eli Friedman <eli.friedman at gmail.com> wrote: > >> Your question isn't clear; please restate what specifically isn't working. >> >> -Eli >> >> On Wed, Aug 14, 2013 at 11:57 AM, Rasha Omar <rasha.sala7 at gmail.com>wrote: >> >>> or like this >>> >>> %cmp4 = icmp eq i32 %rem, 0 >>> >>> br i1 %cmp4, label %if.then5, label %if.else7 >>> >>> >>> On 14 August 2013 20:08, Rasha Omar <rasha.sala7 at gmail.com> wrote: >>> >>>> Hi All, >>>> >>>> How could I use BranchInst to implement for example >>>> br label %if.else7 >>>> br label %if.then5 >>>> br i1 %cmp4, label %if.then5, label %if.else7 >>>> >>>> I can use BranchInst for only one instruction but how could I compare >>>> between two branches >>>> >>>> Thanks >>>> >>>> -- >>>> * Rasha Salah Omar >>>> Msc Student at E-JUST >>>> Demonestrator at Faculty of Computers and Informatics >>>> Benha University* >>>> >>>> * e-mail: rasha.omar at ejust.edu.eg* >>>> P* Please consider the environment before printing this email.* >>>> >>>> >>> >>> >>> -- >>> * Rasha Salah Omar >>> Msc Student at E-JUST >>> Demonestrator at Faculty of Computers and Informatics >>> Benha University* >>> >>> * e-mail: rasha.omar at ejust.edu.eg* >>> P* Please consider the environment before printing this email.* >>> >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> LLVMdev at cs.uiuc.edu llvm.cs.uiuc.edu >>> lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>> >>> >> > > > -- > * Rasha Salah Omar > Msc Student at E-JUST > Demonestrator at Faculty of Computers and Informatics > Benha University* > > * e-mail: rasha.omar at ejust.edu.eg* > P* Please consider the environment before printing this email.* > >-- * Rasha Salah Omar Msc Student at E-JUST Demonestrator at Faculty of Computers and Informatics Benha University* * e-mail: rasha.omar at ejust.edu.eg* P* Please consider the environment before printing this email.* -------------- next part -------------- An HTML attachment was scrubbed... URL: <lists.llvm.org/pipermail/llvm-dev/attachments/20130815/0af57a57/attachment.html>
Hi Rasha,> How could BranchInst be used to insert new branch between two basic blocks > to get result like this example: > > br label %if.else > br label %if.then > br i1 %cmp1, label %if.then, label %if.elseI think that's still unclear. A basic block containing those three instructions would be invalid (only one terminating branch instruction is allowed). Why don't you write two functions, as simple as possible (but that llc will compile), showing an example of the kind of IR you have, and the kind you want? Tim.